This commit is contained in:
Sedat Öztürk 2026-05-17 21:20:44 +03:00
parent 6dd3cc4c32
commit 549bb1aa76
30 changed files with 1831 additions and 313 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Sozsoft.Platform.Enums;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
namespace Sozsoft.Platform.ListForms; namespace Sozsoft.Platform.ListForms;
@ -222,6 +223,7 @@ public class ColumnFormatDto : AuditedEntityDto<Guid>
public bool CanExport { get; set; } public bool CanExport { get; set; }
public object DefaultValue { get; set; } public object DefaultValue { get; set; }
public FieldCustomValueTypeEnum DefaultValueType { get; set; }
[JsonIgnore] [JsonIgnore]
public string PivotSettingsJson { get; set; } public string PivotSettingsJson { get; set; }

View file

@ -6,5 +6,6 @@ public interface IListFormSelectAppService
{ {
Task<SelectDto> GetSelectAsync(SelectRequestDto input); Task<SelectDto> GetSelectAsync(SelectRequestDto input);
Task<GridDto> GetGridAsync(string ListFormCode); Task<GridDto> GetGridAsync(string ListFormCode);
Task<string> GetNextSequenceValueAsync(string SequenceName);
} }

View file

@ -314,7 +314,8 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
{ {
if (columnFormatsDict.TryGetValue(field.Key, out var columnFormat)) if (columnFormatsDict.TryGetValue(field.Key, out var columnFormat))
{ {
columnFormat.DefaultValue = field.Value; columnFormat.DefaultValue = field.Value.CustomValue;
columnFormat.DefaultValueType = field.Value.CustomValueType;
} }
} }
@ -397,6 +398,13 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
return new List<LookupDataDto>(); return new List<LookupDataDto>();
} }
public async Task<string> GetNextSequenceValueAsync(string SequenceName)
{
var sequenceManager = LazyServiceProvider.LazyGetRequiredService<SequenceManager>();
return await sequenceManager.GetNextSequenceAsync(SequenceName);
}
private static string WrapLookupQueryWithInFilter( private static string WrapLookupQueryWithInFilter(
string lookupQuery, string lookupQuery,
string listFormSelectCommand, string listFormSelectCommand,

View file

@ -948,6 +948,12 @@
"en": "No record found...", "en": "No record found...",
"tr": "Kayıt Bulunamadı..." "tr": "Kayıt Bulunamadı..."
}, },
{
"resourceName": "Platform",
"key": "App.Definitions.Sequence",
"en": "Sequences",
"tr": "Diziler"
},
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "App.Definitions.OrgChart", "key": "App.Definitions.OrgChart",
@ -1830,7 +1836,6 @@
"en": "Background Workers", "en": "Background Workers",
"tr": "Arkaplan İşleri" "tr": "Arkaplan İşleri"
}, },
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "App.BackgroundWorkers.RecurringJobs", "key": "App.BackgroundWorkers.RecurringJobs",
@ -1843,7 +1848,6 @@
"en": "Jobs", "en": "Jobs",
"tr": "İşler" "tr": "İşler"
}, },
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "App.Notifications", "key": "App.Notifications",
@ -14620,6 +14624,60 @@
"en": "Is Active", "en": "Is Active",
"tr": "Aktif" "tr": "Aktif"
}, },
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.Prefix",
"en": "Prefix",
"tr": "Önek"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.Suffix",
"en": "Suffix",
"tr": "Sonek"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.PaddingSize",
"en": "Sequence Size",
"tr": "Sıra Boyutu"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.IncrementStep",
"en": "Increment Step",
"tr": "Artış Adımı"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.NextNumber",
"en": "Next Number",
"tr": "Sonraki Numara"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.StartNumber",
"en": "Start Number",
"tr": "Başlangıç Numarası"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.ResetPeriod",
"en": "Reset Period",
"tr": "Sıfırlama Dönemi"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.LastPeriodKey",
"en": "Last Period Key",
"tr": "Son Dönem Anahtarı"
},
{
"resourceName": "Platform",
"key": "App.Listform.ListformField.FormatTemplate",
"en": "Format Template",
"tr": "Format Şablonu"
},
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "App.Listform.ListformField.MaxConcurrentUsers", "key": "App.Listform.ListformField.MaxConcurrentUsers",
@ -18605,4 +18663,4 @@
"tr": "Başarıyla Kaydedildi" "tr": "Başarıyla Kaydedildi"
} }
] ]
} }

View file

@ -1740,7 +1740,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
{ {
ListFormCode = listForm.ListFormCode, ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En, CultureName = LanguageCodes.En,
SourceDbType = DbType.String, SourceDbType = DbType.Guid,
FieldName = "Id", FieldName = "Id",
CaptionName = "App.Listform.ListformField.Id", CaptionName = "App.Listform.ListformField.Id",
Width = 0, Width = 0,
@ -2527,7 +2527,7 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
PagerOptionJson = DefaultPagerOptionJson, PagerOptionJson = DefaultPagerOptionJson,
TreeOptionJson = DefaultTreeOptionJson("Id", "ParentId", true), TreeOptionJson = DefaultTreeOptionJson("Id", "ParentId", true),
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson(), InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson(),
EditingOptionJson = DefaultEditingOptionJson(listFormName, 400, 650, true, true, true, true, false), EditingOptionJson = DefaultEditingOptionJson(listFormName, 400, 350, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto> EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>
{ {
new() { new() {

View file

@ -17,7 +17,7 @@ public static class ListFormSeeder_DefaultJsons
public static string DefaultInsertFieldsDefaultValueJson(DbType dbType = DbType.Guid, string newId = "@NEWID") => JsonSerializer.Serialize(new FieldsDefaultValue[] public static string DefaultInsertFieldsDefaultValueJson(DbType dbType = DbType.Guid, string newId = "@NEWID") => JsonSerializer.Serialize(new FieldsDefaultValue[]
{ {
new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, new() { FieldName = "CreationTime", FieldDbType = DbType.DateTimeOffset, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new() { FieldName = "Id", FieldDbType = dbType, Value = newId, CustomValueType = FieldCustomValueTypeEnum.CustomKey } new() { FieldName = "Id", FieldDbType = dbType, Value = newId, CustomValueType = FieldCustomValueTypeEnum.CustomKey }
}); });

View file

@ -2466,6 +2466,305 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
} }
#endregion #endregion
#region Sequence
listFormName = AppCodes.Definitions.Sequence;
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
{
var listForm = await _listFormRepository.InsertAsync(
new ListForm()
{
ListFormType = ListFormTypeEnum.List,
PageSize = 10,
ExportJson = DefaultExportJson,
IsSubForm = false,
ShowNote = true,
LayoutJson = DefaultLayoutJson(),
CultureName = LanguageCodes.En,
ListFormCode = listFormName,
Name = listFormName,
Title = listFormName,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = false,
IsBranch = false,
IsOrganizationUnit = false,
Description = listFormName,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Sequence)),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = DefaultFilterJson,
SortMode = GridOptions.SortModeSingle,
FilterRowJson = DefaultFilterRowJson,
HeaderFilterJson = DefaultHeaderFilterJson,
SearchPanelJson = JsonSerializer.Serialize(new { Visible = false }),
GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }),
SelectionJson = DefaultSelectionSingleJson,
ColumnOptionJson = DefaultColumnOptionJson(),
PermissionJson = DefaultPermissionJson(listFormName),
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Sequence)),
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson(),
PagerOptionJson = DefaultPagerOptionJson,
EditingOptionJson = DefaultEditingOptionJson(listFormName, 700, 500, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>
{
new() {
Order = 1, ColCount = 2, ColSpan = 1, ItemType = "group", Items =
[
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 2, DataField = "IsActive", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 3, DataField = "Prefix", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "Suffix", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "PaddingSize", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 6, DataField = "IncrementStep", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 7, DataField = "ResetPeriod", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions = EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order = 8, DataField = "StartNumber", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 9, DataField = "FormatTemplate", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
]
}
}),
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson(),
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "PaddingSize", FieldDbType = DbType.Int16, Value = "5", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "IncrementStep", FieldDbType = DbType.Int16, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "StartNumber", FieldDbType = DbType.Int16, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "FormatTemplate", FieldDbType = DbType.String, Value = "{Prefix}{Number}{Suffix}", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "ResetPeriod", FieldDbType = DbType.Int16, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
}),
});
#region Sequence Fields
await _listFormFieldRepository.InsertManyAsync([
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "Id",
CaptionName = "App.Listform.ListformField.Id",
Width = 0,
ListOrderNo = 1,
Visible = false,
IsActive = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Name",
CaptionName = "App.Listform.ListformField.Name",
Width = 0,
ListOrderNo = 2,
Visible = true,
IsActive = true,
SortIndex = 1,
SortDirection = GridColumnOptions.SortOrderAsc,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Prefix",
CaptionName = "App.Listform.ListformField.Prefix",
Width = 0,
ListOrderNo = 3,
Visible = true,
IsActive = true,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Suffix",
CaptionName = "App.Listform.ListformField.Suffix",
Width = 0,
ListOrderNo = 4,
Visible = true,
IsActive = true,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Boolean,
FieldName = "IsActive",
CaptionName = "App.Listform.ListformField.IsActive",
Width = 0,
ListOrderNo = 5,
Visible = true,
IsActive = true,
Alignment = "center",
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Int32,
FieldName = "PaddingSize",
CaptionName = "App.Listform.ListformField.PaddingSize",
Width = 0,
ListOrderNo = 6,
Visible = true,
IsActive = true,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Int32,
FieldName = "IncrementStep",
CaptionName = "App.Listform.ListformField.IncrementStep",
Width = 0,
ListOrderNo = 7,
Visible = true,
IsActive = true,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Int32,
FieldName = "NextNumber",
CaptionName = "App.Listform.ListformField.NextNumber",
Width = 0,
ListOrderNo = 8,
Visible = true,
IsActive = true,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Int32,
FieldName = "ResetPeriod",
CaptionName = "App.Listform.ListformField.ResetPeriod",
Width = 0,
ListOrderNo = 9,
Visible = true,
IsActive = true,
LookupJson = JsonSerializer.Serialize(new LookupDto
{
DataSourceType = UiLookupDataSourceTypeEnum.StaticData,
DisplayExpr = "name",
ValueExpr = "key",
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
new() { Key=0, Name="None" },
new() { Key=1, Name="Yearly"},
new() { Key=2, Name="Monthly"},
new() { Key=3, Name="Daily"},
new() { Key=4, Name="Hourly"},
new() { Key=5, Name="Minutely"},
}),
}),
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Int32,
FieldName = "StartNumber",
CaptionName = "App.Listform.ListformField.StartNumber",
Width = 0,
ListOrderNo = 10,
Visible = true,
IsActive = true,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "LastPeriodKey",
CaptionName = "App.Listform.ListformField.LastPeriodKey",
Width = 0,
ListOrderNo = 11,
Visible = true,
IsActive = true,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new()
{
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "FormatTemplate",
CaptionName = "App.Listform.ListformField.FormatTemplate",
Width = 0,
ListOrderNo = 12,
Visible = true,
IsActive = true,
PlaceHolder="{Prefix}-{yyyy}{MM}{dd}-{Number}-{Suffix}",
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
]);
#endregion
}
#endregion
#region SkillType #region SkillType
listFormName = AppCodes.Definitions.SkillType; listFormName = AppCodes.Definitions.SkillType;
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))

View file

@ -578,6 +578,16 @@
"RequiredPermissionName": "App.Definitions.UomCategory", "RequiredPermissionName": "App.Definitions.UomCategory",
"IsDisabled": false "IsDisabled": false
}, },
{
"ParentCode": "App.Saas.Definitions",
"Code": "App.Definitions.Sequence",
"DisplayName": "App.Definitions.Sequence",
"Order": 11,
"Url": "/admin/list/App.Definitions.Sequence",
"Icon": "FcNumericalSorting12",
"RequiredPermissionName": "App.Definitions.Sequence",
"IsDisabled": false
},
{ {
"ParentCode": "App.Saas", "ParentCode": "App.Saas",
"Code": "App.SettingDefinitions", "Code": "App.SettingDefinitions",

View file

@ -865,6 +865,60 @@
"MultiTenancySide": 2, "MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs" "MenuGroup": "Erp|Kurs"
}, },
{
"GroupName": "App.Saas",
"Name": "App.Definitions.Sequence",
"ParentName": null,
"DisplayName": "App.Definitions.Sequence",
"IsEnabled": true,
"MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs"
},
{
"GroupName": "App.Saas",
"Name": "App.Definitions.Sequence.Create",
"ParentName": "App.Definitions.Sequence",
"DisplayName": "Create",
"IsEnabled": true,
"MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs"
},
{
"GroupName": "App.Saas",
"Name": "App.Definitions.Sequence.Update",
"ParentName": "App.Definitions.Sequence",
"DisplayName": "Update",
"IsEnabled": true,
"MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs"
},
{
"GroupName": "App.Saas",
"Name": "App.Definitions.Sequence.Delete",
"ParentName": "App.Definitions.Sequence",
"DisplayName": "Delete",
"IsEnabled": true,
"MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs"
},
{
"GroupName": "App.Saas",
"Name": "App.Definitions.Sequence.Export",
"ParentName": "App.Definitions.Sequence",
"DisplayName": "Export",
"IsEnabled": true,
"MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs"
},
{
"GroupName": "App.Saas",
"Name": "App.Definitions.Sequence.Import",
"ParentName": "App.Definitions.Sequence",
"DisplayName": "Import",
"IsEnabled": true,
"MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs"
},
{ {
"GroupName": "App.Saas", "GroupName": "App.Saas",
"Name": "App.SettingDefinitions", "Name": "App.SettingDefinitions",
@ -1198,7 +1252,6 @@
"MultiTenancySide": 2, "MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs" "MenuGroup": "Erp|Kurs"
}, },
{ {
"GroupName": "App.Saas", "GroupName": "App.Saas",
"Name": "App.Notifications.NotificationTypes", "Name": "App.Notifications.NotificationTypes",
@ -1253,7 +1306,6 @@
"MultiTenancySide": 2, "MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs" "MenuGroup": "Erp|Kurs"
}, },
{ {
"GroupName": "App.Saas", "GroupName": "App.Saas",
"Name": "App.Notifications.NotificationRules", "Name": "App.Notifications.NotificationRules",
@ -1416,7 +1468,6 @@
"MultiTenancySide": 2, "MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs" "MenuGroup": "Erp|Kurs"
}, },
{ {
"GroupName": "App.Saas", "GroupName": "App.Saas",
"Name": "App.BackgroundWorkers.Jobs", "Name": "App.BackgroundWorkers.Jobs",
@ -1471,7 +1522,6 @@
"MultiTenancySide": 2, "MultiTenancySide": 2,
"MenuGroup": "Erp|Kurs" "MenuGroup": "Erp|Kurs"
}, },
{ {
"GroupName": "App.Saas", "GroupName": "App.Saas",
"Name": "App.Home", "Name": "App.Home",
@ -3650,7 +3700,6 @@
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp|Kurs" "MenuGroup": "Erp|Kurs"
}, },
{ {
"GroupName": "App.Administration", "GroupName": "App.Administration",
"Name": "App.Intranet.Events.EventLike", "Name": "App.Intranet.Events.EventLike",
@ -3714,7 +3763,6 @@
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp|Kurs" "MenuGroup": "Erp|Kurs"
}, },
{ {
"GroupName": "App.Administration", "GroupName": "App.Administration",
"Name": "App.Intranet.Announcement", "Name": "App.Intranet.Announcement",
@ -4057,7 +4105,6 @@
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp" "MenuGroup": "Erp"
}, },
{ {
"GroupName": "App.Administration", "GroupName": "App.Administration",
"Name": "App.Intranet.SurveyQuestionOption", "Name": "App.Intranet.SurveyQuestionOption",
@ -4121,7 +4168,6 @@
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp" "MenuGroup": "Erp"
}, },
{ {
"GroupName": "App.Administration", "GroupName": "App.Administration",
"Name": "App.Intranet.SurveyResponse", "Name": "App.Intranet.SurveyResponse",
@ -4185,7 +4231,6 @@
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp" "MenuGroup": "Erp"
}, },
{ {
"GroupName": "App.Administration", "GroupName": "App.Administration",
"Name": "App.Intranet.SurveyAnswer", "Name": "App.Intranet.SurveyAnswer",
@ -4249,7 +4294,6 @@
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp" "MenuGroup": "Erp"
}, },
{ {
"GroupName": "App.Administration", "GroupName": "App.Administration",
"Name": "App.Videoroom", "Name": "App.Videoroom",
@ -4287,4 +4331,4 @@
"MenuGroup": "Kurs" "MenuGroup": "Kurs"
} }
] ]
} }

