Merge branch 'master' of http://git2.aycode.com/Adam/TourIAm
This commit is contained in:
commit
945e4128cf
|
|
@ -0,0 +1,5 @@
|
|||
aycode.core rebuild product mode
|
||||
copy: \AyCode.Core\AyCode.Services.Server\bin\Product\net8.0 to \AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0
|
||||
Setting.cs baseurl
|
||||
megnézni a Loglevelt és ha olyan, átállítani TiamConstClient.DefaultLogLevelClient
|
||||
database connection, server side loglevel string átírni tiamwebappserver\appsettings.json
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using AyCode.Core.Consts;
|
||||
using AyCode.Core.Loggers;
|
||||
|
||||
namespace TIAM.Core.Consts;
|
||||
|
||||
|
|
@ -12,6 +13,11 @@ public static class TiamConstClient
|
|||
Guid.Parse("4cbaed43-2465-4d99-84f1-c8bc6b7025f7"),
|
||||
Guid.Parse("540271f6-c604-4c16-8160-d5a7cafedf00")
|
||||
};
|
||||
#if RELEASE
|
||||
public static LogLevel DefaultLogLevelClient = LogLevel.Debug;
|
||||
#else
|
||||
public static LogLevel DefaultLogLevelClient = LogLevel.Detail;
|
||||
#endif
|
||||
}
|
||||
|
||||
public class TiamConst : AcConst
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ namespace TIAM.Database.DataLayers.Users
|
|||
public async Task<bool> CreateUserAsync(User user)
|
||||
{
|
||||
Context.Users.Add(user);
|
||||
Profile profile = new Profile();
|
||||
profile.Id = Guid.NewGuid();
|
||||
var parts = user.EmailAddress.Split('@');
|
||||
profile.Name = parts[0];
|
||||
Context.Profiles.Add(profile);
|
||||
Console.WriteLine($@"Saving user to db {user.Id}, {user.EmailAddress}, {user.PhoneNumber}, {user.Password}");
|
||||
return await Context.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,6 @@
|
|||
<meta name="twitter:description" content="Book reliable and affordable airport transfers with Tour I Am. Enjoy a hassle-free ride to and from the airport with our professional drivers.">
|
||||
<meta name="twitter:image" content="https://touriam.com/images/airport-transfer.jpg">
|
||||
|
||||
<!-->link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0/css/bootstrap.min.css"-->
|
||||
|
||||
|
||||
|
||||
<base href="/" />
|
||||
<link rel="stylesheet" href="_content/TIAMSharedUI/css/bootstrap/bootstrap.min.css" />
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@
|
|||
|
||||
foreach (UserProductMapping Permission in Permissions)
|
||||
{
|
||||
var permissionToCheck = await ServiceProviderDataService.GetUserProductMappingByIdAsync(Permission.Id);
|
||||
_logger.Debug($"calling IsPowerOf with values: {Permission.Id}, {Permission.Permissions}, {permissionToCheck.Permissions}, {3}");
|
||||
var driverPermissionResult = IsBitSet(permissionToCheck.Permissions, 3);
|
||||
//var permissionToCheck = await ServiceProviderDataService.GetUserProductMappingByIdAsync(Permission.Id);
|
||||
_logger.Debug($"calling IsPowerOf with values: {Permission.Id}, {Permission.Permissions}, {1}");
|
||||
var driverPermissionResult = IsBitSet(Permission.Permissions, 1);
|
||||
if (driverPermissionResult)
|
||||
{
|
||||
_isDriver = true;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using AyCode.Services.Loggers;
|
|||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using TIAM.Core.Consts;
|
||||
using TIAM.Entities.Users;
|
||||
using TIAMWebApp.Shared.Application.Services;
|
||||
|
||||
namespace TIAMSharedUI.Pages
|
||||
{
|
||||
|
|
@ -157,12 +158,12 @@ namespace TIAMSharedUI.Pages
|
|||
/// This method stores the user data in the session service so we know during navigation that the user is logged in.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
protected void SaveToSessionInfo(UserSessionModel user)
|
||||
protected async Task SaveToSessionInfo(UserSessionModel user)
|
||||
{
|
||||
sessionService.User = user;
|
||||
sessionService.IsAuthenticated = true;
|
||||
sessionService.HasCompany = user.UserModelDto.UserProductMappings.Count > 0;
|
||||
sessionService.IsDriver = CheckIfDriver(user.UserModelDto.UserProductMappings);
|
||||
sessionService.IsDriver = await CheckIfDriver(user.UserModelDto.UserProductMappings);
|
||||
if (user.UserModelDto.Id == TiamConstClient.DevAdminIds[0] || user.UserModelDto.Id == TiamConstClient.DevAdminIds[1])
|
||||
{
|
||||
sessionService.IsDevAdmin = true;
|
||||
|
|
@ -177,12 +178,16 @@ namespace TIAMSharedUI.Pages
|
|||
BrowserConsoleLogWriter.Debug($"Saved to session: IsAuthenticated: {sessionService.IsAuthenticated}, HasCompany: {sessionService.HasCompany}, IsDriver: {sessionService.IsDriver}, IsDevAdmin: {sessionService.IsDevAdmin}, IsSysAdmin: {sessionService.IsSysAdmin}");
|
||||
}
|
||||
|
||||
public bool CheckIfDriver(List<UserProductMapping> Permissions)
|
||||
public async Task<bool> CheckIfDriver(List<UserProductMapping> Permissions)
|
||||
{
|
||||
bool _isDriver = false;
|
||||
|
||||
foreach (UserProductMapping Permission in Permissions)
|
||||
{
|
||||
if (IsPowerOfTwoInSum(2, Permission.Permissions))
|
||||
//var permissionToCheck = await ServiceProviderDataService.GetUserProductMappingByIdAsync(Permission.Id);
|
||||
BrowserConsoleLogWriter.Debug($"calling IsPowerOf with values: {Permission.Id}, {Permission.Permissions}, {1}");
|
||||
var driverPermissionResult = IsBitSet(Permission.Permissions, 1);
|
||||
if (driverPermissionResult)
|
||||
{
|
||||
_isDriver = true;
|
||||
sessionService.DriverPersmissionId = Permission.Id;
|
||||
|
|
@ -191,10 +196,16 @@ namespace TIAMSharedUI.Pages
|
|||
return _isDriver;
|
||||
}
|
||||
|
||||
public static bool IsPowerOfTwoInSum(int number, int power)
|
||||
public bool IsBitSet(int number, int power)
|
||||
{
|
||||
BrowserConsoleLogWriter.Debug($"called IsBitSet with values: {number}, {power}");
|
||||
|
||||
int powerOfTwo = 1 << power; // Calculate 2^power
|
||||
return (number & powerOfTwo) != 0; // Check if the bit at position `power` is set
|
||||
|
||||
BrowserConsoleLogWriter.Debug($"powerOfTwo: {powerOfTwo}, {power}");
|
||||
|
||||
bool result = (number & powerOfTwo) != 0; // Check if the bit at position `power` is set
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ using TIAM.Entities.Profiles;
|
|||
using TIAM.Entities.Addresses;
|
||||
using TIAM.Services.Server.Logins;
|
||||
using ILogger = TIAM.Core.Loggers.ILogger;
|
||||
using AyCode.Core.Helpers;
|
||||
|
||||
namespace TIAMWebApp.Server.Controllers
|
||||
{
|
||||
|
|
@ -197,7 +198,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
else
|
||||
{
|
||||
var user = JObject.Parse(serializedRegistrationModel.GetRawText()).ToObject<RegistrationModel>();
|
||||
|
||||
bool result = false;
|
||||
if (user != null)
|
||||
{
|
||||
//add userModel to users array
|
||||
|
|
@ -220,12 +221,22 @@ namespace TIAMWebApp.Server.Controllers
|
|||
_logger.Info($@"User to be created: {email}");
|
||||
_logger.Info($@"User to be created: {phoneNumber}");
|
||||
_logger.Info($@"User to be created: {password}");
|
||||
|
||||
await _userDal.CreateUserAsync(new User(userId, email, phoneNumber, password));
|
||||
//var hashedPassword = PasswordHasher.HashPassword(user.Password, PasswordHasher.GenerateDynamicSalt(userId));
|
||||
//await _userDal.CreateUserAsync(new User(userId, email, phoneNumber, hashedPassword));
|
||||
var createResult = await _loginService.RegistrationAsync(userId, email, password, phoneNumber);
|
||||
if (createResult != AyCode.Core.Consts.AcErrorCode.Unset)
|
||||
{
|
||||
_logger.Error("Error:" + createResult.ToString());
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Ok("yes");
|
||||
return Ok(result.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -298,6 +309,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
var email = user?.Email;
|
||||
var phoneNumber = user?.PhoneNumber;
|
||||
var password = user?.Password;
|
||||
|
||||
var referralId = user?.ReferralId;
|
||||
|
||||
if (email is null || phoneNumber is null || password is null)
|
||||
|
|
@ -310,23 +322,32 @@ namespace TIAMWebApp.Server.Controllers
|
|||
_logger.Info($@"User to be created: {email}");
|
||||
_logger.Info($@"User to be created: {phoneNumber}");
|
||||
_logger.Info($@"User to be created: {password}");
|
||||
User userToCreate = new(userId, email, phoneNumber, password);
|
||||
userToCreate.ProfileId = Guid.NewGuid();
|
||||
//User userToCreate = new(userId, email, phoneNumber, hashedPassword);
|
||||
//userToCreate.ProfileId = Guid.NewGuid();
|
||||
|
||||
userToCreate.Profile = new Profile();
|
||||
userToCreate.Profile.Id = userToCreate.ProfileId;
|
||||
userToCreate.Profile.Name = "Guest - " + nameExtension;
|
||||
userToCreate.RefferalId = referralId;
|
||||
userToCreate.Profile.AddressId = Guid.NewGuid();
|
||||
//userToCreate.Profile = new Profile();
|
||||
//userToCreate.Profile.Id = userToCreate.ProfileId;
|
||||
//userToCreate.Profile.Name = "Guest - " + nameExtension;
|
||||
//userToCreate.RefferalId = referralId;
|
||||
//userToCreate.Profile.AddressId = Guid.NewGuid();
|
||||
|
||||
//Random rnd = new Random();
|
||||
userToCreate.Profile.Address = new Address();
|
||||
userToCreate.Profile.Address.Id = userToCreate.Profile.AddressId;
|
||||
userToCreate.Profile.Address.AddressText = null;
|
||||
userToCreate.Profile.Address.Latitude = null; //Math.Round(90 + rnd.NextDouble(), 8);
|
||||
userToCreate.Profile.Address.Longitude = null; //Math.Round(180 + rnd.NextDouble(), 8);
|
||||
result = await _userDal.AddUserAsync(userToCreate);
|
||||
guestUser = await _userDal.GetUserModelDtoByIdAsync<UserModelDtoDetail>(userId, false);
|
||||
////Random rnd = new Random();
|
||||
//userToCreate.Profile.Address = new Address();
|
||||
//userToCreate.Profile.Address.Id = userToCreate.Profile.AddressId;
|
||||
//userToCreate.Profile.Address.AddressText = null;
|
||||
//userToCreate.Profile.Address.Latitude = null; //Math.Round(90 + rnd.NextDouble(), 8);
|
||||
//userToCreate.Profile.Address.Longitude = null; //Math.Round(180 + rnd.NextDouble(), 8);
|
||||
//result = await _userDal.AddUserAsync(userToCreate);
|
||||
//guestUser = await _userDal.GetUserModelDtoByIdAsync<UserModelDtoDetail>(userId, false);
|
||||
var createResult = await _loginService.RegistrationAsync(userId, email, password, phoneNumber);
|
||||
if (createResult != AyCode.Core.Consts.AcErrorCode.Unset)
|
||||
{
|
||||
_logger.Error("Error:" + createResult.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,16 +147,16 @@ builder.WebHost.ConfigureKestrel((context, options) =>
|
|||
});
|
||||
});
|
||||
|
||||
builder.Services.AddResponseCompression(options =>
|
||||
{
|
||||
options.EnableForHttps = true;
|
||||
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "application/octet-stream" });
|
||||
options.Providers.Add<BrotliCompressionProvider>();
|
||||
options.Providers.Add<GzipCompressionProvider>();
|
||||
});
|
||||
//builder.Services.AddResponseCompression(options =>
|
||||
//{
|
||||
// options.EnableForHttps = true;
|
||||
// options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "application/octet-stream" });
|
||||
// options.Providers.Add<BrotliCompressionProvider>();
|
||||
// options.Providers.Add<GzipCompressionProvider>();
|
||||
//});
|
||||
|
||||
builder.Services.Configure<BrotliCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);
|
||||
builder.Services.Configure<GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);
|
||||
//builder.Services.Configure<BrotliCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);
|
||||
//builder.Services.Configure<GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);
|
||||
|
||||
//builder.Services.AddSingleton(sp => (sp.GetRequiredService<IHostEnvironment>() as IWebHostEnvironment)!);
|
||||
|
||||
|
|
@ -173,10 +173,10 @@ else
|
|||
app.UseHsts();
|
||||
}
|
||||
|
||||
//if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseResponseCompression();
|
||||
}
|
||||
////if (!app.Environment.IsDevelopment())
|
||||
//{
|
||||
// app.UseResponseCompression();
|
||||
//}
|
||||
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>C:\REPOS\AYCODE\Publish\ServerRelease</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ProjectGuid>9d0f60cb-0462-4bdb-91bd-cadb574ab5a5</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>https</ActiveDebugProfile>
|
||||
<NameOfLastUsedPublishProfile>C:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Server\Properties\PublishProfiles\FolderProfile1.pubxml</NameOfLastUsedPublishProfile>
|
||||
<NameOfLastUsedPublishProfile>C:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Server\Properties\PublishProfiles\ReleaseDeployProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
|
|
|
|||
|
|
@ -3,12 +3,17 @@
|
|||
public class Setting
|
||||
{
|
||||
public static UserBasicDetails UserBasicDetails { get; set; }
|
||||
public const string BaseUrl = "https://localhost:7116";
|
||||
public const string ApiBaseUrl = "https://localhost:7116";
|
||||
//public const string BaseUrl = "https://touriam.mangoweb.hu";
|
||||
//public const string ApiBaseUrl = "https://touriam.mangoweb.hu";
|
||||
//public const string BaseUrl = "https://test.touriam.com";
|
||||
//public const string ApiBaseUrl = "https://test.touriam.com";
|
||||
#if RELEASE
|
||||
public const string BaseUrl = "https://test.touriam.com";
|
||||
public const string ApiBaseUrl = "https://test.touriam.com";
|
||||
//public const string BaseUrl = "https://qa.touriam.com";
|
||||
//public const string ApiBaseUrl = "https://qa.touriam.com";
|
||||
#else
|
||||
public const string BaseUrl = "https://localhost:7116";
|
||||
public const string ApiBaseUrl = "https://localhost:7116";
|
||||
#endif
|
||||
public const bool DarkMode = false;
|
||||
public static string Locale { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using AyCode.Core.Enums;
|
||||
using AyCode.Core.Loggers;
|
||||
using AyCode.Services.Loggers;
|
||||
using TIAM.Core.Consts;
|
||||
using TIAM.Core.Loggers;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Utility;
|
||||
|
|
@ -11,10 +12,10 @@ public class LoggerClient : Logger, ILogger
|
|||
{
|
||||
}
|
||||
|
||||
public LoggerClient(string? categoryName) : base(AppType.Web, LogLevel.Detail, categoryName)
|
||||
public LoggerClient(string? categoryName) : base(AppType.Web, TiamConstClient.DefaultLogLevelClient, categoryName)
|
||||
{ }
|
||||
|
||||
public LoggerClient(string? categoryName, params IAcLogWriterBase[] logWriters) : base(AppType.Web, LogLevel.Detail, categoryName, logWriters)
|
||||
public LoggerClient(string? categoryName, params IAcLogWriterBase[] logWriters) : base(AppType.Web, TiamConstClient.DefaultLogLevelClient, categoryName, logWriters)
|
||||
{ }
|
||||
|
||||
public LoggerClient(AppType appType, LogLevel logLevel, string? categoryName, params IAcLogWriterBase[] logWriters) : base(appType, logLevel, categoryName, logWriters)
|
||||
|
|
@ -23,10 +24,10 @@ public class LoggerClient : Logger, ILogger
|
|||
|
||||
public class LoggerClient<TCategory> : LoggerClient, ILogger<TCategory>
|
||||
{
|
||||
public LoggerClient() : base(AppType.Web, LogLevel.Detail, typeof(TCategory).Name)
|
||||
public LoggerClient() : base(AppType.Web, TiamConstClient.DefaultLogLevelClient, typeof(TCategory).Name)
|
||||
{ }
|
||||
|
||||
public LoggerClient(params IAcLogWriterClientBase[] logWriters) : base(AppType.Web, LogLevel.Detail, typeof(TCategory).Name, logWriters)
|
||||
public LoggerClient(params IAcLogWriterClientBase[] logWriters) : base(AppType.Web, TiamConstClient.DefaultLogLevelClient, typeof(TCategory).Name, logWriters)
|
||||
{ }
|
||||
|
||||
public LoggerClient(AppType appType, LogLevel logLevel, params IAcLogWriterClientBase[] logWriters) : base(appType, logLevel, typeof(TCategory).Name, logWriters)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TIAM.Resources", "TIAMResou
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DD32C7C2-218C-4148-8FD6-1AB3C824A7D5}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
DeployReadme.txt = DeployReadme.txt
|
||||
SqlSchemaCompare_Dev_to_DevRelease.scmp = SqlSchemaCompare_Dev_to_DevRelease.scmp
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
|||
Loading…
Reference in New Issue