Files
admin/Azaion.Common/Database/AzaionDbShemaHolder.cs
T
Oleksandr Bezdieniezhnykh c7b297de83
ci/woodpecker/push/01-test Pipeline failed
ci/woodpecker/push/02-build-push unknown status
refactor: remove deploy.cmd and update Dockerfile for health checks
- Deleted the deploy.cmd script as it was no longer needed.
- Updated Dockerfile to include curl for health checks and added a non-root user for improved security.
- Modified health check command to use curl for better reliability.
- Adjusted docker-compose.test.yml to reflect changes in health check configuration.
- Cleaned up appsettings.json and removed unused configuration properties.
- Removed Resource entity and related requests from the codebase as part of the architectural shift.
- Updated documentation to reflect the removal of hardware binding and related endpoints.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 08:47:21 +03:00

47 lines
1.5 KiB
C#

using Azaion.Common.Entities;
using Azaion.Common.Extensions;
using LinqToDB;
using LinqToDB.Mapping;
using Newtonsoft.Json;
namespace Azaion.Common.Database;
public static class AzaionDbSchemaHolder
{
public static readonly MappingSchema MappingSchema;
static AzaionDbSchemaHolder()
{
MappingSchema = new MappingSchema();
MappingSchema.EntityDescriptorCreatedCallback = (_, entityDescriptor) =>
{
foreach (var entityDescriptorColumn in entityDescriptor.Columns)
entityDescriptorColumn.ColumnName = entityDescriptorColumn.ColumnName.ToSnakeCase();
};
var builder = new FluentMappingBuilder(MappingSchema);
builder.Entity<User>()
.HasTableName("users")
.Property(x => x.Id)
.IsPrimaryKey()
.HasDataType(DataType.Guid)
.Property(x => x.Role)
.HasDataType(DataType.Text)
.HasConversion(v => v.ToString(), v => (RoleEnum)Enum.Parse(typeof(RoleEnum), v))
.Property(x => x.UserConfig)
.HasConversion(
v => v == null ? null : JsonConvert.SerializeObject(v),
p => string.IsNullOrEmpty(p) ? new UserConfig() : JsonConvert.DeserializeObject<UserConfig>(p))
.IsNullable();
builder.Entity<DetectionClass>()
.HasTableName("detection_classes")
.Property(x => x.Id)
.IsPrimaryKey()
.IsIdentity();
builder.Build();
}
}