View file

@ -0,0 +1,8 @@
namespace Sozsoft.Platform.Enums;
public class DefaultValueDict
{
public object CustomValue { get; set; }
public FieldCustomValueTypeEnum CustomValueType { get; set; }
}

View file

@ -12,5 +12,6 @@ public enum FieldCustomValueTypeEnum
/// </summary> /// </summary>
DbQuery = 3, DbQuery = 3,
QueryParams = 4, QueryParams = 4,
Sequence = 5
} }

View file

@ -0,0 +1,11 @@
namespace Sozsoft.Platform.Enums;
public enum SequenceResetPeriod
{
None = 0,
Yearly = 1,
Monthly = 2,
Daily = 3,
Hourly = 4,
Minutely = 5
}

View file

@ -87,5 +87,6 @@ public enum TableNameEnum
Videoroom, Videoroom,
VideoroomParticipant, VideoroomParticipant,
VideoroomAttandance, VideoroomAttandance,
VideoroomChat VideoroomChat,
Sequence,
} }

View file

@ -82,6 +82,7 @@ public static class TableNameResolver
{ nameof(TableNameEnum.VideoroomParticipant), (TablePrefix.TenantByName, MenuPrefix.Administration) }, { nameof(TableNameEnum.VideoroomParticipant), (TablePrefix.TenantByName, MenuPrefix.Administration) },
{ nameof(TableNameEnum.VideoroomAttandance), (TablePrefix.TenantByName, MenuPrefix.Administration) }, { nameof(TableNameEnum.VideoroomAttandance), (TablePrefix.TenantByName, MenuPrefix.Administration) },
{ nameof(TableNameEnum.VideoroomChat), (TablePrefix.TenantByName, MenuPrefix.Administration) }, { nameof(TableNameEnum.VideoroomChat), (TablePrefix.TenantByName, MenuPrefix.Administration) },
{ nameof(TableNameEnum.Sequence), (TablePrefix.TenantByName, MenuPrefix.Administration) },
// 🔹 INTRANET TABLOLARI // 🔹 INTRANET TABLOLARI
{ nameof(TableNameEnum.Announcement), (TablePrefix.TenantByName, MenuPrefix.Administration) }, { nameof(TableNameEnum.Announcement), (TablePrefix.TenantByName, MenuPrefix.Administration) },

View file

@ -349,6 +349,7 @@ public static class SeedConsts
public const string Default = Prefix.App + ".Definitions"; public const string Default = Prefix.App + ".Definitions";
public const string AiBot = Default + ".AiBot"; public const string AiBot = Default + ".AiBot";
public const string Sequence = Default + ".Sequence";
public const string GlobalSearch = Default + ".GlobalSearch"; public const string GlobalSearch = Default + ".GlobalSearch";
public const string ContactTitle = Default + ".ContactTitle"; public const string ContactTitle = Default + ".ContactTitle";
public const string Currency = Default + ".Currency"; public const string Currency = Default + ".Currency";

View file

@ -0,0 +1,132 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
using Sozsoft.Platform.Enums;
public class Sequence : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public string Name { get; set; } = null!;
public bool IsActive { get; set; } = true;
public string? Prefix { get; set; }
public string? Suffix { get; set; }
public int PaddingSize { get; set; } = 5;
public int IncrementStep { get; set; } = 1;
public long StartNumber { get; set; } = 1;
public long NextNumber { get; set; } = 1;
public SequenceResetPeriod ResetPeriod { get; set; } = SequenceResetPeriod.None;
public string? LastPeriodKey { get; set; }
public string FormatTemplate { get; set; } = "{Prefix}{Number}{Suffix}";
public string GetNextSequence()
{
return GetNextSequence(DateTime.Now);
}
public string GetNextSequence(DateTime dateTime)
{
ResetIfPeriodChanged(dateTime);
var sequenceValue = FormatSequence(NextNumber, dateTime);
NextNumber += IncrementStep;
return sequenceValue;
}
public string GetPreviewSequence()
{
return GetPreviewSequence(DateTime.Now);
}
public string GetPreviewSequence(DateTime dateTime)
{
var previewNumber = NextNumber;
if (ShouldReset(dateTime))
{
previewNumber = StartNumber;
}
return FormatSequence(previewNumber, dateTime);
}
private void ResetIfPeriodChanged(DateTime dateTime)
{
if (!ShouldReset(dateTime))
{
return;
}
NextNumber = StartNumber;
LastPeriodKey = GetPeriodKey(dateTime);
}
private bool ShouldReset(DateTime dateTime)
{
if (ResetPeriod == SequenceResetPeriod.None)
{
return false;
}
var currentPeriodKey = GetPeriodKey(dateTime);
return LastPeriodKey != currentPeriodKey;
}
private string FormatSequence(long number, DateTime dateTime)
{
var template = string.IsNullOrWhiteSpace(FormatTemplate)
? "{Prefix}{Number}{Suffix}"
: FormatTemplate;
var numberText = number.ToString().PadLeft(PaddingSize, '0');
return template
.Replace("{Prefix}", Prefix ?? string.Empty)
.Replace("{Suffix}", Suffix ?? string.Empty)
.Replace("{Number}", numberText)
.Replace("{yyyy}", dateTime.ToString("yyyy"))
.Replace("{yy}", dateTime.ToString("yy"))
.Replace("{MM}", dateTime.ToString("MM"))
.Replace("{M}", dateTime.ToString("%M"))
.Replace("{dd}", dateTime.ToString("dd"))
.Replace("{d}", dateTime.ToString("%d"))
.Replace("{HH}", dateTime.ToString("HH"))
.Replace("{H}", dateTime.ToString("%H"))
.Replace("{mm}", dateTime.ToString("mm"))
.Replace("{m}", dateTime.ToString("%m"))
.Replace("{ss}", dateTime.ToString("ss"))
.Replace("{s}", dateTime.ToString("%s"));
}
private string? GetPeriodKey(DateTime dateTime)
{
return ResetPeriod switch
{
SequenceResetPeriod.Yearly => dateTime.ToString("yyyy"),
SequenceResetPeriod.Monthly => dateTime.ToString("yyyyMM"),
SequenceResetPeriod.Daily => dateTime.ToString("yyyyMMdd"),
SequenceResetPeriod.Hourly => dateTime.ToString("yyyyMMddHH"),
SequenceResetPeriod.Minutely => dateTime.ToString("yyyyMMddHHmm"),
_ => null
};
}
}

View file

