add version 0.1.4.0
parent
080088528e
commit
b4c58d9bc1
|
@ -13,7 +13,7 @@
|
|||
}
|
||||
},
|
||||
"SiteSettings": {
|
||||
"BaseUrl": "http://localhost:32769",
|
||||
"BaseUrl": "http://192.168.88.12:32769",
|
||||
"KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B",
|
||||
"UserSetting": {
|
||||
"Username": "root",
|
||||
|
|
|
@ -6,52 +6,52 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<AssemblyVersion>0.1.3.3</AssemblyVersion>
|
||||
<FileVersion>0.1.3.3</FileVersion>
|
||||
<AssemblyVersion>0.1.4.0</AssemblyVersion>
|
||||
<FileVersion>0.1.4.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Asp.Versioning.Http" Version="7.0.1" />
|
||||
<PackageReference Include="Asp.Versioning.Http" Version="7.1.0" />
|
||||
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
|
||||
<PackageReference Include="Carter" Version="7.1.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.7.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.7.1" />
|
||||
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="11.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="7.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||
<PackageReference Include="Carter" Version="7.2.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.8.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.1" />
|
||||
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="11.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Autofac" Version="7.1.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="4.1.16" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
|
||||
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.0.17" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.8" />
|
||||
<PackageReference Include="Sentry.Serilog" Version="3.34.0" />
|
||||
<PackageReference Include="Serilog" Version="3.0.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
|
||||
<PackageReference Include="Sentry.Serilog" Version="3.41.3" />
|
||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.2" />
|
||||
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="4.3.29" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.0.38" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="9.1.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="9.1.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="9.1.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.8" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.12" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="Autofac" />
|
||||
|
|
|
@ -17,7 +17,7 @@ public class ActivityController : ICarterModule
|
|||
.WithDisplayName("GetActivity")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("done/{id:guid}", DoneActivityAsync)
|
||||
group.MapPost("done/{id:guid}", DoneActivityAsync)
|
||||
.WithDisplayName("DoneActivity")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["Berizco.Api/Berizco.Api.csproj", "Berizco.Api/"]
|
||||
RUN dotnet restore "Berizco.Api/Berizco.Api.csproj"
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
|
||||
</ItemGroup>
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -11,8 +24,8 @@
|
|||
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
|
||||
</ItemGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="MD.PersianDateTime.Standard" />
|
||||
|
|
|
@ -54,6 +54,13 @@ public static class ApplicationClaims
|
|||
Title = "دسترسی کامل به شیفت بندی ها",
|
||||
Detail = "دسترسی به افزودن و مدیریت شیفت بندی فروشگاه شما"
|
||||
};
|
||||
public static ClaimDto ViewShiftPlans { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewShiftPlans,
|
||||
Title = "مشاهده کامل به شیفت بندی ها",
|
||||
Detail = "دسترسی به افزودن و مدیریت شیفت بندی فروشگاه شما"
|
||||
};
|
||||
|
||||
public static ClaimDto ManageTasks { get; } = new ClaimDto
|
||||
{
|
||||
|
@ -76,6 +83,78 @@ public static class ApplicationClaims
|
|||
Title = "دسترسی کامل به فعالیت ها",
|
||||
Detail = "دسترسی به افزودن و مدیریت فعالیت ها فروشگاه شما"
|
||||
};
|
||||
public static ClaimDto ViewActivities { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewActivities,
|
||||
Title = "مشاهده فعالیت ها",
|
||||
Detail = "دسترسی به مشاهده فعالیت ها فروشگاه شما"
|
||||
};
|
||||
|
||||
|
||||
public static ClaimDto ManageRoutines { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageRoutines,
|
||||
Title = "دسترسی کامل به روتین ها",
|
||||
Detail = "دسترسی به افزودن و مدیریت فعالیت ها فروشگاه شما"
|
||||
};
|
||||
public static ClaimDto ViewRoutines { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewRoutines,
|
||||
Title = "مشاهده روتین ها",
|
||||
Detail = "دسترسی به مشاهده فعالیت ها فروشگاه شما"
|
||||
};
|
||||
|
||||
|
||||
public static ClaimDto ManagePositions { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManagePositions,
|
||||
Title = "دسترسی کامل به پوزیشن ها",
|
||||
Detail = "دسترسی به افزودن و مدیریت فعالیت ها فروشگاه شما"
|
||||
};
|
||||
public static ClaimDto ViewPositions { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewPositions,
|
||||
Title = "مشاهده پوزیشن ها",
|
||||
Detail = "دسترسی به مشاهده فعالیت ها فروشگاه شما"
|
||||
};
|
||||
|
||||
|
||||
public static ClaimDto ManageSections { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageSections,
|
||||
Title = "دسترسی کامل به سکشن ها",
|
||||
Detail = "دسترسی به افزودن و مدیریت فعالیت ها فروشگاه شما"
|
||||
};
|
||||
public static ClaimDto ViewSections { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewSections,
|
||||
Title = "مشاهده سکشن ها",
|
||||
Detail = "دسترسی به مشاهده فعالیت ها فروشگاه شما"
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static ClaimDto ViewDashboard { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewDashboard,
|
||||
Title = "دسترسی کامل به داشبورد ها",
|
||||
Detail = "دسترسی به داشبورد ها فروشگاه شما"
|
||||
};
|
||||
public static ClaimDto ViewComplexSettings { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewComplexSettings,
|
||||
Title = "مشاهده تنظیمات ها",
|
||||
Detail = "دسترسی به مشاهده تنظیمات ها فروشگاه شما"
|
||||
};
|
||||
|
||||
public static List<ClaimDto> AllClaimDtos = new List<ClaimDto>
|
||||
{
|
||||
|
@ -89,6 +168,20 @@ public static class ApplicationClaims
|
|||
|
||||
ViewComplexes,
|
||||
ManageComplexes,
|
||||
|
||||
ViewActivities,
|
||||
|
||||
ManageRoutines,
|
||||
ViewRoutines,
|
||||
|
||||
ManagePositions,
|
||||
ViewPositions,
|
||||
|
||||
ManageSections,
|
||||
ViewSections,
|
||||
|
||||
ViewComplexSettings,
|
||||
ViewDashboard
|
||||
};
|
||||
|
||||
public static List<Claim> AllClaims = new List<Claim>
|
||||
|
@ -96,7 +189,6 @@ public static class ApplicationClaims
|
|||
ManageStaffs.GetClaim,
|
||||
ViewStaffs.GetClaim,
|
||||
|
||||
ManageActivities.GetClaim,
|
||||
ViewTasks.GetClaim,
|
||||
ManageTasks.GetClaim,
|
||||
|
||||
|
@ -106,6 +198,21 @@ public static class ApplicationClaims
|
|||
|
||||
ViewComplexes.GetClaim,
|
||||
ManageComplexes.GetClaim,
|
||||
|
||||
ManageActivities.GetClaim,
|
||||
ViewActivities.GetClaim,
|
||||
|
||||
ManageRoutines.GetClaim,
|
||||
ViewRoutines.GetClaim,
|
||||
|
||||
ManagePositions.GetClaim,
|
||||
ViewPositions.GetClaim,
|
||||
|
||||
ManageSections.GetClaim,
|
||||
ViewSections.GetClaim,
|
||||
|
||||
ViewDashboard.GetClaim,
|
||||
ViewComplexSettings.GetClaim
|
||||
};
|
||||
|
||||
public static List<Claim> ManagerClaims = new List<Claim>
|
||||
|
@ -114,29 +221,55 @@ public static class ApplicationClaims
|
|||
ViewStaffs.GetClaim,
|
||||
|
||||
ManageActivities.GetClaim,
|
||||
ViewActivities.GetClaim,
|
||||
|
||||
ViewTasks.GetClaim,
|
||||
ManageTasks.GetClaim,
|
||||
|
||||
ManageShiftPlans.GetClaim,
|
||||
ViewShiftPlans.GetClaim,
|
||||
|
||||
ViewShifts.GetClaim,
|
||||
ManageShifts.GetClaim,
|
||||
|
||||
ManageRoutines.GetClaim,
|
||||
ViewRoutines.GetClaim,
|
||||
|
||||
ManagePositions.GetClaim,
|
||||
ViewPositions.GetClaim,
|
||||
|
||||
ManageSections.GetClaim,
|
||||
ViewSections.GetClaim,
|
||||
|
||||
ViewDashboard.GetClaim,
|
||||
ViewComplexSettings.GetClaim
|
||||
};
|
||||
|
||||
|
||||
public static List<Claim> SuperVisorClaims = new List<Claim>
|
||||
{
|
||||
ManageActivities.GetClaim,
|
||||
ViewActivities.GetClaim,
|
||||
|
||||
ViewTasks.GetClaim,
|
||||
ManageTasks.GetClaim,
|
||||
|
||||
ManageShiftPlans.GetClaim,
|
||||
ViewShiftPlans.GetClaim,
|
||||
|
||||
ViewShifts.GetClaim,
|
||||
ManageShifts.GetClaim,
|
||||
|
||||
ViewDashboard.GetClaim
|
||||
};
|
||||
|
||||
public static List<Claim> StaffClaims = new List<Claim>
|
||||
{
|
||||
ManageActivities.GetClaim,
|
||||
ViewActivities.GetClaim,
|
||||
|
||||
ViewTasks.GetClaim,
|
||||
|
||||
ViewDashboard.GetClaim
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,9 +10,25 @@ public static class ApplicationPermission
|
|||
|
||||
public const string ManageShifts = nameof(ManageShifts);
|
||||
public const string ViewShifts = nameof(ViewShifts);
|
||||
|
||||
public const string ViewShiftPlans = nameof(ViewShiftPlans);
|
||||
public const string ManageShiftPlans = nameof(ManageShiftPlans);
|
||||
|
||||
public const string ManageTasks = nameof(ManageTasks);
|
||||
public const string ViewTasks = nameof(ViewTasks);
|
||||
|
||||
public const string ManageActivities = nameof(ManageActivities);
|
||||
public const string ViewActivities = nameof(ViewActivities);
|
||||
|
||||
public const string ManageRoutines = nameof(ManageRoutines);
|
||||
public const string ViewRoutines = nameof(ViewRoutines);
|
||||
|
||||
public const string ManagePositions = nameof(ManagePositions);
|
||||
public const string ViewPositions = nameof(ViewPositions);
|
||||
|
||||
public const string ManageSections = nameof(ManageSections);
|
||||
public const string ViewSections = nameof(ViewSections);
|
||||
|
||||
public const string ViewDashboard = nameof(ViewDashboard);
|
||||
public const string ViewComplexSettings = nameof(ViewComplexSettings);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class JwtService : IJwtService
|
|||
public async Task<AccessToken<TUserDto,TRole>> Generate<TUserDto, TUser, TRole>(TUser user, Guid complexId, Guid roleId) where TUser : ApplicationUser
|
||||
{
|
||||
var tokenId = StringExtensions.GetId(8);
|
||||
var claims = await GetClaims(user, tokenId);
|
||||
var claims = await GetClaims(user, tokenId,roleId.ToString());
|
||||
claims.Add(new Claim("ComplexId", complexId.ToString()));
|
||||
|
||||
return BaseGenerate<TUserDto, TUser, TRole>(user, claims);
|
||||
|
@ -150,6 +150,7 @@ public class JwtService : IJwtService
|
|||
var handler = new JwtSecurityTokenHandler();
|
||||
var token = new AccessToken<TUserDto, TRole>(handler.CreateJwtSecurityToken(desctiptor));
|
||||
token.User = user.Adapt<TUserDto>();
|
||||
token.Permissions = claims.Where(c => c.Type == "Permission").Select(c => c.Value).ToList();
|
||||
return token;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
|
||||
<PackageReference Include="Autofac.Extras.Quartz" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Quartz" Version="3.7.0" />
|
||||
<PackageReference Include="Quartz" Version="3.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -182,7 +182,8 @@ public class UserService : IUserService
|
|||
NationalId = request.NationalId,
|
||||
BirthDate = DateTimeExtensions.UnixTimeStampToDateTime(request.BirthDateTimeStamp),
|
||||
Gender = request.Gender,
|
||||
SignUpStatus = SignUpStatus.SignUpCompleted
|
||||
SignUpStatus = SignUpStatus.SignUpCompleted,
|
||||
PhoneNumberConfirmed = true
|
||||
};
|
||||
|
||||
if (!request.Password.IsNullOrEmpty())
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--<PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mapster" Version="7.3.0" />
|
||||
<PackageReference Include="Mapster.Core" Version="1.2.0" />
|
||||
<PackageReference Include="MediatR" Version="12.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="7.0.11" />
|
||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||
<PackageReference Include="Mapster.Core" Version="1.2.1" />
|
||||
<PackageReference Include="MediatR" Version="12.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>-->
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>-->
|
||||
|
||||
|
||||
<Target Name="Mapster">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
@ -11,7 +11,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Refit" Version="6.3.2" />
|
||||
<PackageReference Include="Refit" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
namespace Brizco.Infrastructure.Services;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Brizco.Infrastructure.Services;
|
||||
|
||||
public class SmsService : ISmsService
|
||||
{
|
||||
private readonly IRestApiWrapper _restApiWrapper;
|
||||
private readonly ILogger<SmsService> _logger;
|
||||
private readonly IHostEnvironment _environment;
|
||||
private readonly SiteSettings _siteSettings;
|
||||
public SmsService(IRestApiWrapper restApiWrapper,
|
||||
public SmsService(
|
||||
IRestApiWrapper restApiWrapper,
|
||||
IOptionsSnapshot<SiteSettings> optionsSnapshot,
|
||||
ILogger<SmsService> logger)
|
||||
ILogger<SmsService> logger,
|
||||
IHostEnvironment environment)
|
||||
{
|
||||
_restApiWrapper = restApiWrapper;
|
||||
_logger = logger;
|
||||
_environment = environment;
|
||||
_siteSettings = optionsSnapshot.Value;
|
||||
}
|
||||
public async Task SendForgerPasswordAsync(string phoneNumber, string newPassword)
|
||||
|
@ -24,10 +30,21 @@ public class SmsService : ISmsService
|
|||
public async Task SendVerifyCodeAsync(string phoneNumber, string verifyCode)
|
||||
{
|
||||
|
||||
var rest = await _restApiWrapper.KaveNegarRestApi.SendLookUp(_siteSettings.KaveNegarApiKey, phoneNumber, verifyCode, null, null, null, "login-brizco");
|
||||
try
|
||||
{
|
||||
var rest = await _restApiWrapper.KaveNegarRestApi.SendLookUp(_siteSettings.KaveNegarApiKey, phoneNumber,
|
||||
verifyCode, null, null, null, "login-brizco");
|
||||
|
||||
if (rest.Return.status != 200)
|
||||
throw new BaseApiException(ApiResultStatusCode.SendSmsError, rest.Return.message);
|
||||
if (rest.Return.status != 200 && _environment.IsProduction())
|
||||
throw new BaseApiException(ApiResultStatusCode.SendSmsError, rest.Return.message);
|
||||
}
|
||||
catch (ApiException apiException)
|
||||
{
|
||||
if (_environment.IsProduction())
|
||||
throw ;
|
||||
else
|
||||
_logger.LogError(apiException.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -7,22 +7,22 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MediatR" Version="12.1.1" />
|
||||
<PackageReference Include="FluentValidation" Version="11.7.1" />
|
||||
<PackageReference Include="MediatR" Version="12.2.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.8.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.11">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pluralize.NET" Version="1.0.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.11" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.6.122" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.4" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="9.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
Loading…
Reference in New Issue