@ -151,7 +151,7 @@ public class ListFormManager : PlatformDomainService, IListFormManager
foreach (var item in defaultFields) foreach (var item in defaultFields)
{ {
fields[item.Key] = item.Value; fields[item.Key] = item.Value.CustomValue;
} }
return fields; return fields;

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -18,7 +19,7 @@ namespace Sozsoft.Platform.Queries;
public interface IDefaultValueManager public interface IDefaultValueManager
{ {
Task<Dictionary<string, object>> GenerateDefaultValuesAsync( Task<Dictionary<string, DefaultValueDict>> GenerateDefaultValuesAsync(
ListForm listForm, ListForm listForm,
List<ListFormField> listFormFields, List<ListFormField> listFormFields,
OperationEnum op, OperationEnum op,
@ -39,7 +40,7 @@ public class DefaultValueManager : PlatformDomainService, IDefaultValueManager
{ {
} }
public async Task<Dictionary<string, object>> GenerateDefaultValuesAsync( public async Task<Dictionary<string, DefaultValueDict>> GenerateDefaultValuesAsync(
ListForm listForm, ListForm listForm,
List<ListFormField> listFormFields, List<ListFormField> listFormFields,
OperationEnum op, OperationEnum op,
@ -47,7 +48,7 @@ public class DefaultValueManager : PlatformDomainService, IDefaultValueManager
Dictionary<string, StringValues> queryParameters = null, Dictionary<string, StringValues> queryParameters = null,
dynamic inputParams = null) dynamic inputParams = null)
{ {
var fields = new Dictionary<string, object>(); var fields = new Dictionary<string, DefaultValueDict>();
var defaultFieldsJson = op switch var defaultFieldsJson = op switch
{ {
@ -132,6 +133,21 @@ public class DefaultValueManager : PlatformDomainService, IDefaultValueManager
value = await dynamicDataRepository.ExecuteScalarAsync<object>(defaultField.SqlQuery, connectionString); value = await dynamicDataRepository.ExecuteScalarAsync<object>(defaultField.SqlQuery, connectionString);
} }
break; break;
case FieldCustomValueTypeEnum.Sequence:
if (!string.IsNullOrWhiteSpace(defaultField.Value))
{
if (op == OperationEnum.Select)
{
// Select operasyonunda sequence adını dön; frontend API çağrısıyla çözecek
value = defaultField.Value;
}
else
{
var sequenceManager = LazyServiceProvider.LazyGetRequiredService<SequenceManager>();
value = await sequenceManager.GetNextSequenceAsync(defaultField.Value);
}
}
break;
case FieldCustomValueTypeEnum.Value: case FieldCustomValueTypeEnum.Value:
default: default:
value = defaultField.Value; value = defaultField.Value;
@ -142,11 +158,11 @@ public class DefaultValueManager : PlatformDomainService, IDefaultValueManager
var formattedValue = QueryHelper.GetFormattedValue(defaultField.FieldDbType, value); var formattedValue = QueryHelper.GetFormattedValue(defaultField.FieldDbType, value);
if (fields.ContainsKey(defaultField.FieldName)) if (fields.ContainsKey(defaultField.FieldName))
{ {
fields[defaultField.FieldName] = formattedValue; fields[defaultField.FieldName] = new DefaultValueDict { CustomValue = formattedValue, CustomValueType = defaultField.CustomValueType };
} }
else else
{ {
fields.Add(defaultField.FieldName, formattedValue); fields.Add(defaultField.FieldName, new DefaultValueDict { CustomValue = formattedValue, CustomValueType = defaultField.CustomValueType });
} }
} }
} }

View file

@ -0,0 +1,59 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using Sozsoft.Platform;
using Sozsoft.Platform.Localization;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Settings;
using Volo.Abp.Users;
public class SequenceManager : PlatformDomainService
{
private readonly IRepository<Sequence, Guid> _sequenceRepository;
public SequenceManager(
ISettingProvider settingProvider,
IStringLocalizer<PlatformResource> localizer,
ICurrentUser currentUser,
IObjectMapper objectMapper,
IRepository<Sequence, Guid> sequenceRepository)
: base(settingProvider, localizer, currentUser, objectMapper)
{
_sequenceRepository = sequenceRepository;
}
public async Task<string> GetNextSequenceAsync(string name)
{
var sequence = await _sequenceRepository.FirstOrDefaultAsync(x =>
x.Name == name &&
x.IsActive
);
if (sequence == null)
{
throw new Exception($"Sequence bulunamadı: {name}");
}
var nextSequence = sequence.GetNextSequence(DateTime.Now);
await _sequenceRepository.UpdateAsync(sequence, autoSave: true);
return nextSequence;
}
public async Task<string> GetPreviewSequenceAsync(string name)
{
var sequence = await _sequenceRepository.FirstOrDefaultAsync(x =>
x.Name == name &&
x.IsActive
);
if (sequence == null)
{
throw new Exception($"Sequence bulunamadı: {name}");
}
return sequence.GetPreviewSequence(DateTime.Now);
}
}

View file

@ -73,6 +73,7 @@ public class PlatformDbContext :
public DbSet<Country> Countries { get; set; } public DbSet<Country> Countries { get; set; }
public DbSet<City> Cities { get; set; } public DbSet<City> Cities { get; set; }
public DbSet<District> Districts { get; set; } public DbSet<District> Districts { get; set; }
public DbSet<Sequence> Sequences { get; set; }
#endregion #endregion
#region Administrator #region Administrator
@ -184,6 +185,8 @@ public class PlatformDbContext :
b.Property(a => a.Name).IsRequired().HasMaxLength(128); b.Property(a => a.Name).IsRequired().HasMaxLength(128);
b.Property(a => a.Description).HasMaxLength(256); b.Property(a => a.Description).HasMaxLength(256);
b.Property(a => a.ApiUrl).HasMaxLength(256); b.Property(a => a.ApiUrl).HasMaxLength(256);
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter(null);
}); });
builder.Entity<Branch>(b => builder.Entity<Branch>(b =>
@ -208,6 +211,8 @@ public class PlatformDbContext :
b.Property(a => a.Email).HasMaxLength(128); b.Property(a => a.Email).HasMaxLength(128);
b.Property(a => a.Website).HasMaxLength(128); b.Property(a => a.Website).HasMaxLength(128);
b.Property(a => a.IsActive).HasDefaultValue(true); b.Property(a => a.IsActive).HasDefaultValue(true);
b.HasIndex(x => new { x.Code }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<BranchUsers>(b => builder.Entity<BranchUsers>(b =>
@ -215,11 +220,11 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.BranchUsers)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.BranchUsers)), Prefix.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasKey(x => new { x.UserId, x.BranchId });
b.Property(a => a.UserId).IsRequired(); b.Property(a => a.UserId).IsRequired();
b.Property(a => a.BranchId).IsRequired(); b.Property(a => a.BranchId).IsRequired();
b.Property(a => a.TenantId);
b.HasIndex(x => new { x.TenantId, x.BranchId, x.UserId }).IsUnique().HasFilter(null);
b.HasOne(x => x.Branch) b.HasOne(x => x.Branch)
.WithMany(x => x.UserBranches) .WithMany(x => x.UserBranches)
.HasForeignKey(x => x.BranchId) .HasForeignKey(x => x.BranchId)
@ -258,6 +263,9 @@ public class PlatformDbContext :
c => c.ToArray() c => c.ToArray()
) )
); );
b.HasIndex(x => new { x.Key }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasIndex(x => new { x.Path }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<MenuGroup>(b => builder.Entity<MenuGroup>(b =>
@ -266,6 +274,8 @@ public class PlatformDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(a => a.Name).IsRequired().HasMaxLength(128); b.Property(a => a.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter(null);
}); });
builder.Entity<Menu>(b => builder.Entity<Menu>(b =>
@ -285,6 +295,8 @@ public class PlatformDbContext :
b.Property(a => a.UserId).HasMaxLength(256); b.Property(a => a.UserId).HasMaxLength(256);
b.Property(a => a.RoleId).HasMaxLength(256); b.Property(a => a.RoleId).HasMaxLength(256);
b.Property(a => a.CultureName).HasMaxLength(64); b.Property(a => a.CultureName).HasMaxLength(64);
b.HasIndex(x => new { x.Code }).IsUnique().HasFilter(null);
}); });
builder.Entity<DataSource>(b => builder.Entity<DataSource>(b =>
@ -295,6 +307,8 @@ public class PlatformDbContext :
b.Property(a => a.Code).IsRequired().HasMaxLength(128); b.Property(a => a.Code).IsRequired().HasMaxLength(128);
b.Property(a => a.ConnectionString).HasMaxLength(256); b.Property(a => a.ConnectionString).HasMaxLength(256);
b.Property(a => a.DataSourceType).IsRequired(); b.Property(a => a.DataSourceType).IsRequired();
b.HasIndex(x => new { x.Code }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<ListForm>(b => builder.Entity<ListForm>(b =>
@ -302,9 +316,6 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.ListForm)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.ListForm)), Prefix.DbSchema);
b.ConfigureByConvention(); // base class props b.ConfigureByConvention(); // base class props
// Anahtar
b.HasKey(x => x.Id);
// Özellikler // Özellikler
b.Property(a => a.ListFormCode).IsRequired().HasMaxLength(64); b.Property(a => a.ListFormCode).IsRequired().HasMaxLength(64);
b.Property(a => a.CultureName).HasMaxLength(10).IsRequired(); b.Property(a => a.CultureName).HasMaxLength(10).IsRequired();
@ -377,6 +388,8 @@ public class PlatformDbContext :
b.Property(a => a.ValueAxisJson).HasColumnType("text"); b.Property(a => a.ValueAxisJson).HasColumnType("text");
b.Property(a => a.ZoomAndPanJson).HasColumnType("text"); b.Property(a => a.ZoomAndPanJson).HasColumnType("text");
b.HasIndex(x => new { x.ListFormCode }).IsUnique().HasFilter(null);
b.HasMany<ListFormField>().WithOne().HasForeignKey(x => x.ListFormCode).HasPrincipalKey(x => x.ListFormCode).IsRequired(); b.HasMany<ListFormField>().WithOne().HasForeignKey(x => x.ListFormCode).HasPrincipalKey(x => x.ListFormCode).IsRequired();
b.HasMany<ListFormCustomization>().WithOne().HasForeignKey(x => x.ListFormCode).HasPrincipalKey(x => x.ListFormCode).IsRequired(); b.HasMany<ListFormCustomization>().WithOne().HasForeignKey(x => x.ListFormCode).HasPrincipalKey(x => x.ListFormCode).IsRequired();
b.HasMany<ListFormImport>().WithOne().HasForeignKey(x => x.ListFormCode).HasPrincipalKey(x => x.ListFormCode).IsRequired(); b.HasMany<ListFormImport>().WithOne().HasForeignKey(x => x.ListFormCode).HasPrincipalKey(x => x.ListFormCode).IsRequired();
@ -387,9 +400,6 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.ListFormField)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.ListFormField)), Prefix.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
// Anahtar
b.HasKey(x => x.Id);
// Zorunlu alanlar // Zorunlu alanlar
b.Property(a => a.ListFormCode).IsRequired().HasMaxLength(64); b.Property(a => a.ListFormCode).IsRequired().HasMaxLength(64);
b.Property(a => a.UserId).HasMaxLength(256); b.Property(a => a.UserId).HasMaxLength(256);
@ -430,6 +440,8 @@ public class PlatformDbContext :
b.Property(a => a.Alignment).HasMaxLength(20).HasDefaultValue("left"); b.Property(a => a.Alignment).HasMaxLength(20).HasDefaultValue("left");
b.Property(a => a.Format).HasMaxLength(128); b.Property(a => a.Format).HasMaxLength(128);
b.Property(a => a.EditorOptions).HasColumnType("text"); b.Property(a => a.EditorOptions).HasColumnType("text");
b.HasIndex(x => new { x.ListFormCode, x.UserId, x.RoleId, x.CultureName, x.FieldName }).IsUnique().HasFilter(null);
}); });
builder.Entity<ListFormCustomization>(b => builder.Entity<ListFormCustomization>(b =>
@ -493,6 +505,8 @@ public class PlatformDbContext :
b.Property(a => a.BeforeSp).HasMaxLength(128); b.Property(a => a.BeforeSp).HasMaxLength(128);
b.Property(a => a.AfterSp).HasMaxLength(128); b.Property(a => a.AfterSp).HasMaxLength(128);
b.Property(a => a.Options).HasColumnType("text"); b.Property(a => a.Options).HasColumnType("text");
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<ForumCategory>(b => builder.Entity<ForumCategory>(b =>
@ -506,7 +520,7 @@ public class PlatformDbContext :
b.Property(x => x.Icon).HasMaxLength(64); b.Property(x => x.Icon).HasMaxLength(64);
b.Property(x => x.LastPostUserName).HasMaxLength(256); b.Property(x => x.LastPostUserName).HasMaxLength(256);
b.HasIndex(x => x.DisplayOrder); b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasMany(x => x.Topics) b.HasMany(x => x.Topics)
.WithOne(x => x.Category) .WithOne(x => x.Category)
@ -524,10 +538,6 @@ public class PlatformDbContext :
b.Property(x => x.AuthorName).HasMaxLength(128); b.Property(x => x.AuthorName).HasMaxLength(128);
b.Property(x => x.LastPostUserName).HasMaxLength(128); b.Property(x => x.LastPostUserName).HasMaxLength(128);
b.HasIndex(x => x.CategoryId);
b.HasIndex(x => x.IsPinned);
b.HasIndex(x => x.LastPostDate);
b.HasMany(x => x.Posts) b.HasMany(x => x.Posts)
.WithOne(x => x.Topic) .WithOne(x => x.Topic)
.HasForeignKey(x => x.TopicId) .HasForeignKey(x => x.TopicId)
@ -542,8 +552,6 @@ public class PlatformDbContext :
b.Property(x => x.Content).IsRequired(); b.Property(x => x.Content).IsRequired();
b.Property(x => x.AuthorName).HasMaxLength(128); b.Property(x => x.AuthorName).HasMaxLength(128);
b.HasIndex(x => x.TopicId);
b.HasOne(x => x.Topic) b.HasOne(x => x.Topic)
.WithMany(x => x.Posts) .WithMany(x => x.Posts)
.HasForeignKey(x => x.TopicId) .HasForeignKey(x => x.TopicId)
@ -560,12 +568,13 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.CrudEndpoint)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.CrudEndpoint)), Prefix.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasKey(x => x.Id);
b.Property(x => x.EntityName).IsRequired().HasMaxLength(128); b.Property(x => x.EntityName).IsRequired().HasMaxLength(128);
b.Property(x => x.Method).IsRequired().HasMaxLength(10); b.Property(x => x.Method).IsRequired().HasMaxLength(10);
b.Property(x => x.Path).IsRequired().HasMaxLength(256); b.Property(x => x.Path).IsRequired().HasMaxLength(256);
b.Property(x => x.OperationType).IsRequired().HasMaxLength(64); b.Property(x => x.OperationType).IsRequired().HasMaxLength(64);
b.Property(x => x.CsharpCode).IsRequired(); b.Property(x => x.CsharpCode).IsRequired();
b.HasIndex(x => new { x.TenantId, x.EntityName, x.Method, x.Path }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<CustomEndpoint>(b => builder.Entity<CustomEndpoint>(b =>
@ -581,6 +590,8 @@ public class PlatformDbContext :
b.Property(a => a.Sql).IsRequired(); b.Property(a => a.Sql).IsRequired();
b.Property(a => a.ParametersJson).HasColumnType("text"); b.Property(a => a.ParametersJson).HasColumnType("text");
b.Property(a => a.PermissionsJson).HasColumnType("text"); b.Property(a => a.PermissionsJson).HasColumnType("text");
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<CustomComponent>(b => builder.Entity<CustomComponent>(b =>
@ -588,12 +599,13 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomComponent)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomComponent)), Prefix.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasKey(x => x.Id);
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.Property(x => x.Code).IsRequired(); b.Property(x => x.Code).IsRequired();
b.Property(x => x.Props).HasMaxLength(1024); b.Property(x => x.Props).HasMaxLength(1024);
b.Property(x => x.Description).HasMaxLength(512); b.Property(x => x.Description).HasMaxLength(512);
b.Property(x => x.Dependencies).HasMaxLength(2048); b.Property(x => x.Dependencies).HasMaxLength(2048);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<ReportCategory>(b => builder.Entity<ReportCategory>(b =>
@ -605,6 +617,8 @@ public class PlatformDbContext :
b.Property(x => x.Description).HasMaxLength(4096); // JSON string b.Property(x => x.Description).HasMaxLength(4096); // JSON string
b.Property(x => x.Icon).HasMaxLength(64); b.Property(x => x.Icon).HasMaxLength(64);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasMany(x => x.ReportTemplates) b.HasMany(x => x.ReportTemplates)
.WithOne(x => x.ReportCategory) .WithOne(x => x.ReportCategory)
.HasForeignKey(x => x.CategoryId) .HasForeignKey(x => x.CategoryId)
@ -621,6 +635,8 @@ public class PlatformDbContext :
b.Property(x => x.Description).HasMaxLength(1024); b.Property(x => x.Description).HasMaxLength(1024);
b.Property(x => x.HtmlContent).IsRequired(); b.Property(x => x.HtmlContent).IsRequired();
b.Property(x => x.Status).HasMaxLength(20); b.Property(x => x.Status).HasMaxLength(20);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
//Administration //Administration
@ -632,6 +648,8 @@ public class PlatformDbContext :
b.Property(a => a.ResourceType).IsRequired().HasMaxLength(10); b.Property(a => a.ResourceType).IsRequired().HasMaxLength(10);
b.Property(a => a.ResourceId).HasMaxLength(32); b.Property(a => a.ResourceId).HasMaxLength(32);
b.Property(a => a.IP).IsRequired().HasMaxLength(32); b.Property(a => a.IP).IsRequired().HasMaxLength(32);
b.HasIndex(x => new { x.TenantId, x.ResourceType, x.ResourceId, x.IP }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
// Definitions // Definitions
@ -641,6 +659,8 @@ public class PlatformDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<ContactTitle>(b => builder.Entity<ContactTitle>(b =>
@ -650,6 +670,8 @@ public class PlatformDbContext :
b.Property(x => x.Title).IsRequired().HasMaxLength(128); b.Property(x => x.Title).IsRequired().HasMaxLength(128);
b.Property(x => x.Abbreviation).HasMaxLength(64); b.Property(x => x.Abbreviation).HasMaxLength(64);
b.HasIndex(x => new { x.Title }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Currency>(b => builder.Entity<Currency>(b =>
@ -662,7 +684,8 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.Property(x => x.Rate).HasPrecision(18, 6); b.Property(x => x.Rate).HasPrecision(18, 6);
b.Property(x => x.IsActive).HasDefaultValue(true); b.Property(x => x.IsActive).HasDefaultValue(true);
b.Property(x => x.LastUpdated);
b.HasIndex(x => new {x.Id, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<CountryGroup>(b => builder.Entity<CountryGroup>(b =>
@ -671,7 +694,8 @@ public class PlatformDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => x.Name).IsUnique();
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Country>(b => builder.Entity<Country>(b =>
@ -685,8 +709,7 @@ public class PlatformDbContext :
b.Property(x => x.TaxLabel).HasMaxLength(64); b.Property(x => x.TaxLabel).HasMaxLength(64);
b.Property(x => x.Currency).IsRequired().HasMaxLength(8); b.Property(x => x.Currency).IsRequired().HasMaxLength(8);
b.HasIndex(x => x.Name).IsUnique(); b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasIndex(x => x.GroupName);
b.HasOne<CountryGroup>() b.HasOne<CountryGroup>()
.WithMany() .WithMany()
@ -704,7 +727,7 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.Property(x => x.PlateCode).HasMaxLength(20); b.Property(x => x.PlateCode).HasMaxLength(20);
b.HasIndex(x => new { x.Country, x.Name }).IsUnique(); b.HasIndex(x => new { x.Country, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<District>(b => builder.Entity<District>(b =>
@ -717,7 +740,7 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.Property(x => x.Township).HasMaxLength(128); b.Property(x => x.Township).HasMaxLength(128);
b.HasIndex(x => new { x.Country, x.City, x.Name, x.Township }).IsUnique(); b.HasIndex(x => new { x.Country, x.City, x.Name, x.Township }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<SkillType>(b => builder.Entity<SkillType>(b =>
@ -728,6 +751,8 @@ public class PlatformDbContext :
b.Property(x => x.Id).HasMaxLength(128); b.Property(x => x.Id).HasMaxLength(128);
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasMany(x => x.Skills) b.HasMany(x => x.Skills)
.WithOne(x => x.SkillType) .WithOne(x => x.SkillType)
.HasForeignKey(x => x.SkillTypeId) .HasForeignKey(x => x.SkillTypeId)
@ -749,6 +774,8 @@ public class PlatformDbContext :
b.Property(x => x.Id).HasMaxLength(128); b.Property(x => x.Id).HasMaxLength(128);
b.Property(x => x.SkillTypeId).IsRequired().HasMaxLength(128); b.Property(x => x.SkillTypeId).IsRequired().HasMaxLength(128);
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.SkillTypeId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<SkillLevel>(b => builder.Entity<SkillLevel>(b =>
@ -761,6 +788,8 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.Property(x => x.Progress).HasDefaultValue(0); b.Property(x => x.Progress).HasDefaultValue(0);
b.Property(x => x.IsDefault).HasDefaultValue(false); b.Property(x => x.IsDefault).HasDefaultValue(false);
b.HasIndex(x => new { x.SkillTypeId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<UomCategory>(b => builder.Entity<UomCategory>(b =>
@ -771,6 +800,7 @@ public class PlatformDbContext :
b.Property(x => x.Id).HasMaxLength(128); b.Property(x => x.Id).HasMaxLength(128);
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Uom>(b => builder.Entity<Uom>(b =>
@ -785,6 +815,8 @@ public class PlatformDbContext :
b.Property(x => x.Rounding).HasPrecision(18, 6); b.Property(x => x.Rounding).HasPrecision(18, 6);
b.Property(x => x.UomCategoryId).IsRequired().HasMaxLength(128); b.Property(x => x.UomCategoryId).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.Name, x.UomCategoryId }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasOne(x => x.UomCategory) b.HasOne(x => x.UomCategory)
.WithMany(x => x.Uoms) .WithMany(x => x.Uoms)
.HasPrincipalKey(x => x.Id) .HasPrincipalKey(x => x.Id)
@ -808,6 +840,8 @@ public class PlatformDbContext :
b.Property(x => x.Friday); b.Property(x => x.Friday);
b.Property(x => x.Saturday); b.Property(x => x.Saturday);
b.Property(x => x.Sunday); b.Property(x => x.Sunday);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Department>(b => builder.Entity<Department>(b =>
@ -816,6 +850,8 @@ public class PlatformDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(64); b.Property(x => x.Name).IsRequired().HasMaxLength(64);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<JobPosition>(b => builder.Entity<JobPosition>(b =>
@ -826,6 +862,8 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(64); b.Property(x => x.Name).IsRequired().HasMaxLength(64);
b.Property(x => x.DepartmentId).IsRequired(); b.Property(x => x.DepartmentId).IsRequired();
b.HasIndex(x => new { x.TenantId, x.Name, x.DepartmentId }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasOne(x => x.Department) b.HasOne(x => x.Department)
.WithMany(x => x.JobPositions) .WithMany(x => x.JobPositions)
.HasForeignKey(x => x.DepartmentId) .HasForeignKey(x => x.DepartmentId)
@ -874,10 +912,10 @@ public class PlatformDbContext :
b.Property(x => x.Type).HasMaxLength(64); b.Property(x => x.Type).HasMaxLength(64);
b.Property(x => x.Features) b.Property(x => x.Features)
.HasConversion( .HasConversion(
v => JsonSerializer.Serialize(v, (JsonSerializerOptions)null), v => JsonSerializer.Serialize(v, (JsonSerializerOptions)null),
v => JsonSerializer.Deserialize<string[]>(v, (JsonSerializerOptions)null) v => JsonSerializer.Deserialize<string[]>(v, (JsonSerializerOptions)null)
) )
.Metadata .Metadata
.SetValueComparer( .SetValueComparer(
new ValueComparer<string[]>( new ValueComparer<string[]>(
@ -886,6 +924,8 @@ public class PlatformDbContext :
a => a.ToArray() a => a.ToArray()
) )
); );
b.HasIndex(x => new { x.Title }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Product>(b => builder.Entity<Product>(b =>
@ -893,13 +933,14 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Product)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Product)), Prefix.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasKey(x => x.Id);
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.Property(x => x.Description).HasMaxLength(1024); b.Property(x => x.Description).HasMaxLength(1024);
b.Property(x => x.Category).IsRequired().HasMaxLength(64); b.Property(x => x.Category).IsRequired().HasMaxLength(64);
b.Property(x => x.MonthlyPrice).HasPrecision(18, 2); b.Property(x => x.MonthlyPrice).HasPrecision(18, 2);
b.Property(x => x.YearlyPrice).HasPrecision(18, 2); b.Property(x => x.YearlyPrice).HasPrecision(18, 2);
b.Property(x => x.ImageUrl).HasMaxLength(512); b.Property(x => x.ImageUrl).HasMaxLength(512);
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<PaymentMethod>(b => builder.Entity<PaymentMethod>(b =>
@ -910,6 +951,8 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(64); b.Property(x => x.Name).IsRequired().HasMaxLength(64);
b.Property(x => x.Logo).HasMaxLength(32); b.Property(x => x.Logo).HasMaxLength(32);
b.Property(x => x.Commission).HasPrecision(5, 3); b.Property(x => x.Commission).HasPrecision(5, 3);
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<InstallmentOption>(b => builder.Entity<InstallmentOption>(b =>
@ -917,9 +960,10 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.InstallmentOption)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.InstallmentOption)), Prefix.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasKey(x => x.Id);
b.Property(x => x.Name).IsRequired().HasMaxLength(32); b.Property(x => x.Name).IsRequired().HasMaxLength(32);
b.Property(x => x.Commission).HasPrecision(5, 3); b.Property(x => x.Commission).HasPrecision(5, 3);
b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Order>(b => builder.Entity<Order>(b =>
@ -976,7 +1020,7 @@ public class PlatformDbContext :
b.Property(x => x.Description).HasMaxLength(512); b.Property(x => x.Description).HasMaxLength(512);
b.Property(x => x.Icon).HasMaxLength(128); b.Property(x => x.Icon).HasMaxLength(128);
b.HasIndex(x => x.Slug); b.HasIndex(x => new { x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<BlogPost>(b => builder.Entity<BlogPost>(b =>
@ -992,9 +1036,7 @@ public class PlatformDbContext :
b.Property(x => x.CoverImage).HasMaxLength(512); b.Property(x => x.CoverImage).HasMaxLength(512);
b.Property(x => x.ReadTime).HasMaxLength(64); b.Property(x => x.ReadTime).HasMaxLength(64);
b.HasIndex(x => x.Slug); b.HasIndex(x => new { x.CategoryId, x.Title }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasIndex(x => x.IsPublished);
b.HasIndex(x => x.PublishedAt);
b.HasOne(x => x.Category) b.HasOne(x => x.Category)
.WithMany(x => x.Posts) .WithMany(x => x.Posts)
@ -1055,6 +1097,8 @@ public class PlatformDbContext :
b.Property(x => x.CodeHash).HasMaxLength(64); b.Property(x => x.CodeHash).HasMaxLength(64);
b.Property(x => x.PrimaryEntityType).HasMaxLength(256); b.Property(x => x.PrimaryEntityType).HasMaxLength(256);
b.Property(x => x.ControllerName).HasMaxLength(256); b.Property(x => x.ControllerName).HasMaxLength(256);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Announcement>(b => builder.Entity<Announcement>(b =>
@ -1070,6 +1114,8 @@ public class PlatformDbContext :
b.Property(x => x.Attachments).HasMaxLength(2048); b.Property(x => x.Attachments).HasMaxLength(2048);
b.Property(x => x.ViewCount).HasDefaultValue(0); b.Property(x => x.ViewCount).HasDefaultValue(0);
b.Property(x => x.ImageUrl).HasColumnType("text"); b.Property(x => x.ImageUrl).HasColumnType("text");
b.HasIndex(x => new { x.TenantId, x.Title }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Survey>(b => builder.Entity<Survey>(b =>
@ -1082,6 +1128,8 @@ public class PlatformDbContext :
b.Property(x => x.Deadline).IsRequired(); b.Property(x => x.Deadline).IsRequired();
b.Property(x => x.Responses).HasDefaultValue(0); b.Property(x => x.Responses).HasDefaultValue(0);
b.Property(x => x.Status).IsRequired().HasMaxLength(10); b.Property(x => x.Status).IsRequired().HasMaxLength(10);
b.HasIndex(x => new { x.TenantId, x.Title }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<SurveyQuestion>(b => builder.Entity<SurveyQuestion>(b =>
@ -1228,6 +1276,8 @@ public class PlatformDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<EventType>(b => builder.Entity<EventType>(b =>
@ -1236,6 +1286,8 @@ public class PlatformDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
builder.Entity<Event>(b => builder.Entity<Event>(b =>
@ -1250,6 +1302,8 @@ public class PlatformDbContext :
b.Property(x => x.isPublished).HasDefaultValue(false); b.Property(x => x.isPublished).HasDefaultValue(false);
b.Property(x => x.Photos).HasColumnType("text"); b.Property(x => x.Photos).HasColumnType("text");
b.HasIndex(x => new { x.TenantId, x.CategoryId, x.TypeId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasOne(x => x.Category) b.HasOne(x => x.Category)
.WithMany(x => x.Events) .WithMany(x => x.Events)
.HasForeignKey(x => x.CategoryId) .HasForeignKey(x => x.CategoryId)
@ -1269,7 +1323,6 @@ public class PlatformDbContext :
b.Property(x => x.Content).HasMaxLength(512); b.Property(x => x.Content).HasMaxLength(512);
b.Property(x => x.Likes).HasDefaultValue(0); b.Property(x => x.Likes).HasDefaultValue(0);
// Event -> EventComment (1 - N)
b.HasOne(x => x.Event) b.HasOne(x => x.Event)
.WithMany(x => x.Comments) .WithMany(x => x.Comments)
.HasForeignKey(x => x.EventId) .HasForeignKey(x => x.EventId)
@ -1298,8 +1351,7 @@ public class PlatformDbContext :
b.Property(x => x.Subject).HasMaxLength(128); b.Property(x => x.Subject).HasMaxLength(128);
b.Property(x => x.TeacherName).IsRequired().HasMaxLength(128); b.Property(x => x.TeacherName).IsRequired().HasMaxLength(128);
b.HasIndex(x => x.TeacherId); b.HasIndex(x => new { x.TenantId, x.BranchId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
b.HasIndex(x => x.ScheduledStartTime);
b.HasMany(x => x.Participants) b.HasMany(x => x.Participants)
.WithOne(x => x.Session) .WithOne(x => x.Session)
@ -1326,10 +1378,6 @@ public class PlatformDbContext :
b.Property(x => x.ConnectionId).HasMaxLength(128); b.Property(x => x.ConnectionId).HasMaxLength(128);
b.Property(x => x.IsActive).HasDefaultValue(true); b.Property(x => x.IsActive).HasDefaultValue(true);
b.Property(x => x.IsKicked).HasDefaultValue(false); b.Property(x => x.IsKicked).HasDefaultValue(false);
b.HasIndex(x => x.SessionId);
b.HasIndex(x => x.UserId);
b.HasIndex(x => new { x.SessionId, x.UserId }).IsUnique();
}); });
builder.Entity<VideoroomAttandance>(b => builder.Entity<VideoroomAttandance>(b =>
@ -1338,10 +1386,6 @@ public class PlatformDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.StudentName).IsRequired().HasMaxLength(128); b.Property(x => x.StudentName).IsRequired().HasMaxLength(128);
b.HasIndex(x => x.SessionId);
b.HasIndex(x => x.StudentId);
b.HasIndex(x => x.JoinTime);
}); });
builder.Entity<VideoroomChat>(b => builder.Entity<VideoroomChat>(b =>
@ -1353,10 +1397,30 @@ public class PlatformDbContext :
b.Property(x => x.Message).IsRequired().HasMaxLength(2048); b.Property(x => x.Message).IsRequired().HasMaxLength(2048);
b.Property(x => x.MessageType).HasMaxLength(64); b.Property(x => x.MessageType).HasMaxLength(64);
b.Property(x => x.RecipientName).HasMaxLength(256); b.Property(x => x.RecipientName).HasMaxLength(256);
});
b.HasIndex(x => x.SessionId); builder.Entity<Sequence>(b =>
b.HasIndex(x => x.SenderId); {
b.HasIndex(x => x.Timestamp); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Sequence)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Name).HasMaxLength(128).IsRequired();
b.Property(x => x.Prefix).HasMaxLength(32);
b.Property(x => x.Suffix).HasMaxLength(32);
b.Property(x => x.FormatTemplate).HasMaxLength(256).IsRequired().HasDefaultValue("{Prefix}{Number}{Suffix}");
b.Property(x => x.PaddingSize).IsRequired().HasDefaultValue(6);
b.Property(x => x.IncrementStep).IsRequired().HasDefaultValue(1);
b.Property(x => x.NextNumber).IsRequired().HasDefaultValue(1);
b.Property(x => x.ResetPeriod).IsRequired().HasConversion<int>().HasDefaultValue(SequenceResetPeriod.None);
b.Property(x => x.LastPeriodKey).HasMaxLength(20);
b.Property(x => x.IsActive).IsRequired().HasDefaultValue(true);
b.HasIndex(x => new { x.TenantId, x.Name }).IsUnique().HasFilter("[IsDeleted] = 0");
}); });
} }
} }

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Sozsoft.Platform.Migrations namespace Sozsoft.Platform.Migrations
{ {
[DbContext(typeof(PlatformDbContext))] [DbContext(typeof(PlatformDbContext))]
[Migration("20260511093511_Initial")] [Migration("20260517100701_Initial")]
partial class Initial partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -27,6 +27,106 @@ namespace Sozsoft.Platform.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Sequence", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("FormatTemplate")
.IsRequired()
.ValueGeneratedOnAdd()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)")
.HasDefaultValue("{Prefix}{Number}{Suffix}");
b.Property<int>("IncrementStep")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(1);
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LastPeriodKey")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<long>("NextNumber")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasDefaultValue(1L);
b.Property<int>("PaddingSize")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(6);
b.Property<string>("Prefix")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<int>("ResetPeriod")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<long>("StartNumber")
.HasColumnType("bigint");
b.Property<string>("Suffix")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Sequence", (string)null);
});
modelBuilder.Entity("Sozsoft.Languages.Entities.Language", b => modelBuilder.Entity("Sozsoft.Languages.Entities.Language", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -602,6 +702,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Sas_H_AiBot", (string)null); b.ToTable("Sas_H_AiBot", (string)null);
}); });
@ -690,6 +793,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Announcement", (string)null); b.ToTable("Adm_T_Announcement", (string)null);
}); });
@ -763,6 +870,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_BackgroundWorker", (string)null); b.ToTable("Sas_H_BackgroundWorker", (string)null);
}); });
@ -830,7 +941,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Slug"); b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_BlogCategory", (string)null); b.ToTable("Sas_H_BlogCategory", (string)null);
}); });
@ -924,13 +1037,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CategoryId"); b.HasIndex("CategoryId", "Title")
.IsUnique()
b.HasIndex("IsPublished"); .HasFilter("[IsDeleted] = 0");
b.HasIndex("PublishedAt");
b.HasIndex("Slug");
b.ToTable("Sas_H_BlogPost", (string)null); b.ToTable("Sas_H_BlogPost", (string)null);
}); });
@ -1046,28 +1155,35 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Code")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_T_Branch", (string)null); b.ToTable("Sas_T_Branch", (string)null);
}); });
modelBuilder.Entity("Sozsoft.Platform.Entities.BranchUsers", b => modelBuilder.Entity("Sozsoft.Platform.Entities.BranchUsers", b =>
{ {
b.Property<Guid>("UserId") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid>("BranchId") b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("TenantId"); .HasColumnName("TenantId");
b.HasKey("UserId", "BranchId"); b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("BranchId"); b.HasIndex("BranchId");
b.HasIndex("TenantId", "BranchId", "UserId")
.IsUnique();
b.ToTable("Sas_T_BranchUsers", (string)null); b.ToTable("Sas_T_BranchUsers", (string)null);
}); });
@ -1128,7 +1244,7 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("Country", "Name") b.HasIndex("Country", "Name")
.IsUnique() .IsUnique()
.HasFilter("[Country] IS NOT NULL"); .HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_City", (string)null); b.ToTable("Sas_H_City", (string)null);
}); });
@ -1247,6 +1363,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_ContactTitle", (string)null); b.ToTable("Sas_H_ContactTitle", (string)null);
}); });
@ -1318,7 +1438,8 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("GroupName"); b.HasIndex("GroupName");
b.HasIndex("Name") b.HasIndex("Name")
.IsUnique(); .IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Country", (string)null); b.ToTable("Sas_H_Country", (string)null);
}); });
@ -1366,7 +1487,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name") b.HasIndex("Name")
.IsUnique(); .IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CountryGroup", (string)null); b.ToTable("Sas_H_CountryGroup", (string)null);
}); });
@ -1439,6 +1561,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "EntityName", "Method", "Path")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CrudEndpoint", (string)null); b.ToTable("Sas_H_CrudEndpoint", (string)null);
}); });
@ -1501,6 +1627,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Id", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Currency", (string)null); b.ToTable("Sas_H_Currency", (string)null);
}); });
@ -1569,6 +1699,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CustomComponent", (string)null); b.ToTable("Sas_H_CustomComponent", (string)null);
}); });
@ -1647,6 +1781,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CustomEndpoint", (string)null); b.ToTable("Sas_H_CustomEndpoint", (string)null);
}); });
@ -1699,6 +1837,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Code")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_DataSource", (string)null); b.ToTable("Sas_H_DataSource", (string)null);
}); });
@ -1827,6 +1969,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Department", (string)null); b.ToTable("Adm_T_Department", (string)null);
}); });
@ -1892,7 +2038,7 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("Country", "City", "Name", "Township") b.HasIndex("Country", "City", "Name", "Township")
.IsUnique() .IsUnique()
.HasFilter("[Country] IS NOT NULL AND [Township] IS NOT NULL"); .HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_District", (string)null); b.ToTable("Sas_H_District", (string)null);
}); });
@ -1988,6 +2134,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_DynamicService", (string)null); b.ToTable("Sas_H_DynamicService", (string)null);
}); });
@ -2079,6 +2229,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("TypeId"); b.HasIndex("TypeId");
b.HasIndex("TenantId", "CategoryId", "TypeId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Event", (string)null); b.ToTable("Adm_T_Event", (string)null);
}); });
@ -2128,6 +2282,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_EventCategory", (string)null); b.ToTable("Adm_T_EventCategory", (string)null);
}); });
@ -2290,6 +2448,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_EventType", (string)null); b.ToTable("Adm_T_EventType", (string)null);
}); });
@ -2472,6 +2634,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_InstallmentOption", (string)null); b.ToTable("Sas_H_InstallmentOption", (string)null);
}); });
@ -2530,6 +2696,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "ResourceType", "ResourceId", "IP")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_IpRestriction", (string)null); b.ToTable("Adm_T_IpRestriction", (string)null);
}); });
@ -2587,6 +2757,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("DepartmentId"); b.HasIndex("DepartmentId");
b.HasIndex("TenantId", "Name", "DepartmentId")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_JobPosition", (string)null); b.ToTable("Adm_T_JobPosition", (string)null);
}); });
@ -2884,6 +3058,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ListFormCode")
.IsUnique();
b.ToTable("Sas_H_ListForm", (string)null); b.ToTable("Sas_H_ListForm", (string)null);
}); });
@ -3096,7 +3273,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ListFormCode"); b.HasIndex("ListFormCode", "UserId", "RoleId", "CultureName", "FieldName")
.IsUnique();
b.ToTable("Sas_H_ListFormField", (string)null); b.ToTable("Sas_H_ListFormField", (string)null);
}); });
@ -3325,6 +3503,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("Sas_H_Menu", (string)null); b.ToTable("Sas_H_Menu", (string)null);
}); });
@ -3340,6 +3521,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Sas_H_MenuGroup", (string)null); b.ToTable("Sas_H_MenuGroup", (string)null);
}); });
@ -3662,6 +3846,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_PaymentMethod", (string)null); b.ToTable("Sas_H_PaymentMethod", (string)null);
}); });
@ -3734,6 +3922,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Product", (string)null); b.ToTable("Sas_H_Product", (string)null);
}); });
@ -3791,6 +3983,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_ReportCategory", (string)null); b.ToTable("Adm_T_ReportCategory", (string)null);
}); });
@ -3857,6 +4053,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("CategoryId"); b.HasIndex("CategoryId");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_ReportTemplate", (string)null); b.ToTable("Adm_T_ReportTemplate", (string)null);
}); });
@ -3919,6 +4119,14 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Key")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.HasIndex("Path")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Route", (string)null); b.ToTable("Sas_H_Route", (string)null);
}); });
@ -3968,6 +4176,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Sector", (string)null); b.ToTable("Adm_T_Sector", (string)null);
}); });
@ -4028,6 +4240,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Service", (string)null); b.ToTable("Sas_H_Service", (string)null);
}); });
@ -4079,7 +4295,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SkillTypeId"); b.HasIndex("SkillTypeId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Skill", (string)null); b.ToTable("Sas_H_Skill", (string)null);
}); });
@ -4142,7 +4360,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SkillTypeId"); b.HasIndex("SkillTypeId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_SkillLevel", (string)null); b.ToTable("Sas_H_SkillLevel", (string)null);
}); });
@ -4190,6 +4410,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_SkillType", (string)null); b.ToTable("Sas_H_SkillType", (string)null);
}); });
@ -4633,6 +4857,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Survey", (string)null); b.ToTable("Adm_T_Survey", (string)null);
}); });
@ -4943,6 +5171,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("UomCategoryId"); b.HasIndex("UomCategoryId");
b.HasIndex("Name", "UomCategoryId")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Uom", (string)null); b.ToTable("Sas_H_Uom", (string)null);
}); });
@ -4989,6 +5221,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_UomCategory", (string)null); b.ToTable("Sas_H_UomCategory", (string)null);
}); });
@ -5081,9 +5317,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ScheduledStartTime"); b.HasIndex("TenantId", "BranchId", "Name")
.IsUnique()
b.HasIndex("TeacherId"); .HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Videoroom", (string)null); b.ToTable("Adm_T_Videoroom", (string)null);
}); });
@ -5152,12 +5388,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("JoinTime");
b.HasIndex("SessionId"); b.HasIndex("SessionId");
b.HasIndex("StudentId");
b.ToTable("Adm_T_VideoroomAttandance", (string)null); b.ToTable("Adm_T_VideoroomAttandance", (string)null);
}); });
@ -5238,12 +5470,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SenderId");
b.HasIndex("SessionId"); b.HasIndex("SessionId");
b.HasIndex("Timestamp");
b.ToTable("Adm_T_VideoroomChat", (string)null); b.ToTable("Adm_T_VideoroomChat", (string)null);
}); });
@ -5333,12 +5561,6 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("SessionId"); b.HasIndex("SessionId");
b.HasIndex("UserId");
b.HasIndex("SessionId", "UserId")
.IsUnique()
.HasFilter("[UserId] IS NOT NULL");
b.ToTable("Adm_T_VideoroomParticipant", (string)null); b.ToTable("Adm_T_VideoroomParticipant", (string)null);
}); });
@ -5417,6 +5639,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_WorkHour", (string)null); b.ToTable("Adm_T_WorkHour", (string)null);
}); });
@ -5506,7 +5732,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("DisplayOrder"); b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_T_ForumCategory", (string)null); b.ToTable("Sas_T_ForumCategory", (string)null);
}); });
@ -5673,10 +5901,6 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("CategoryId"); b.HasIndex("CategoryId");
b.HasIndex("IsPinned");
b.HasIndex("LastPostDate");
b.ToTable("Sas_T_ForumTopic", (string)null); b.ToTable("Sas_T_ForumTopic", (string)null);
}); });

View file

@ -642,6 +642,36 @@ namespace Sozsoft.Platform.Migrations
table.PrimaryKey("PK_Adm_T_Sector", x => x.Id); table.PrimaryKey("PK_Adm_T_Sector", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "Adm_T_Sequence",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
Prefix = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
Suffix = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
PaddingSize = table.Column<int>(type: "int", nullable: false, defaultValue: 6),
IncrementStep = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
StartNumber = table.Column<long>(type: "bigint", nullable: false),
NextNumber = table.Column<long>(type: "bigint", nullable: false, defaultValue: 1L),
ResetPeriod = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
LastPeriodKey = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
FormatTemplate = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false, defaultValue: "{Prefix}{Number}{Suffix}"),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Adm_T_Sequence", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Adm_T_SocialPost", name: "Adm_T_SocialPost",
columns: table => new columns: table => new
@ -2753,14 +2783,14 @@ namespace Sozsoft.Platform.Migrations
name: "Sas_T_BranchUsers", name: "Sas_T_BranchUsers",
columns: table => new columns: table => new
{ {
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false) BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Sas_T_BranchUsers", x => new { x.UserId, x.BranchId }); table.PrimaryKey("PK_Sas_T_BranchUsers", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_Sas_T_BranchUsers_Sas_T_Branch_BranchId", name: "FK_Sas_T_BranchUsers_Sas_T_Branch_BranchId",
column: x => x.BranchId, column: x => x.BranchId,
@ -3424,16 +3454,44 @@ namespace Sozsoft.Platform.Migrations
table: "AbpUsers", table: "AbpUsers",
column: "UserName"); column: "UserName");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_Announcement_TenantId_Title",
table: "Adm_T_Announcement",
columns: new[] { "TenantId", "Title" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_Department_TenantId_Name",
table: "Adm_T_Department",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_Event_CategoryId", name: "IX_Adm_T_Event_CategoryId",
table: "Adm_T_Event", table: "Adm_T_Event",
column: "CategoryId"); column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_Event_TenantId_CategoryId_TypeId_Name",
table: "Adm_T_Event",
columns: new[] { "TenantId", "CategoryId", "TypeId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_Event_TypeId", name: "IX_Adm_T_Event_TypeId",
table: "Adm_T_Event", table: "Adm_T_Event",
column: "TypeId"); column: "TypeId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_EventCategory_TenantId_Name",
table: "Adm_T_EventCategory",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_EventComment_EventId", name: "IX_Adm_T_EventComment_EventId",
table: "Adm_T_EventComment", table: "Adm_T_EventComment",
@ -3444,16 +3502,65 @@ namespace Sozsoft.Platform.Migrations
table: "Adm_T_EventLike", table: "Adm_T_EventLike",
column: "EventId"); column: "EventId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_EventType_TenantId_Name",
table: "Adm_T_EventType",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_IpRestriction_TenantId_ResourceType_ResourceId_IP",
table: "Adm_T_IpRestriction",
columns: new[] { "TenantId", "ResourceType", "ResourceId", "IP" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_JobPosition_DepartmentId", name: "IX_Adm_T_JobPosition_DepartmentId",
table: "Adm_T_JobPosition", table: "Adm_T_JobPosition",
column: "DepartmentId"); column: "DepartmentId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_JobPosition_TenantId_Name_DepartmentId",
table: "Adm_T_JobPosition",
columns: new[] { "TenantId", "Name", "DepartmentId" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_ReportCategory_TenantId_Name",
table: "Adm_T_ReportCategory",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_ReportTemplate_CategoryId", name: "IX_Adm_T_ReportTemplate_CategoryId",
table: "Adm_T_ReportTemplate", table: "Adm_T_ReportTemplate",
column: "CategoryId"); column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_ReportTemplate_TenantId_Name",
table: "Adm_T_ReportTemplate",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_Sector_TenantId_Name",
table: "Adm_T_Sector",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_Sequence_TenantId_Name",
table: "Adm_T_Sequence",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_SocialComment_SocialPostId", name: "IX_Adm_T_SocialComment_SocialPostId",
table: "Adm_T_SocialComment", table: "Adm_T_SocialComment",
@ -3481,6 +3588,13 @@ namespace Sozsoft.Platform.Migrations
table: "Adm_T_SocialPollOption", table: "Adm_T_SocialPollOption",
column: "SocialMediaId"); column: "SocialMediaId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_Survey_TenantId_Title",
table: "Adm_T_Survey",
columns: new[] { "TenantId", "Title" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_SurveyAnswer_QuestionId", name: "IX_Adm_T_SurveyAnswer_QuestionId",
table: "Adm_T_SurveyAnswer", table: "Adm_T_SurveyAnswer",
@ -3507,61 +3621,33 @@ namespace Sozsoft.Platform.Migrations
column: "SurveyId"); column: "SurveyId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_Videoroom_ScheduledStartTime", name: "IX_Adm_T_Videoroom_TenantId_BranchId_Name",
table: "Adm_T_Videoroom", table: "Adm_T_Videoroom",
column: "ScheduledStartTime"); columns: new[] { "TenantId", "BranchId", "Name" },
unique: true,
migrationBuilder.CreateIndex( filter: "[IsDeleted] = 0");
name: "IX_Adm_T_Videoroom_TeacherId",
table: "Adm_T_Videoroom",
column: "TeacherId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomAttandance_JoinTime",
table: "Adm_T_VideoroomAttandance",
column: "JoinTime");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomAttandance_SessionId", name: "IX_Adm_T_VideoroomAttandance_SessionId",
table: "Adm_T_VideoroomAttandance", table: "Adm_T_VideoroomAttandance",
column: "SessionId"); column: "SessionId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomAttandance_StudentId",
table: "Adm_T_VideoroomAttandance",
column: "StudentId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomChat_SenderId",
table: "Adm_T_VideoroomChat",
column: "SenderId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomChat_SessionId", name: "IX_Adm_T_VideoroomChat_SessionId",
table: "Adm_T_VideoroomChat", table: "Adm_T_VideoroomChat",
column: "SessionId"); column: "SessionId");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomChat_Timestamp",
table: "Adm_T_VideoroomChat",
column: "Timestamp");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomParticipant_SessionId", name: "IX_Adm_T_VideoroomParticipant_SessionId",
table: "Adm_T_VideoroomParticipant", table: "Adm_T_VideoroomParticipant",
column: "SessionId"); column: "SessionId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomParticipant_SessionId_UserId", name: "IX_Adm_T_WorkHour_TenantId_Name",
table: "Adm_T_VideoroomParticipant", table: "Adm_T_WorkHour",
columns: new[] { "SessionId", "UserId" }, columns: new[] { "TenantId", "Name" },
unique: true, unique: true,
filter: "[UserId] IS NOT NULL"); filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Adm_T_VideoroomParticipant_UserId",
table: "Adm_T_VideoroomParticipant",
column: "UserId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_OpenIddictApplications_ClientId", name: "IX_OpenIddictApplications_ClientId",
@ -3593,6 +3679,19 @@ namespace Sozsoft.Platform.Migrations
table: "OpenIddictTokens", table: "OpenIddictTokens",
column: "ReferenceId"); column: "ReferenceId");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_AiBot_Name",
table: "Sas_H_AiBot",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Sas_H_BackgroundWorker_Name",
table: "Sas_H_BackgroundWorker",
column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_BackgroundWorker_MailQueue_TableName", name: "IX_Sas_H_BackgroundWorker_MailQueue_TableName",
table: "Sas_H_BackgroundWorker_MailQueue", table: "Sas_H_BackgroundWorker_MailQueue",
@ -3610,42 +3709,38 @@ namespace Sozsoft.Platform.Migrations
unique: true); unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_BlogCategory_Slug", name: "IX_Sas_H_BlogCategory_Name",
table: "Sas_H_BlogCategory", table: "Sas_H_BlogCategory",
column: "Slug"); column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_BlogPost_CategoryId", name: "IX_Sas_H_BlogPost_CategoryId_Title",
table: "Sas_H_BlogPost", table: "Sas_H_BlogPost",
column: "CategoryId"); columns: new[] { "CategoryId", "Title" },
unique: true,
migrationBuilder.CreateIndex( filter: "[IsDeleted] = 0");
name: "IX_Sas_H_BlogPost_IsPublished",
table: "Sas_H_BlogPost",
column: "IsPublished");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_BlogPost_PublishedAt",
table: "Sas_H_BlogPost",
column: "PublishedAt");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_BlogPost_Slug",
table: "Sas_H_BlogPost",
column: "Slug");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_City_Country_Name", name: "IX_Sas_H_City_Country_Name",
table: "Sas_H_City", table: "Sas_H_City",
columns: new[] { "Country", "Name" }, columns: new[] { "Country", "Name" },
unique: true, unique: true,
filter: "[Country] IS NOT NULL"); filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_City_CountryId", name: "IX_Sas_H_City_CountryId",
table: "Sas_H_City", table: "Sas_H_City",
column: "CountryId"); column: "CountryId");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_ContactTitle_Title",
table: "Sas_H_ContactTitle",
column: "Title",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_Country_GroupName", name: "IX_Sas_H_Country_GroupName",
table: "Sas_H_Country", table: "Sas_H_Country",
@ -3655,13 +3750,50 @@ namespace Sozsoft.Platform.Migrations
name: "IX_Sas_H_Country_Name", name: "IX_Sas_H_Country_Name",
table: "Sas_H_Country", table: "Sas_H_Country",
column: "Name", column: "Name",
unique: true); unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_CountryGroup_Name", name: "IX_Sas_H_CountryGroup_Name",
table: "Sas_H_CountryGroup", table: "Sas_H_CountryGroup",
column: "Name", column: "Name",
unique: true); unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_CrudEndpoint_TenantId_EntityName_Method_Path",
table: "Sas_H_CrudEndpoint",
columns: new[] { "TenantId", "EntityName", "Method", "Path" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_Currency_Id_Name",
table: "Sas_H_Currency",
columns: new[] { "Id", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_CustomComponent_TenantId_Name",
table: "Sas_H_CustomComponent",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_CustomEndpoint_TenantId_Name",
table: "Sas_H_CustomEndpoint",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_DataSource_Code",
table: "Sas_H_DataSource",
column: "Code",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_District_CityId", name: "IX_Sas_H_District_CityId",
@ -3673,7 +3805,21 @@ namespace Sozsoft.Platform.Migrations
table: "Sas_H_District", table: "Sas_H_District",
columns: new[] { "Country", "City", "Name", "Township" }, columns: new[] { "Country", "City", "Name", "Township" },
unique: true, unique: true,
filter: "[Country] IS NOT NULL AND [Township] IS NOT NULL"); filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_DynamicService_TenantId_Name",
table: "Sas_H_DynamicService",
columns: new[] { "TenantId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_InstallmentOption_Name",
table: "Sas_H_InstallmentOption",
column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_LanguageKey_ResourceName_Key", name: "IX_Sas_H_LanguageKey_ResourceName_Key",
@ -3691,15 +3837,22 @@ namespace Sozsoft.Platform.Migrations
table: "Sas_H_LanguageText", table: "Sas_H_LanguageText",
columns: new[] { "ResourceName", "Key" }); columns: new[] { "ResourceName", "Key" });
migrationBuilder.CreateIndex(
name: "IX_Sas_H_ListForm_ListFormCode",
table: "Sas_H_ListForm",
column: "ListFormCode",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_ListFormCustomization_ListFormCode", name: "IX_Sas_H_ListFormCustomization_ListFormCode",
table: "Sas_H_ListFormCustomization", table: "Sas_H_ListFormCustomization",
column: "ListFormCode"); column: "ListFormCode");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_ListFormField_ListFormCode", name: "IX_Sas_H_ListFormField_ListFormCode_UserId_RoleId_CultureName_FieldName",
table: "Sas_H_ListFormField", table: "Sas_H_ListFormField",
column: "ListFormCode"); columns: new[] { "ListFormCode", "UserId", "RoleId", "CultureName", "FieldName" },
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_ListFormImport_ListFormCode", name: "IX_Sas_H_ListFormImport_ListFormCode",
@ -3711,6 +3864,18 @@ namespace Sozsoft.Platform.Migrations
table: "Sas_H_ListFormImportExecute", table: "Sas_H_ListFormImportExecute",
column: "ImportId"); column: "ImportId");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_Menu_Code",
table: "Sas_H_Menu",
column: "Code",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Sas_H_MenuGroup_Name",
table: "Sas_H_MenuGroup",
column: "Name",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_Notification_NotificationRuleId", name: "IX_Sas_H_Notification_NotificationRuleId",
table: "Sas_H_Notification", table: "Sas_H_Notification",
@ -3732,29 +3897,104 @@ namespace Sozsoft.Platform.Migrations
column: "OrderId"); column: "OrderId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_Skill_SkillTypeId", name: "IX_Sas_H_PaymentMethod_Name",
table: "Sas_H_Skill", table: "Sas_H_PaymentMethod",
column: "SkillTypeId"); column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_SkillLevel_SkillTypeId", name: "IX_Sas_H_Product_Name",
table: "Sas_H_Product",
column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_Route_Key",
table: "Sas_H_Route",
column: "Key",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_Route_Path",
table: "Sas_H_Route",
column: "Path",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_Service_Title",
table: "Sas_H_Service",
column: "Title",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_Skill_SkillTypeId_Name",
table: "Sas_H_Skill",
columns: new[] { "SkillTypeId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_SkillLevel_SkillTypeId_Name",
table: "Sas_H_SkillLevel", table: "Sas_H_SkillLevel",
column: "SkillTypeId"); columns: new[] { "SkillTypeId", "Name" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_SkillType_Name",
table: "Sas_H_SkillType",
column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_Uom_Name_UomCategoryId",
table: "Sas_H_Uom",
columns: new[] { "Name", "UomCategoryId" },
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_H_Uom_UomCategoryId", name: "IX_Sas_H_Uom_UomCategoryId",
table: "Sas_H_Uom", table: "Sas_H_Uom",
column: "UomCategoryId"); column: "UomCategoryId");
migrationBuilder.CreateIndex(
name: "IX_Sas_H_UomCategory_Name",
table: "Sas_H_UomCategory",
column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex(
name: "IX_Sas_T_Branch_Code",
table: "Sas_T_Branch",
column: "Code",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_T_BranchUsers_BranchId", name: "IX_Sas_T_BranchUsers_BranchId",
table: "Sas_T_BranchUsers", table: "Sas_T_BranchUsers",
column: "BranchId"); column: "BranchId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_T_ForumCategory_DisplayOrder", name: "IX_Sas_T_BranchUsers_TenantId_BranchId_UserId",
table: "Sas_T_BranchUsers",
columns: new[] { "TenantId", "BranchId", "UserId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Sas_T_ForumCategory_Name",
table: "Sas_T_ForumCategory", table: "Sas_T_ForumCategory",
column: "DisplayOrder"); column: "Name",
unique: true,
filter: "[IsDeleted] = 0");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Sas_T_ForumPost_ParentPostId", name: "IX_Sas_T_ForumPost_ParentPostId",
@ -3770,16 +4010,6 @@ namespace Sozsoft.Platform.Migrations
name: "IX_Sas_T_ForumTopic_CategoryId", name: "IX_Sas_T_ForumTopic_CategoryId",
table: "Sas_T_ForumTopic", table: "Sas_T_ForumTopic",
column: "CategoryId"); column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_Sas_T_ForumTopic_IsPinned",
table: "Sas_T_ForumTopic",
column: "IsPinned");
migrationBuilder.CreateIndex(
name: "IX_Sas_T_ForumTopic_LastPostDate",
table: "Sas_T_ForumTopic",
column: "LastPostDate");
} }
/// <inheritdoc /> /// <inheritdoc />
@ -3881,6 +4111,9 @@ namespace Sozsoft.Platform.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Adm_T_Sector"); name: "Adm_T_Sector");
migrationBuilder.DropTable(
name: "Adm_T_Sequence");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Adm_T_SocialComment"); name: "Adm_T_SocialComment");

View file

@ -24,6 +24,106 @@ namespace Sozsoft.Platform.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Sequence", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("FormatTemplate")
.IsRequired()
.ValueGeneratedOnAdd()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)")
.HasDefaultValue("{Prefix}{Number}{Suffix}");
b.Property<int>("IncrementStep")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(1);
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LastPeriodKey")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<long>("NextNumber")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasDefaultValue(1L);
b.Property<int>("PaddingSize")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(6);
b.Property<string>("Prefix")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<int>("ResetPeriod")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<long>("StartNumber")
.HasColumnType("bigint");
b.Property<string>("Suffix")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Sequence", (string)null);
});
modelBuilder.Entity("Sozsoft.Languages.Entities.Language", b => modelBuilder.Entity("Sozsoft.Languages.Entities.Language", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -599,6 +699,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Sas_H_AiBot", (string)null); b.ToTable("Sas_H_AiBot", (string)null);
}); });
@ -687,6 +790,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Announcement", (string)null); b.ToTable("Adm_T_Announcement", (string)null);
}); });
@ -760,6 +867,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_BackgroundWorker", (string)null); b.ToTable("Sas_H_BackgroundWorker", (string)null);
}); });
@ -827,7 +938,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Slug"); b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_BlogCategory", (string)null); b.ToTable("Sas_H_BlogCategory", (string)null);
}); });
@ -921,13 +1034,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CategoryId"); b.HasIndex("CategoryId", "Title")
.IsUnique()
b.HasIndex("IsPublished"); .HasFilter("[IsDeleted] = 0");
b.HasIndex("PublishedAt");
b.HasIndex("Slug");
b.ToTable("Sas_H_BlogPost", (string)null); b.ToTable("Sas_H_BlogPost", (string)null);
}); });
@ -1043,28 +1152,35 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Code")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_T_Branch", (string)null); b.ToTable("Sas_T_Branch", (string)null);
}); });
modelBuilder.Entity("Sozsoft.Platform.Entities.BranchUsers", b => modelBuilder.Entity("Sozsoft.Platform.Entities.BranchUsers", b =>
{ {
b.Property<Guid>("UserId") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid>("BranchId") b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("TenantId"); .HasColumnName("TenantId");
b.HasKey("UserId", "BranchId"); b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("BranchId"); b.HasIndex("BranchId");
b.HasIndex("TenantId", "BranchId", "UserId")
.IsUnique();
b.ToTable("Sas_T_BranchUsers", (string)null); b.ToTable("Sas_T_BranchUsers", (string)null);
}); });
@ -1125,7 +1241,7 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("Country", "Name") b.HasIndex("Country", "Name")
.IsUnique() .IsUnique()
.HasFilter("[Country] IS NOT NULL"); .HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_City", (string)null); b.ToTable("Sas_H_City", (string)null);
}); });
@ -1244,6 +1360,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_ContactTitle", (string)null); b.ToTable("Sas_H_ContactTitle", (string)null);
}); });
@ -1315,7 +1435,8 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("GroupName"); b.HasIndex("GroupName");
b.HasIndex("Name") b.HasIndex("Name")
.IsUnique(); .IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Country", (string)null); b.ToTable("Sas_H_Country", (string)null);
}); });
@ -1363,7 +1484,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name") b.HasIndex("Name")
.IsUnique(); .IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CountryGroup", (string)null); b.ToTable("Sas_H_CountryGroup", (string)null);
}); });
@ -1436,6 +1558,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "EntityName", "Method", "Path")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CrudEndpoint", (string)null); b.ToTable("Sas_H_CrudEndpoint", (string)null);
}); });
@ -1498,6 +1624,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Id", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Currency", (string)null); b.ToTable("Sas_H_Currency", (string)null);
}); });
@ -1566,6 +1696,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CustomComponent", (string)null); b.ToTable("Sas_H_CustomComponent", (string)null);
}); });
@ -1644,6 +1778,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_CustomEndpoint", (string)null); b.ToTable("Sas_H_CustomEndpoint", (string)null);
}); });
@ -1696,6 +1834,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Code")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_DataSource", (string)null); b.ToTable("Sas_H_DataSource", (string)null);
}); });
@ -1824,6 +1966,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Department", (string)null); b.ToTable("Adm_T_Department", (string)null);
}); });
@ -1889,7 +2035,7 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("Country", "City", "Name", "Township") b.HasIndex("Country", "City", "Name", "Township")
.IsUnique() .IsUnique()
.HasFilter("[Country] IS NOT NULL AND [Township] IS NOT NULL"); .HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_District", (string)null); b.ToTable("Sas_H_District", (string)null);
}); });
@ -1985,6 +2131,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_DynamicService", (string)null); b.ToTable("Sas_H_DynamicService", (string)null);
}); });
@ -2076,6 +2226,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("TypeId"); b.HasIndex("TypeId");
b.HasIndex("TenantId", "CategoryId", "TypeId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Event", (string)null); b.ToTable("Adm_T_Event", (string)null);
}); });
@ -2125,6 +2279,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_EventCategory", (string)null); b.ToTable("Adm_T_EventCategory", (string)null);
}); });
@ -2287,6 +2445,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_EventType", (string)null); b.ToTable("Adm_T_EventType", (string)null);
}); });
@ -2469,6 +2631,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_InstallmentOption", (string)null); b.ToTable("Sas_H_InstallmentOption", (string)null);
}); });
@ -2527,6 +2693,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "ResourceType", "ResourceId", "IP")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_IpRestriction", (string)null); b.ToTable("Adm_T_IpRestriction", (string)null);
}); });
@ -2584,6 +2754,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("DepartmentId"); b.HasIndex("DepartmentId");
b.HasIndex("TenantId", "Name", "DepartmentId")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_JobPosition", (string)null); b.ToTable("Adm_T_JobPosition", (string)null);
}); });
@ -2881,6 +3055,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ListFormCode")
.IsUnique();
b.ToTable("Sas_H_ListForm", (string)null); b.ToTable("Sas_H_ListForm", (string)null);
}); });
@ -3093,7 +3270,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ListFormCode"); b.HasIndex("ListFormCode", "UserId", "RoleId", "CultureName", "FieldName")
.IsUnique();
b.ToTable("Sas_H_ListFormField", (string)null); b.ToTable("Sas_H_ListFormField", (string)null);
}); });
@ -3322,6 +3500,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("Sas_H_Menu", (string)null); b.ToTable("Sas_H_Menu", (string)null);
}); });
@ -3337,6 +3518,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Sas_H_MenuGroup", (string)null); b.ToTable("Sas_H_MenuGroup", (string)null);
}); });
@ -3659,6 +3843,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_PaymentMethod", (string)null); b.ToTable("Sas_H_PaymentMethod", (string)null);
}); });
@ -3731,6 +3919,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Product", (string)null); b.ToTable("Sas_H_Product", (string)null);
}); });
@ -3788,6 +3980,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_ReportCategory", (string)null); b.ToTable("Adm_T_ReportCategory", (string)null);
}); });
@ -3854,6 +4050,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("CategoryId"); b.HasIndex("CategoryId");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_ReportTemplate", (string)null); b.ToTable("Adm_T_ReportTemplate", (string)null);
}); });
@ -3916,6 +4116,14 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Key")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.HasIndex("Path")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Route", (string)null); b.ToTable("Sas_H_Route", (string)null);
}); });
@ -3965,6 +4173,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Sector", (string)null); b.ToTable("Adm_T_Sector", (string)null);
}); });
@ -4025,6 +4237,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Service", (string)null); b.ToTable("Sas_H_Service", (string)null);
}); });
@ -4076,7 +4292,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SkillTypeId"); b.HasIndex("SkillTypeId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Skill", (string)null); b.ToTable("Sas_H_Skill", (string)null);
}); });
@ -4139,7 +4357,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SkillTypeId"); b.HasIndex("SkillTypeId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_SkillLevel", (string)null); b.ToTable("Sas_H_SkillLevel", (string)null);
}); });
@ -4187,6 +4407,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_SkillType", (string)null); b.ToTable("Sas_H_SkillType", (string)null);
}); });
@ -4630,6 +4854,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Title")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Survey", (string)null); b.ToTable("Adm_T_Survey", (string)null);
}); });
@ -4940,6 +5168,10 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("UomCategoryId"); b.HasIndex("UomCategoryId");
b.HasIndex("Name", "UomCategoryId")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_Uom", (string)null); b.ToTable("Sas_H_Uom", (string)null);
}); });
@ -4986,6 +5218,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_H_UomCategory", (string)null); b.ToTable("Sas_H_UomCategory", (string)null);
}); });
@ -5078,9 +5314,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ScheduledStartTime"); b.HasIndex("TenantId", "BranchId", "Name")
.IsUnique()
b.HasIndex("TeacherId"); .HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_Videoroom", (string)null); b.ToTable("Adm_T_Videoroom", (string)null);
}); });
@ -5149,12 +5385,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("JoinTime");
b.HasIndex("SessionId"); b.HasIndex("SessionId");
b.HasIndex("StudentId");
b.ToTable("Adm_T_VideoroomAttandance", (string)null); b.ToTable("Adm_T_VideoroomAttandance", (string)null);
}); });
@ -5235,12 +5467,8 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SenderId");
b.HasIndex("SessionId"); b.HasIndex("SessionId");
b.HasIndex("Timestamp");
b.ToTable("Adm_T_VideoroomChat", (string)null); b.ToTable("Adm_T_VideoroomChat", (string)null);
}); });
@ -5330,12 +5558,6 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("SessionId"); b.HasIndex("SessionId");
b.HasIndex("UserId");
b.HasIndex("SessionId", "UserId")
.IsUnique()
.HasFilter("[UserId] IS NOT NULL");
b.ToTable("Adm_T_VideoroomParticipant", (string)null); b.ToTable("Adm_T_VideoroomParticipant", (string)null);
}); });
@ -5414,6 +5636,10 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Adm_T_WorkHour", (string)null); b.ToTable("Adm_T_WorkHour", (string)null);
}); });
@ -5503,7 +5729,9 @@ namespace Sozsoft.Platform.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("DisplayOrder"); b.HasIndex("Name")
.IsUnique()
.HasFilter("[IsDeleted] = 0");
b.ToTable("Sas_T_ForumCategory", (string)null); b.ToTable("Sas_T_ForumCategory", (string)null);
}); });
@ -5670,10 +5898,6 @@ namespace Sozsoft.Platform.Migrations
b.HasIndex("CategoryId"); b.HasIndex("CategoryId");
b.HasIndex("IsPinned");
b.HasIndex("LastPostDate");
b.ToTable("Sas_T_ForumTopic", (string)null); b.ToTable("Sas_T_ForumTopic", (string)null);
}); });

View file

@ -2033,5 +2033,29 @@
"EventName": "Kültür Gezisi: Kapadokya", "EventName": "Kültür Gezisi: Kapadokya",
"Url": "https://images.unsplash.com/photo-1515405295579-ba7b45403062?w=800" "Url": "https://images.unsplash.com/photo-1515405295579-ba7b45403062?w=800"
} }
],
"Sequences": [
{
"Name": "PurchaseCode1",
"Prefix": "PO",
"Suffix": "",
"PaddingSize": 6,
"IncrementStep": 1,
"StartNumber": 1,
"NextNumber": 1,
"FormatTemplate": "{Prefix}{Number}{Suffix}",
"ResetPeriod": "None"
},
{
"Name": "PurchaseCode2",
"Prefix": "PO",
"Suffix": "",
"PaddingSize": 5,
"IncrementStep": 1,
"StartNumber": 1,
"NextNumber": 1,
"FormatTemplate": "{Prefix}-{yyyy}{MM}{dd}-{Number}",
"ResetPeriod": "Daily"
}
] ]
} }

View file

@ -16,6 +16,7 @@ using System.Collections.Generic;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Sozsoft.Platform.Extensions; using Sozsoft.Platform.Extensions;
using System.Linq; using System.Linq;
using Sozsoft.Platform.Enums;
namespace Sozsoft.Platform.Data.Seeds; namespace Sozsoft.Platform.Data.Seeds;
@ -25,6 +26,7 @@ public class TenantSeederDto
public List<GlobalSearchSeedDto> GlobalSearch { get; set; } public List<GlobalSearchSeedDto> GlobalSearch { get; set; }
public List<CustomEndpointSeedDto> CustomEndpoints { get; set; } public List<CustomEndpointSeedDto> CustomEndpoints { get; set; }
public List<CustomComponentSeedDto> CustomComponents { get; set; } public List<CustomComponentSeedDto> CustomComponents { get; set; }
public List<SequenceSeedDto> Sequences { get; set; }
//Definitions //Definitions
public List<SectorSeedDto> Sectors { get; set; } public List<SectorSeedDto> Sectors { get; set; }
@ -72,6 +74,19 @@ public class TenantSeederDto
public List<EventCommentSeedDto> EventComments { get; set; } public List<EventCommentSeedDto> EventComments { get; set; }
} }
public class SequenceSeedDto
{
public string Name { get; set; } = null!;
public string? Prefix { get; set; }
public string? Suffix { get; set; }
public int PaddingSize { get; set; } = 5;
public int IncrementStep { get; set; } = 1;
public long StartNumber { get; set; } = 1;
public long NextNumber { get; set; } = 1;
public string? FormatTemplate { get; set; }
public SequenceResetPeriod ResetPeriod { get; set; } = SequenceResetPeriod.None;
}
public class SocialPostSeedDto public class SocialPostSeedDto
{ {
public string Content { get; set; } public string Content { get; set; }
@ -455,6 +470,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
private readonly IRepository<SocialPollOption, Guid> _socialPollOptionRepository; private readonly IRepository<SocialPollOption, Guid> _socialPollOptionRepository;
private readonly IRepository<SocialComment, Guid> _socialCommentRepository; private readonly IRepository<SocialComment, Guid> _socialCommentRepository;
private readonly IRepository<SocialLike, Guid> _socialLikeRepository; private readonly IRepository<SocialLike, Guid> _socialLikeRepository;
private readonly IRepository<Sequence, Guid> _sequenceRepository;
private readonly IRepository<EventType, Guid> _eventTypeRepository; private readonly IRepository<EventType, Guid> _eventTypeRepository;
private readonly IRepository<EventCategory, Guid> _eventCategoryRepository; private readonly IRepository<EventCategory, Guid> _eventCategoryRepository;
@ -505,6 +521,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
IRepository<EventType, Guid> eventTypeRepository, IRepository<EventType, Guid> eventTypeRepository,
IRepository<EventCategory, Guid> eventCategoryRepository, IRepository<EventCategory, Guid> eventCategoryRepository,
IRepository<Event, Guid> eventRepository, IRepository<Event, Guid> eventRepository,
IRepository<Sequence, Guid> sequenceRepository,
OrganizationUnitManager organizationUnitManager, OrganizationUnitManager organizationUnitManager,
ICurrentTenant currentTenant ICurrentTenant currentTenant
@ -551,6 +568,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
_eventTypeRepository = eventTypeRepository; _eventTypeRepository = eventTypeRepository;
_eventCategoryRepository = eventCategoryRepository; _eventCategoryRepository = eventCategoryRepository;
_eventRepository = eventRepository; _eventRepository = eventRepository;
_sequenceRepository = sequenceRepository;
_organizationUnitManager = organizationUnitManager; _organizationUnitManager = organizationUnitManager;
_currentTenant = currentTenant; _currentTenant = currentTenant;
} }
@ -1220,6 +1238,39 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
} }
} }
foreach (var item in items.Sequences)
{
var exists = await _sequenceRepository.AnyAsync(x => x.Name == item.Name);
if (!exists)
{
await _sequenceRepository.InsertAsync(
new Sequence
{
Name = item.Name,
Prefix = item.Prefix,
Suffix = item.Suffix,
PaddingSize = item.PaddingSize,
IncrementStep = item.IncrementStep,
StartNumber = item.StartNumber,
NextNumber = item.NextNumber,
FormatTemplate = string.IsNullOrWhiteSpace(item.FormatTemplate)
? "{Prefix}{Number}{Suffix}"
: item.FormatTemplate,
ResetPeriod = item.ResetPeriod,
IsActive = true
},
autoSave: true
);
}
}
//admin kullanının departmen ve pozisyonunu default olarak belirliyoruz //admin kullanının departmen ve pozisyonunu default olarak belirliyoruz
var adminUser = await _repositoryUser.FindByNormalizedEmailAsync(PlatformConsts.AbpIdentity.User.AdminEmailDefaultValue); var adminUser = await _repositoryUser.FindByNormalizedEmailAsync(PlatformConsts.AbpIdentity.User.AdminEmailDefaultValue);
if (adminUser != null) if (adminUser != null)

View file

@ -122,6 +122,7 @@ export enum FieldCustomValueTypeEnum {
CustomKey = 2, CustomKey = 2,
DbQuery = 3, DbQuery = 3,
QueryParams = 4, QueryParams = 4,
Sequence = 5,
} }
export enum ColumnValidationTypeListEnum { export enum ColumnValidationTypeListEnum {
@ -238,6 +239,7 @@ export interface ColumnFormatDto extends AuditedEntityDto<string> {
canUpdate: boolean canUpdate: boolean
canExport: boolean canExport: boolean
defaultValue: object defaultValue: object
defaultValueType: FieldCustomValueTypeEnum
pivotSettingsJson?: string pivotSettingsJson?: string
pivotSettingsDto: ListFormFieldPivotSettingsDto pivotSettingsDto: ListFormFieldPivotSettingsDto
alignment?: HorizontalAlignment alignment?: HorizontalAlignment

View file

@ -1,5 +1,4 @@
import { AxiosError, Method } from 'axios' import { AxiosError, Method } from 'axios'
import { URLSearchParams } from 'url'
import { GridDto } from '../proxy/form/models' import { GridDto } from '../proxy/form/models'
import apiService from './api.service' import apiService from './api.service'
@ -17,6 +16,14 @@ export const getList = (data: Record<string, string>) => {
} }
} }
export const getNextSequenceValue = (sequenceName: string) => {
return apiService.fetchData<string>({
method: 'GET',
url: '/api/app/list-form-select/next-sequence-value',
params: { sequenceName },
})
}
export const dynamicFetch = ( export const dynamicFetch = (
url: string, url: string,
method: Method | string, method: Method | string,

View file

@ -216,20 +216,27 @@ function JsonRowOpDialogDatabase({
component={Input} component={Input}
/> />
</FormItem> </FormItem>
<FormItem {values.customValueType === FieldCustomValueTypeEnum.DbQuery && (
label={translate('::ListForms.ListFormEdit.SqlQuery')} <FormItem
invalid={errors.sqlQuery && touched.sqlQuery} label={translate('::ListForms.ListFormEdit.SqlQuery')}
errorMessage={errors.sqlQuery} invalid={errors.sqlQuery && touched.sqlQuery}
> errorMessage={errors.sqlQuery}
<Field className={
type="text" values.customValueType !== FieldCustomValueTypeEnum.DbQuery
autoComplete="off" ? 'hidden'
name="sqlQuery" : ''
placeholder={translate('::ListForms.ListFormEdit.SqlQuery')} }
component={Input} >
textArea={true} <Field
/> type="text"
</FormItem> autoComplete="off"
name="sqlQuery"
placeholder={translate('::ListForms.ListFormEdit.SqlQuery')}
component={Input}
textArea={true}
/>
</FormItem>
)}
</div> </div>
<div className="text-right mt-4"> <div className="text-right mt-4">
<Button className="ltr:mr-2 rtl:ml-2" variant="plain" onClick={handleClose}> <Button className="ltr:mr-2 rtl:ml-2" variant="plain" onClick={handleClose}>

View file

@ -136,6 +136,7 @@ export const customValueTypeOptions = [
{ value: 2, label: 'CustomKey' }, { value: 2, label: 'CustomKey' },
{ value: 3, label: 'DbQuery' }, { value: 3, label: 'DbQuery' },
{ value: 4, label: 'QueryParams' }, { value: 4, label: 'QueryParams' },
{ value: 5, label: 'Sequence' },
] ]
export const gridColumnCopyFieldTypeOptions = [ export const gridColumnCopyFieldTypeOptions = [

View file

@ -4,6 +4,7 @@ import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
import { import {
DbTypeEnum, DbTypeEnum,
EditingFormItemDto, EditingFormItemDto,
FieldCustomValueTypeEnum,
GridDto, GridDto,
ListFormCustomizationTypeEnum, ListFormCustomizationTypeEnum,
PlatformEditorTypes, PlatformEditorTypes,
@ -68,7 +69,7 @@ import { useToolbar } from './useToolbar'
import { ImportDashboard } from '@/components/importManager/ImportDashboard' import { ImportDashboard } from '@/components/importManager/ImportDashboard'
import WidgetGroup from '@/components/ui/Widget/WidgetGroup' import WidgetGroup from '@/components/ui/Widget/WidgetGroup'
import { GridExtraFilterToolbar } from './GridExtraFilterToolbar' import { GridExtraFilterToolbar } from './GridExtraFilterToolbar'
import { getList } from '@/services/form.service' import { getList, getNextSequenceValue } from '@/services/form.service'
import { layoutTypes } from '../admin/listForm/edit/types' import { layoutTypes } from '../admin/listForm/edit/types'
import { useListFormCustomDataSource } from './useListFormCustomDataSource' import { useListFormCustomDataSource } from './useListFormCustomDataSource'
import { useListFormColumns } from './useListFormColumns' import { useListFormColumns } from './useListFormColumns'
@ -312,99 +313,125 @@ const Grid = (props: GridProps) => {
setMode('new') setMode('new')
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false) setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
for (const colFormat of gridDto?.columnFormats) { e.promise = (async () => {
if (!colFormat.fieldName) { const rawFilter = searchParams?.get('filter')
continue let filters: any[] = []
}
// Grid'den gelen columnFormat'ları kullanarak default değerleri set et if (rawFilter) {
if (colFormat.defaultValue != null) { try {
if ( const parsed = JSON.parse(rawFilter)
typeof colFormat.defaultValue === 'string' && filters = extractSearchParamsFields(parsed)
colFormat.defaultValue === '@AUTONUMBER' } catch (error) {
) { console.error('Filter parse edilemedi:', error)
e.data[colFormat.fieldName] = autoNumber()
} else {
e.data[colFormat.fieldName] = colFormat.defaultValue
} }
} }
// ExtraFilters içerisinde ilgili Field varsa, default değerleri set etme for (const colFormat of gridDto.columnFormats) {
if (extraFilters.some((f) => f.fieldName === colFormat.fieldName)) { const fieldName = colFormat.fieldName
continue
}
// URL'den veya Component Prop'dan gelen parametreleri set et if (!fieldName) {
if (!searchParams) { continue
continue }
}
const rawFilter = searchParams?.get('filter') // ExtraFilters içerisinde ilgili Field varsa, default değerleri set etme
if (rawFilter) { if (extraFilters.some((f) => f.fieldName === fieldName)) {
const parsed = JSON.parse(rawFilter) continue
const filters = extractSearchParamsFields(parsed) }
const fieldMatch = filters.find(([field]) => field === colFormat.fieldName)
// 1) Önce grid default value set et
if (colFormat.defaultValue !== null && colFormat.defaultValue !== undefined) {
if (
typeof colFormat.defaultValue === 'string' &&
colFormat.defaultValue === '@AUTONUMBER'
) {
e.data[fieldName] = autoNumber()
} else if (colFormat.defaultValueType === FieldCustomValueTypeEnum.Sequence) {
try {
const response = await getNextSequenceValue(String(colFormat.defaultValue))
e.data[fieldName] = response.data
} catch (error) {
console.error('Sequence default value alınamadı:', {
fieldName,
defaultValue: colFormat.defaultValue,
error,
})
}
} else {
e.data[fieldName] = colFormat.defaultValue
}
}
// 2) Sonra URL / prop filter varsa üzerine yaz
const fieldMatch = filters.find(([field]) => field === fieldName)
if (fieldMatch) { if (fieldMatch) {
const val = fieldMatch[2] //value const val = fieldMatch[2]
const dType = colFormat.dataType as DataType const dType = colFormat.dataType as DataType
switch (dType) { switch (dType) {
case 'date': case 'date':
case 'datetime': case 'datetime':
e.data[colFormat.fieldName] = new Date(val) e.data[fieldName] = new Date(val)
break break
case 'number': case 'number':
e.data[colFormat.fieldName] = Number(val) e.data[fieldName] = Number(val)
break break
case 'boolean': case 'boolean':
e.data[colFormat.fieldName] = val === true || val === 'true' e.data[fieldName] = val === true || val === 'true'
break break
case 'object': case 'object':
try { try {
e.data[colFormat.fieldName] = JSON.parse(val) e.data[fieldName] = JSON.parse(val)
} catch {} } catch {
e.data[fieldName] = val
}
break break
default: default:
e.data[colFormat.fieldName] = val e.data[fieldName] = val
break break
} }
} }
} }
} })()
}, },
[gridDto, searchParams, extraFilters], [gridDto, searchParams, extraFilters, getNextSequenceValue],
) )
const onRowInserting = useCallback((e: DataGridTypes.RowInsertingEvent<any, any>) => { const onRowInserting = useCallback((e: DataGridTypes.RowInsertingEvent<any, any>) => {
e.data = setFormEditingExtraItemValues(e.data) if (!gridDto?.columnFormats) {
}, []) e.data = setFormEditingExtraItemValues(e.data)
return
}
const allowedFields = gridDto.columnFormats.filter(f => f.allowAdding).map(f => f.fieldName)
const filteredData: any = {}
for (const key of allowedFields) {
if (e.data.hasOwnProperty(key) && key) {
filteredData[key] = e.data[key]
}
}
e.data = setFormEditingExtraItemValues(filteredData)
}, [gridDto])
const onRowUpdating = useCallback( const onRowUpdating = useCallback(
(e: DataGridTypes.RowUpdatingEvent<any, any>) => { (e: DataGridTypes.RowUpdatingEvent<any, any>) => {
if (gridDto?.gridOptions.editingOptionDto?.sendOnlyChangedFormValuesUpdate) { if (!gridDto?.columnFormats) return
if (Object.keys(e.newData).some((a) => a.includes(':'))) { const allowedFields = gridDto.columnFormats.filter(f => f.allowEditing).map(f => f.fieldName)
Object.keys(e.oldData).forEach((col) => { let newData = { ...e.oldData, ...e.newData }
if (col.includes(':')) { // Remove keys not allowed
e.newData[col] = e.newData[col] ?? e.oldData[col] Object.keys(newData).forEach((key) => {
} if (!allowedFields.includes(key) || key.includes(':')) {
}) delete newData[key]
} }
e.newData = setFormEditingExtraItemValues(e.newData) })
} else { newData = setFormEditingExtraItemValues(newData)
let newData = { ...e.oldData, ...e.newData }
newData = setFormEditingExtraItemValues(newData)
Object.keys(newData).forEach((key) => {
if (key.includes(':')) {
delete newData[key]
}
})
e.newData = newData
}
if (gridDto?.gridOptions.keyFieldName) { if (gridDto?.gridOptions.keyFieldName) {
delete e.newData[gridDto?.gridOptions.keyFieldName] delete newData[gridDto?.gridOptions.keyFieldName]
} }
e.newData = newData
}, },
[gridDto], [gridDto],
) )
@ -415,6 +442,7 @@ const Grid = (props: GridProps) => {
setMode('edit') setMode('edit')
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false) setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
const columns = e.component.option('columns') as GridColumnData[] const columns = e.component.option('columns') as GridColumnData[]
// FormEditingExtraItem field ise datayı doldur // FormEditingExtraItem field ise datayı doldur
columns?.forEach((col) => { columns?.forEach((col) => {
if (!col.dataField?.includes(':')) { if (!col.dataField?.includes(':')) {
@ -424,6 +452,7 @@ const Grid = (props: GridProps) => {
if (!e.data[field[0]]) { if (!e.data[field[0]]) {
return return
} }
const json = JSON.parse(e.data[field[0]]) const json = JSON.parse(e.data[field[0]])
e.data[col.dataField] = json[field[1]] e.data[col.dataField] = json[field[1]]
}) })
@ -1102,7 +1131,7 @@ const Grid = (props: GridProps) => {
<Helmet <Helmet
titleTemplate={`%s | ${APP_NAME}`} titleTemplate={`%s | ${APP_NAME}`}
title={translate('::' + gridDto?.gridOptions.title)} title={translate('::' + gridDto?.gridOptions.title)}
defaultTitle={APP_NAME} defaultTitle={APP_NAME}
></Helmet> ></Helmet>
)} )}
{!gridDto && ( {!gridDto && (