From b050f13d64084d7a2b3185bb02803ced364bb2b3 Mon Sep 17 00:00:00 2001 From: Somaraj <17797942+somaraj@users.noreply.github.com> Date: Fri, 13 Nov 2026 14:52:43 +0530 Subject: [PATCH 1/2] feat(backlog): place custom fields anywhere on the task form Custom fields get a position (after any built-in field in either column) and an order number. New nullable CustomField.Slot/DisplayOrder columns (migration AddCustomFieldSlot); a null slot keeps the old bottom-of-section placement, so existing fields don't move. Also: custom-field script moved to backlog-custom-fields.js (bound once), checkbox/radio labels and saving, non-mandatory fields save on change, posted values kept on Create errors, label fallback when no locale row exists, UpdateCustomField requires edit rights, ion.rangeSlider path casing. --- CHANGELOG.md | 3 + sql-scripts/01_schema.sql | 29 + sql-scripts/03_locale.sql | 30 +- .../Taskist.Core/Common/CustomFieldLayout.cs | 57 + .../Domain/Masters/CustomField.cs | 4 + .../Taskist.Core/Enums/BacklogFormSlot.cs | 22 + ...61113050423_AddCustomFieldSlot.Designer.cs | 3503 +++++++++++++++++ .../20261113050423_AddCustomFieldSlot.cs | 38 + .../ApplicationContextModelSnapshot.cs | 6 + .../Masters/CustomFieldService.cs | 8 +- .../Components/WorkItems/CustomFields.cs | 54 - .../Controllers/Masters/ProjectController.cs | 51 +- .../WorkItems/BacklogController.cs | 42 +- .../Helpers/Mapping/MastersMapper.cs | 3 + .../Masters/CustomFieldValidator.cs | 11 +- .../Models/Masters/CustomFieldGridModel.cs | 21 + .../Models/Masters/CustomFieldLayoutModel.cs | 27 + .../Models/Masters/CustomFieldModel.cs | 22 +- .../Models/Masters/CustomFieldRenderModel.cs | 6 + .../Models/Masters/CustomFieldsViewModel.cs | 7 +- .../Models/WorkItems/BacklogModel.cs | 4 + .../Taskist.Web/Views/Backlog/Create.cshtml | 5 +- .../Taskist.Web/Views/Backlog/Edit.cshtml | 5 +- .../Views/Backlog/_CustomFieldSlot.cshtml | 88 + .../Taskist.Web/Views/Backlog/_Form.cshtml | 8 +- .../Views/Backlog/_FormStatus.cshtml | 15 +- .../Views/Project/AddCustomField.cshtml | 4 + .../Views/Project/CustomFields.cshtml | 3 +- .../Views/Project/EditCustomField.cshtml | 4 + .../Views/Project/_FormCustomField.cshtml | 30 +- .../Components/CustomFields/Default.cshtml | 137 - .../wwwroot/css/pages/backlog-task.css | 6 +- .../js/pages/backlog/backlog-custom-fields.js | 71 + .../js/pages/masters/custom-field-form.js | 13 + .../WorkItems/CustomFieldLayoutTests.cs | 171 + 35 files changed, 4261 insertions(+), 247 deletions(-) create mode 100644 src/Libraries/Taskist.Core/Common/CustomFieldLayout.cs create mode 100644 src/Libraries/Taskist.Core/Enums/BacklogFormSlot.cs create mode 100644 src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.Designer.cs create mode 100644 src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.cs delete mode 100644 src/Presentation/Taskist.Web/Components/WorkItems/CustomFields.cs create mode 100644 src/Presentation/Taskist.Web/Models/Masters/CustomFieldGridModel.cs create mode 100644 src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs create mode 100644 src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml delete mode 100644 src/Presentation/Taskist.Web/Views/Shared/Components/CustomFields/Default.cshtml create mode 100644 src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js create mode 100644 src/Presentation/Taskist.Web/wwwroot/js/pages/masters/custom-field-form.js create mode 100644 src/Tests/Taskist.Tests/WorkItems/CustomFieldLayoutTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index abb6bef..ab7cb89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Each release lists **Upgrade notes** when an install needs action beyond the ste - **Appearance**: light, dark or system theme and an accent colour per user. - **Per-user export column layouts** on top of the administrator's default. - **Tags** for the backlog, with inline create and merge. +- **Custom field positions**: a project's custom fields can be placed anywhere on the task form (after Title, Description, Attachments, or after any field in the right panel, such as Status, Module or Developer), with an order number within each position. Existing fields stay at the bottom of their section until moved. - **Two-factor sign-in** with any authenticator app (TOTP), turned on per user under My profile → Security: QR-code setup, ten one-time recovery codes, an optional "don't ask again on this device" (`Authentication:TwoFactor:RememberDeviceDays`, default 30), and administrator reset on the user's page. `Authentication:TwoFactor:RequireForAdministrators` (off by default) makes it mandatory for administrators who sign in with a password. Single sign-on users are not asked, since their identity provider handles it. See [docs/two-factor.md](docs/two-factor.md). ([#12](https://github.com/Taskist/taskist/issues/12)) - **Single sign-on with OpenID Connect** (`Authentication:Oidc`, off by default): Keycloak, Authentik, Entra ID, Google, Okta and other providers. Existing users are linked by verified e-mail; optional account creation on first sign-in (*Registered* role only), optional group → role mapping (adds roles only), and an SSO-only mode that keeps password sign-in for administrators at `/Login?local=1`. Linked sign-ins are listed under My profile → Security and on the user's admin page. See [docs/sso.md](docs/sso.md). ([#11](https://github.com/Taskist/taskist/issues/11)) - **Optional Sentry error tracking** (`Sentry:Enabled` + `Sentry:Dsn`, off by default): unhandled exceptions and logged errors, with request bodies, cookies, query strings, auth headers and personal data filtered out. @@ -34,9 +35,11 @@ Each release lists **Upgrade notes** when an install needs action beyond the ste - Seed data moved from the install wizard to four idempotent scripts in `sql-scripts/`: schema, defaults, translations and optional sample data. A fresh install now also gets the email templates, using an inactive placeholder email account. - Docker images target .NET 10; the migrate container runs `sql-scripts/02`–`04`. - E-mails fill `%company%` from **Configuration → Settings → Company name** (falls back to "Taskist"). +- Custom fields: checkbox and radio fields now have a label and save on the edit page, every field saves when changed (previously only mandatory ones did), dropdowns start empty instead of preselecting the first option, a field without a translation shows its label instead of its resource key, and values typed on Create are kept when the form returns with an error. ### Security +- Saving a single custom field value (`Backlog/UpdateCustomField`) now requires edit rights on the task, like the rest of the task form. - Wiki reads (content, tree, history, linked tasks, Word export) are limited to members of the page's project; previously any signed-in user could read any project's pages by id. Restoring a version now requires the version to belong to the page, and pages and folders can no longer be moved into another project or into their own sub-folders. - Wiki images are recorded against their page's project at upload and served only to the uploader and that project's members; previously any user with the Wiki permission could fetch any stored image (including other projects' wiki images, profile photos and unsaved task uploads) by id. - Task attachments are access-checked on download, upload and delete, uploads require the antiforgery token, and files are served as downloads with `nosniff`. diff --git a/sql-scripts/01_schema.sql b/sql-scripts/01_schema.sql index ae64a1a..d85fb5f 100644 --- a/sql-scripts/01_schema.sql +++ b/sql-scripts/01_schema.sql @@ -2093,3 +2093,32 @@ END; COMMIT; GO +BEGIN TRANSACTION; +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'20261113050423_AddCustomFieldSlot' +) +BEGIN + ALTER TABLE [CustomField] ADD [DisplayOrder] int NULL; +END; + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'20261113050423_AddCustomFieldSlot' +) +BEGIN + ALTER TABLE [CustomField] ADD [Slot] int NULL; +END; + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'20261113050423_AddCustomFieldSlot' +) +BEGIN + INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) + VALUES (N'20261113050423_AddCustomFieldSlot', N'10.0.13'); +END; + +COMMIT; +GO + diff --git a/sql-scripts/03_locale.sql b/sql-scripts/03_locale.sql index 87633ec..1bf003c 100644 --- a/sql-scripts/03_locale.sql +++ b/sql-scripts/03_locale.sql @@ -214,6 +214,25 @@ FROM (VALUES (N'BacklogFilter.ShowInactive', N'Show inactive'), (N'BacklogFilter.Stale', N'Stale: 7+ days in the same status'), (N'BacklogFilter.StatusDaysMin', N'In current status for at least (days)'), + (N'BacklogFormSlot.Group.Main', N'Main column'), + (N'BacklogFormSlot.Group.Status', N'Right panel'), + (N'BacklogFormSlot.MainAfterAttachments', N'After Attachments'), + (N'BacklogFormSlot.MainAfterDescription', N'After Description'), + (N'BacklogFormSlot.MainAfterTitle', N'After Title'), + (N'BacklogFormSlot.MainBottom', N'Bottom of the main column'), + (N'BacklogFormSlot.StatusAfterDeveloper', N'After Developer'), + (N'BacklogFormSlot.StatusAfterDueDate', N'After Due date'), + (N'BacklogFormSlot.StatusAfterModule', N'After Module'), + (N'BacklogFormSlot.StatusAfterPriority', N'After Priority'), + (N'BacklogFormSlot.StatusAfterProject', N'After Project'), + (N'BacklogFormSlot.StatusAfterRelease', N'After Release'), + (N'BacklogFormSlot.StatusAfterReporter', N'After Reporter'), + (N'BacklogFormSlot.StatusAfterStartDate', N'After Start date'), + (N'BacklogFormSlot.StatusAfterStatus', N'After Status'), + (N'BacklogFormSlot.StatusAfterSubModule', N'After Sub-module'), + (N'BacklogFormSlot.StatusAfterTaskType', N'After Type'), + (N'BacklogFormSlot.StatusAfterTester', N'After Tester'), + (N'BacklogFormSlot.StatusBottom', N'Bottom of the right panel'), (N'BacklogGrid.Age', N'Age'), (N'BacklogGrid.AgeHelp', N'12d · 4d = open for 12 days · 4 days in the current status.
Sort ▼ oldest first, ▲ newest first. Closed tasks show – and are always listed last.'), (N'BacklogGrid.Assignee', N'Developer'), @@ -347,13 +366,17 @@ FROM (VALUES (N'Confirmation.Delete', N'Are you sure you want to delete?'), (N'CustomField.Title', N'Custom Field'), (N'CustomFieldGrid.ColumnClass', N'Column Width'), + (N'CustomFieldGrid.DisplayOrder', N'Order'), (N'CustomFieldGrid.FieldType', N'Type'), (N'CustomFieldGrid.Label', N'Label'), (N'CustomFieldGrid.Mandatory', N'Mandatory'), - (N'CustomFieldGrid.Placement', N'Placement'), (N'CustomFieldGrid.ResourceKey', N'Resource Key'), + (N'CustomFieldGrid.Slot', N'Position'), (N'CustomFieldModel.ColumnClass', N'Column Width'), (N'CustomFieldModel.ColumnClass.RequiredMsg', N'Column width is required'), + (N'CustomFieldModel.DisplayOrder', N'Order'), + (N'CustomFieldModel.DisplayOrder.Hint', N'Order within the chosen position: lower numbers come first. Fields without a number follow the numbered ones.'), + (N'CustomFieldModel.DisplayOrder.RangeMsg', N'Order must be between 0 and 9999'), (N'CustomFieldModel.FieldType', N'Type'), (N'CustomFieldModel.FieldType.RequiredMsg', N'Type is required'), (N'CustomFieldModel.Label', N'Label'), @@ -362,10 +385,11 @@ FROM (VALUES (N'CustomFieldModel.Label.UniqueMsg', N'Label already exists'), (N'CustomFieldModel.Mandatory', N'Mandatory'), (N'CustomFieldModel.Options', N'Options (coma seperated)'), - (N'CustomFieldModel.Placement', N'Placement'), - (N'CustomFieldModel.Placement.RequiredMsg', N'Placement is required'), (N'CustomFieldModel.ResourceKey', N'Resource Key'), (N'CustomFieldModel.ResourceKey.RequiredMsg', N'Resource key is required'), + (N'CustomFieldModel.Slot', N'Position'), + (N'CustomFieldModel.Slot.Hint', N'Where the field appears on the task form, between the built-in fields.'), + (N'CustomFieldModel.Slot.RequiredMsg', N'Position is required'), (N'Dashboard.AllProjects', N'All Projects'), (N'Dashboard.AssigneeWorkload', N'Assignee Workload'), (N'Dashboard.CreatedVsResolved', N'Created vs Resolved'), diff --git a/src/Libraries/Taskist.Core/Common/CustomFieldLayout.cs b/src/Libraries/Taskist.Core/Common/CustomFieldLayout.cs new file mode 100644 index 0000000..9a00b7d --- /dev/null +++ b/src/Libraries/Taskist.Core/Common/CustomFieldLayout.cs @@ -0,0 +1,57 @@ +using Taskist.Core.Domain.Masters; +using Taskist.Core.Enums; + +namespace Taskist.Core.Common; + +public static class CustomFieldLayout +{ + #region Fields + + private const int StatusSectionStart = 100; + + #endregion + + #region Methods + + public static BacklogFormSlot ResolveSlot(int? slot, int placement) + { + if (slot.HasValue && Enum.IsDefined(typeof(BacklogFormSlot), slot.Value)) + return (BacklogFormSlot)slot.Value; + + return placement == (int)CustomFieldPlacement.StatusSection + ? BacklogFormSlot.StatusBottom + : BacklogFormSlot.MainBottom; + } + + public static CustomFieldPlacement SectionOf(BacklogFormSlot slot) + { + return (int)slot >= StatusSectionStart + ? CustomFieldPlacement.StatusSection + : CustomFieldPlacement.MainSection; + } + + public static bool RendersInsideStatusRow(BacklogFormSlot slot) + { + return SectionOf(slot) == CustomFieldPlacement.StatusSection && slot != BacklogFormSlot.StatusBottom; + } + + public static IList Order(IEnumerable fields) + { + return (fields ?? []) + .Where(x => x != null) + .OrderBy(x => (int)ResolveSlot(x.Slot, x.Placement)) + .ThenBy(x => x.DisplayOrder ?? int.MaxValue) + .ThenBy(x => x.Id) + .ToList(); + } + + public static IReadOnlyList SlotsIn(CustomFieldPlacement section) + { + return Enum.GetValues() + .Where(x => SectionOf(x) == section) + .OrderBy(x => (int)x) + .ToList(); + } + + #endregion +} diff --git a/src/Libraries/Taskist.Core/Domain/Masters/CustomField.cs b/src/Libraries/Taskist.Core/Domain/Masters/CustomField.cs index 3f29864..9d9c4d0 100644 --- a/src/Libraries/Taskist.Core/Domain/Masters/CustomField.cs +++ b/src/Libraries/Taskist.Core/Domain/Masters/CustomField.cs @@ -20,6 +20,10 @@ public class CustomField : BaseEntity, IAuditableEntity public int Placement { get; set; } + public int? Slot { get; set; } + + public int? DisplayOrder { get; set; } + public virtual Project Project { get; set; } } } diff --git a/src/Libraries/Taskist.Core/Enums/BacklogFormSlot.cs b/src/Libraries/Taskist.Core/Enums/BacklogFormSlot.cs new file mode 100644 index 0000000..222699f --- /dev/null +++ b/src/Libraries/Taskist.Core/Enums/BacklogFormSlot.cs @@ -0,0 +1,22 @@ +namespace Taskist.Core.Enums; + +public enum BacklogFormSlot +{ + MainAfterTitle = 10, + MainAfterDescription = 20, + MainAfterAttachments = 30, + MainBottom = 40, + StatusAfterProject = 110, + StatusAfterStatus = 120, + StatusAfterModule = 130, + StatusAfterSubModule = 140, + StatusAfterTaskType = 150, + StatusAfterPriority = 160, + StatusAfterReporter = 170, + StatusAfterDeveloper = 180, + StatusAfterTester = 190, + StatusAfterStartDate = 200, + StatusAfterDueDate = 210, + StatusAfterRelease = 220, + StatusBottom = 230 +} diff --git a/src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.Designer.cs b/src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.Designer.cs new file mode 100644 index 0000000..4da1eb8 --- /dev/null +++ b/src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.Designer.cs @@ -0,0 +1,3503 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Taskist.Data; + +#nullable disable + +namespace Taskist.Data.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20261113050423_AddCustomFieldSlot")] + partial class AddCustomFieldSlot + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Taskist.Core.Domain.Announcements.Announcement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Audience") + .HasColumnType("int"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("RequiresAcknowledgement") + .HasColumnType("bit"); + + b.Property("Severity") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("ValidFrom") + .HasColumnType("date"); + + b.Property("ValidTo") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.HasIndex("Active", "Deleted"); + + b.ToTable("Announcement", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Announcements.AnnouncementAcknowledgement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AcknowledgedOnUtc") + .HasColumnType("datetime2"); + + b.Property("AnnouncementId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("AnnouncementId", "UserId") + .IsUnique(); + + b.ToTable("AnnouncementAcknowledgement", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Announcements.AnnouncementRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AnnouncementId") + .HasColumnType("int"); + + b.Property("UserRoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserRoleId"); + + b.HasIndex("AnnouncementId", "UserRoleId"); + + b.ToTable("AnnouncementRole", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.ExternalCommentLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogCommentId") + .HasColumnType("int"); + + b.Property("ContentHash") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExternalCommentId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExternalIssueLinkId") + .HasColumnType("int"); + + b.Property("Inbound") + .HasColumnType("bit"); + + b.Property("LastSyncedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("BacklogCommentId"); + + b.HasIndex("ExternalIssueLinkId", "ExternalCommentId") + .IsUnique(); + + b.ToTable("ExternalCommentLink", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.ExternalIssueLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("ExternalId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("LastSyncedOn") + .HasColumnType("datetime2"); + + b.Property("Number") + .HasColumnType("int"); + + b.Property("ProjectRepositoryId") + .HasColumnType("int"); + + b.Property("RemoteState") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("RemoteUpdatedOn") + .HasColumnType("datetime2"); + + b.Property("Snapshot") + .HasColumnType("nvarchar(max)"); + + b.Property("SyncEnabled") + .HasColumnType("bit"); + + b.Property("Url") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("BacklogId"); + + b.HasIndex("ProjectRepositoryId", "Number") + .IsUnique(); + + b.ToTable("ExternalIssueLink", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.GitConnection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("AllowInsecureHttp") + .HasColumnType("bit"); + + b.Property("ApiUrl") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("AppId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AppPrivateKey") + .HasColumnType("nvarchar(max)"); + + b.Property("AuthMode") + .HasColumnType("int"); + + b.Property("BaseUrl") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("OAuthClientId") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("OAuthClientSecret") + .HasColumnType("nvarchar(max)"); + + b.Property("ProviderType") + .HasColumnType("int"); + + b.Property("ServiceAccountExternalId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ServiceAccountUserName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ServiceToken") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GitConnection", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.GitWebhookDelivery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Attempts") + .HasColumnType("int"); + + b.Property("DeliveryId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("EventName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Payload") + .HasColumnType("nvarchar(max)"); + + b.Property("ProcessedOn") + .HasColumnType("datetime2"); + + b.Property("ProjectRepositoryId") + .HasColumnType("int"); + + b.Property("ReceivedOn") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ReceivedOn"); + + b.HasIndex("ProjectRepositoryId", "DeliveryId") + .IsUnique(); + + b.ToTable("GitWebhookDelivery", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.ProjectRepository", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DefaultBranch") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("DisplayName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ExternalRepoId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("GitConnectionId") + .HasColumnType("int"); + + b.Property("IsPrimary") + .HasColumnType("bit"); + + b.Property("IsPrivate") + .HasColumnType("bit"); + + b.Property("IssueClosedStatusId") + .HasColumnType("int"); + + b.Property("IssueImportLabel") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IssueImportLimitPerHour") + .HasColumnType("int"); + + b.Property("IssueLastPolledOn") + .HasColumnType("datetime2"); + + b.Property("IssueOpenStatusId") + .HasColumnType("int"); + + b.Property("IssueSeverityId") + .HasColumnType("int"); + + b.Property("IssueSyncComments") + .HasColumnType("bit"); + + b.Property("IssueSyncEnabledOn") + .HasColumnType("datetime2"); + + b.Property("IssueSyncMode") + .HasColumnType("int"); + + b.Property("IssueSyncTaskTypeIds") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("IssueSyncUserId") + .HasColumnType("int"); + + b.Property("IssueTaskTypeId") + .HasColumnType("int"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("RepoRef") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("WebUrl") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("WebhookKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("WebhookLastDeliveryOn") + .HasColumnType("datetime2"); + + b.Property("WebhookSecret") + .HasColumnType("nvarchar(max)"); + + b.Property("WebhookSecretCreatedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("GitConnectionId"); + + b.HasIndex("IssueClosedStatusId"); + + b.HasIndex("IssueOpenStatusId"); + + b.HasIndex("IssueSeverityId"); + + b.HasIndex("IssueSyncUserId"); + + b.HasIndex("IssueTaskTypeId"); + + b.HasIndex("WebhookKey") + .IsUnique(); + + b.HasIndex("ProjectId", "GitConnectionId", "RepoRef"); + + b.ToTable("ProjectRepository", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.UserGitAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AccessToken") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ConnectedOn") + .HasColumnType("datetime2"); + + b.Property("DisplayName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ExpiresOn") + .HasColumnType("datetime2"); + + b.Property("ExternalUserId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("GitConnectionId") + .HasColumnType("int"); + + b.Property("LastUsedOn") + .HasColumnType("datetime2"); + + b.Property("RefreshExpiresOn") + .HasColumnType("datetime2"); + + b.Property("RefreshToken") + .HasColumnType("nvarchar(max)"); + + b.Property("Scopes") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("TokenType") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("GitConnectionId", "ExternalUserId") + .IsUnique(); + + b.HasIndex("UserId", "GitConnectionId") + .IsUnique(); + + b.ToTable("UserGitAccount", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Localization.Language", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(750) + .HasColumnType("nvarchar(750)"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("LanguageCulture") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(750) + .HasColumnType("nvarchar(750)"); + + b.Property("Rtl") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("Language", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Localization.LocaleResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("LanguageId") + .HasColumnType("int"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ResourceValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("LanguageId"); + + b.ToTable("LocaleResource", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Logging.ActivityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOnUtc") + .HasColumnType("datetime2"); + + b.Property("EntityId") + .HasColumnType("int"); + + b.Property("EntityName") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IpAddress") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SystemName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("ActivityLog", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Logging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Action") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("CreatedOnUtc") + .HasColumnType("datetime2"); + + b.Property("EntityId") + .HasColumnType("int"); + + b.Property("EntityName") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IpAddress") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewValues") + .HasColumnType("nvarchar(max)"); + + b.Property("OldValues") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EntityName", "EntityId"); + + b.ToTable("AuditLog", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Logging.Log", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOnUtc") + .HasColumnType("datetime2"); + + b.Property("FullMessage") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IpAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("LogLevel") + .HasColumnType("int"); + + b.Property("LogLevelId") + .HasColumnType("int"); + + b.Property("PageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ReferrerUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ShortMessage") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Log", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address1") + .IsRequired() + .HasMaxLength(750) + .HasColumnType("nvarchar(750)"); + + b.Property("Address2") + .HasMaxLength(750) + .HasColumnType("nvarchar(750)"); + + b.Property("City") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipPostalCode") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.ToTable("Address", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("ContactPerson") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Email") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("PhoneNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Website") + .HasMaxLength(750) + .HasColumnType("nvarchar(750)"); + + b.HasKey("Id"); + + b.ToTable("Client", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.CustomField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ColumnClass") + .HasMaxLength(20) + .HasColumnType("int"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("FieldType") + .HasColumnType("int"); + + b.Property("Label") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Mandatory") + .HasColumnType("bit"); + + b.Property("Options") + .HasColumnType("nvarchar(max)"); + + b.Property("Placement") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ResourceKey") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Slot") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("CustomField", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("varbinary(max)"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("Document", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.EmailAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("EnableSsl") + .HasColumnType("bit"); + + b.Property("FromEmail") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FromName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Host") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Port") + .HasColumnType("int"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("EmailAccount", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.EmailTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("EmailAccountId") + .HasColumnType("int"); + + b.Property("EmailBody") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EmailSubject") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("EmailAccountId"); + + b.ToTable("EmailTemplate", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.GenericAttribute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOrUpdatedDate") + .HasColumnType("datetime2"); + + b.Property("EntityId") + .HasColumnType("int"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("KeyGroup") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GenericAttribute", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ActionName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("ControllerName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("Icon") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ParentCode") + .HasColumnType("int"); + + b.Property("Permission") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SystemName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Menu", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Module", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.NotificationChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("ChannelType") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("EndpointUrl") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("LastSentOn") + .HasColumnType("datetime2"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SigningSecret") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("NotificationChannel", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("CodeReviewerId") + .HasColumnType("int"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("EndDate") + .HasColumnType("date"); + + b.Property("GitProjectReference") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProjectManagerId") + .HasColumnType("int"); + + b.Property("ReleaseFullIncrement") + .HasColumnType("int"); + + b.Property("ReleaseVersionFormat") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("StartDate") + .HasColumnType("date"); + + b.Property("TeamLeadId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("CodeReviewerId"); + + b.HasIndex("ProjectManagerId"); + + b.HasIndex("TeamLeadId"); + + b.ToTable("Project", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.ProjectNotificationChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Events") + .HasColumnType("int"); + + b.Property("NotificationChannelId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NotificationChannelId"); + + b.HasIndex("ProjectId", "NotificationChannelId") + .IsUnique(); + + b.ToTable("ProjectNotificationChannel", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Reporter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Reporter", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Setting", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Severity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("BackgroundColor") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.Property("IconClass") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TextColor") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.ToTable("Severity", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Status", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("BackgroundColor") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ExternalUse") + .HasColumnType("bit"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.Property("IconClass") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("RequiredMrNumberForBug") + .HasColumnType("bit"); + + b.Property("RequiredMrNumberForCr") + .HasColumnType("bit"); + + b.Property("RequiredResolutionForBug") + .HasColumnType("bit"); + + b.Property("RequiredResolutionForCr") + .HasColumnType("bit"); + + b.Property("RequiredRootCauseForBug") + .HasColumnType("bit"); + + b.Property("RequiredRootCauseForCr") + .HasColumnType("bit"); + + b.Property("SystemDefined") + .HasColumnType("bit"); + + b.Property("TextColor") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Status", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.SubModule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("OwnerId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.HasIndex("OwnerId"); + + b.ToTable("SubModule", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Tag", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.TaskType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("BackgroundColor") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.Property("IconClass") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TextColor") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.ToTable("TaskType", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddressId") + .HasColumnType("int"); + + b.Property("Code") + .HasColumnType("uniqueidentifier"); + + b.Property("DateOfBirth") + .HasColumnType("date"); + + b.Property("DateOfJoin") + .HasColumnType("date"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("FailedLoginAttempts") + .HasColumnType("int"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("FriendlyName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GenderId") + .HasColumnType("int"); + + b.Property("GitUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LanguageId") + .HasColumnType("int"); + + b.Property("LastActivityDate") + .HasColumnType("datetime2"); + + b.Property("LastIPAddress") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastLoginDate") + .HasColumnType("datetime2"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Locked") + .HasColumnType("bit"); + + b.Property("MaritalStatus") + .HasColumnType("int"); + + b.Property("MobileNumber") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("PhotoDocumentId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SystemAccount") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("LanguageId"); + + b.ToTable("User", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserExternalLogin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("LastUsedOn") + .HasColumnType("datetime2"); + + b.Property("Provider") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Subject") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("Provider", "Subject") + .IsUnique(); + + b.ToTable("UserExternalLogin", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOnUtc") + .HasColumnType("datetime2"); + + b.Property("DedupeKey") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("IsRead") + .HasColumnType("bit"); + + b.Property("Message") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ReadOnUtc") + .HasColumnType("datetime2"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("Url") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "DedupeKey"); + + b.HasIndex("UserId", "IsRead", "CreatedOnUtc"); + + b.ToTable("UserNotification", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserPassword", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PasswordSalt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserPassword", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserProjectMap", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CanAddWiki") + .HasColumnType("bit"); + + b.Property("CanChangeProject") + .HasColumnType("bit"); + + b.Property("CanClose") + .HasColumnType("bit"); + + b.Property("CanComment") + .HasColumnType("bit"); + + b.Property("CanDeleteTask") + .HasColumnType("bit"); + + b.Property("CanEdit") + .HasColumnType("bit"); + + b.Property("CanEditOthersTask") + .HasColumnType("bit"); + + b.Property("CanMergeMergeRequests") + .HasColumnType("bit"); + + b.Property("CanReOpen") + .HasColumnType("bit"); + + b.Property("CanReportBug") + .HasColumnType("bit"); + + b.Property("CanReportCR") + .HasColumnType("bit"); + + b.Property("CanReportToDo") + .HasColumnType("bit"); + + b.Property("CanReviewMergeRequests") + .HasColumnType("bit"); + + b.Property("CanViewOthersTask") + .HasColumnType("bit"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProjectMap", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRecoveryCode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CodeHash") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("UsedOn") + .HasColumnType("datetime2"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserRecoveryCode", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SystemDefined") + .HasColumnType("bit"); + + b.Property("SystemName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("UserRole", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRoleMap", b => + { + b.Property("UserId") + .HasColumnType("int"); + + b.Property("UserRoleId") + .HasColumnType("int"); + + b.HasKey("UserId", "UserRoleId"); + + b.HasIndex("UserRoleId"); + + b.ToTable("UserRoleMap", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRolePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RoleGroup") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("SystemDefined") + .HasColumnType("bit"); + + b.Property("SystemName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.ToTable("UserRolePermission", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRolePermissionMap", b => + { + b.Property("PermissionId") + .HasColumnType("int"); + + b.Property("UserRoleId") + .HasColumnType("int"); + + b.HasKey("PermissionId", "UserRoleId"); + + b.HasIndex("UserRoleId"); + + b.ToTable("UserRolePermissionMap", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserTwoFactor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EnabledOn") + .HasColumnType("datetime2"); + + b.Property("LastUsedTimeStep") + .HasColumnType("bigint"); + + b.Property("Secret") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserTwoFactor", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentCategoryId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentCategoryId"); + + b.HasIndex("ProjectId"); + + b.ToTable("WikiCategory", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("ContentHtml") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedById") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("ModifiedById") + .HasColumnType("int"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("SubModuleId") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ModifiedById"); + + b.HasIndex("ModuleId"); + + b.HasIndex("SubModuleId"); + + b.ToTable("WikiDocument", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiDocumentVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ContentHtml") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("int"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("WikiDocumentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ModifiedById"); + + b.HasIndex("WikiDocumentId"); + + b.ToTable("WikiDocumentVersion", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UploadedById") + .HasColumnType("int"); + + b.Property("WikiDocumentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId") + .IsUnique(); + + b.HasIndex("ProjectId"); + + b.HasIndex("UploadedById"); + + b.HasIndex("WikiDocumentId"); + + b.ToTable("WikiImage", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.Backlog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AssigneeId") + .HasColumnType("int"); + + b.Property("AttachmentCount") + .HasColumnType("int"); + + b.Property("Code") + .HasColumnType("uniqueidentifier"); + + b.Property("CommentCount") + .HasColumnType("int"); + + b.Property("CreatedById") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DueDate") + .HasColumnType("date"); + + b.Property("EnvironmentJson") + .HasColumnType("nvarchar(max)"); + + b.Property("ExternalNotes") + .HasColumnType("nvarchar(max)"); + + b.Property("MergeRequestId") + .HasColumnType("int"); + + b.Property("MergeRequestRepositoryId") + .HasColumnType("int"); + + b.Property("ModifiedById") + .HasColumnType("int"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("PlannedStartDate") + .HasColumnType("date"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReOpenCount") + .HasColumnType("int"); + + b.Property("ReleaseId") + .HasColumnType("int"); + + b.Property("ReporterId") + .HasColumnType("int"); + + b.Property("ResolutionDetails") + .HasColumnType("nvarchar(max)"); + + b.Property("RootCauseAnalysis") + .HasColumnType("nvarchar(max)"); + + b.Property("SeverityId") + .HasColumnType("int"); + + b.Property("SourceId") + .HasColumnType("int"); + + b.Property("SourceWikiDocumentId") + .HasColumnType("int"); + + b.Property("StatusId") + .HasColumnType("int"); + + b.Property("SubModuleId") + .HasColumnType("int"); + + b.Property("SubTaskCount") + .HasColumnType("int"); + + b.Property("TaskTypeId") + .HasColumnType("int"); + + b.Property("TesterId") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("AssigneeId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("MergeRequestRepositoryId"); + + b.HasIndex("ModifiedById"); + + b.HasIndex("ModuleId"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("ReleaseId"); + + b.HasIndex("ReporterId"); + + b.HasIndex("SeverityId"); + + b.HasIndex("SourceWikiDocumentId"); + + b.HasIndex("StatusId"); + + b.HasIndex("SubModuleId"); + + b.HasIndex("TaskTypeId"); + + b.HasIndex("TesterId"); + + b.ToTable("Backlog", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedById") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("FieldName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ModifiedById") + .HasColumnType("int"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("NewValue") + .HasColumnType("nvarchar(max)"); + + b.Property("OldValue") + .HasColumnType("nvarchar(max)"); + + b.Property("PostToIssue") + .HasColumnType("bit"); + + b.Property("SystemComment") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("BacklogId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ModifiedById"); + + b.ToTable("BacklogComment", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogCustomFieldValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogId") + .HasColumnType("int"); + + b.Property("CustomFieldId") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BacklogId"); + + b.HasIndex("CustomFieldId"); + + b.ToTable("BacklogCustomFieldValue", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogId") + .HasColumnType("int"); + + b.Property("CreatedById") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BacklogId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("DocumentId"); + + b.ToTable("BacklogDocument", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogStatusLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogId") + .HasColumnType("int"); + + b.Property("CreatedById") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("StatusId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BacklogId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("StatusId"); + + b.ToTable("BacklogStatusLog", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogId") + .HasColumnType("int"); + + b.Property("TagId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("BacklogId", "TagId"); + + b.ToTable("BacklogTag", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.GitBranch", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BaseBranch") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreatedById") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("GitProjectReference") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Origin") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ProjectRepositoryId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ProjectId"); + + b.HasIndex("ProjectRepositoryId"); + + b.HasIndex("GitProjectReference", "Name"); + + b.ToTable("GitBranch", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.GitBranchTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BacklogId") + .HasColumnType("int"); + + b.Property("GitBranchId") + .HasColumnType("int"); + + b.Property("LinkedById") + .HasColumnType("int"); + + b.Property("LinkedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("BacklogId"); + + b.HasIndex("LinkedById"); + + b.HasIndex("GitBranchId", "BacklogId") + .IsUnique(); + + b.ToTable("GitBranchTask", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.Release", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ReleaseType") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Release", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.ReleaseProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReleaseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("ReleaseId", "ProjectId") + .IsUnique(); + + b.ToTable("ReleaseProject", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.StatusDurationMetric", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("FromStatusId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ShowOnTask") + .HasColumnType("bit"); + + b.Property("ToStatusId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FromStatusId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("ToStatusId"); + + b.ToTable("StatusDurationMetric", (string)null); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Announcements.AnnouncementAcknowledgement", b => + { + b.HasOne("Taskist.Core.Domain.Announcements.Announcement", "Announcement") + .WithMany() + .HasForeignKey("AnnouncementId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Announcement"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Announcements.AnnouncementRole", b => + { + b.HasOne("Taskist.Core.Domain.Announcements.Announcement", "Announcement") + .WithMany("Roles") + .HasForeignKey("AnnouncementId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.UserRole", "UserRole") + .WithMany() + .HasForeignKey("UserRoleId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Announcement"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.ExternalCommentLink", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.BacklogComment", "BacklogComment") + .WithMany() + .HasForeignKey("BacklogCommentId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Git.ExternalIssueLink", "ExternalIssueLink") + .WithMany() + .HasForeignKey("ExternalIssueLinkId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("BacklogComment"); + + b.Navigation("ExternalIssueLink"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.ExternalIssueLink", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Backlog") + .WithMany() + .HasForeignKey("BacklogId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Git.ProjectRepository", "ProjectRepository") + .WithMany() + .HasForeignKey("ProjectRepositoryId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Backlog"); + + b.Navigation("ProjectRepository"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.GitWebhookDelivery", b => + { + b.HasOne("Taskist.Core.Domain.Git.ProjectRepository", "ProjectRepository") + .WithMany() + .HasForeignKey("ProjectRepositoryId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("ProjectRepository"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.ProjectRepository", b => + { + b.HasOne("Taskist.Core.Domain.Git.GitConnection", "GitConnection") + .WithMany() + .HasForeignKey("GitConnectionId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Status", "IssueClosedStatus") + .WithMany() + .HasForeignKey("IssueClosedStatusId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Status", "IssueOpenStatus") + .WithMany() + .HasForeignKey("IssueOpenStatusId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Severity", "IssueSeverity") + .WithMany() + .HasForeignKey("IssueSeverityId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Users.User", "IssueSyncUser") + .WithMany() + .HasForeignKey("IssueSyncUserId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.TaskType", "IssueTaskType") + .WithMany() + .HasForeignKey("IssueTaskTypeId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("GitConnection"); + + b.Navigation("IssueClosedStatus"); + + b.Navigation("IssueOpenStatus"); + + b.Navigation("IssueSeverity"); + + b.Navigation("IssueSyncUser"); + + b.Navigation("IssueTaskType"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Git.UserGitAccount", b => + { + b.HasOne("Taskist.Core.Domain.Git.GitConnection", "GitConnection") + .WithMany() + .HasForeignKey("GitConnectionId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("GitConnection"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Localization.LocaleResource", b => + { + b.HasOne("Taskist.Core.Domain.Localization.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.CustomField", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.EmailTemplate", b => + { + b.HasOne("Taskist.Core.Domain.Masters.EmailAccount", "EmailAccount") + .WithMany() + .HasForeignKey("EmailAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EmailAccount"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Module", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Project", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Client", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "CodeReviewer") + .WithMany() + .HasForeignKey("CodeReviewerId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Users.User", "ProjectManager") + .WithMany() + .HasForeignKey("ProjectManagerId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Users.User", "TeamLead") + .WithMany() + .HasForeignKey("TeamLeadId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Client"); + + b.Navigation("CodeReviewer"); + + b.Navigation("ProjectManager"); + + b.Navigation("TeamLead"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.ProjectNotificationChannel", b => + { + b.HasOne("Taskist.Core.Domain.Masters.NotificationChannel", "NotificationChannel") + .WithMany() + .HasForeignKey("NotificationChannelId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("NotificationChannel"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Reporter", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.Status", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Masters.SubModule", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Module"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.User", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Address", "Address") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Localization.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Address"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserExternalLogin", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserNotification", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserPassword", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserProjectMap", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Project"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRecoveryCode", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRoleMap", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", "User") + .WithMany("UserUserRoleMaps") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.UserRole", "UserRole") + .WithMany() + .HasForeignKey("UserRoleId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRolePermissionMap", b => + { + b.HasOne("Taskist.Core.Domain.Users.UserRolePermission", "Permission") + .WithMany("UserRolePermissionMaps") + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.UserRole", "UserRole") + .WithMany("UserRolePermissionMaps") + .HasForeignKey("UserRoleId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserTwoFactor", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiCategory", b => + { + b.HasOne("Taskist.Core.Domain.Wiki.WikiCategory", "ParentCategory") + .WithMany() + .HasForeignKey("ParentCategoryId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("ParentCategory"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiDocument", b => + { + b.HasOne("Taskist.Core.Domain.Wiki.WikiCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "ModifiedBy") + .WithMany() + .HasForeignKey("ModifiedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.SubModule", "SubModule") + .WithMany() + .HasForeignKey("SubModuleId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Category"); + + b.Navigation("CreatedBy"); + + b.Navigation("ModifiedBy"); + + b.Navigation("Module"); + + b.Navigation("SubModule"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiDocumentVersion", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", "ModifiedBy") + .WithMany() + .HasForeignKey("ModifiedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Wiki.WikiDocument", "WikiDocument") + .WithMany() + .HasForeignKey("WikiDocumentId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("ModifiedBy"); + + b.Navigation("WikiDocument"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Wiki.WikiImage", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Document", null) + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Project", null) + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", null) + .WithMany() + .HasForeignKey("UploadedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Wiki.WikiDocument", null) + .WithMany() + .HasForeignKey("WikiDocumentId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.Backlog", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", "Assignee") + .WithMany() + .HasForeignKey("AssigneeId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Users.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Git.ProjectRepository", null) + .WithMany() + .HasForeignKey("MergeRequestRepositoryId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Users.User", "ModifiedBy") + .WithMany() + .HasForeignKey("ModifiedById") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Parent") + .WithMany() + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.WorkItems.Release", "Release") + .WithMany() + .HasForeignKey("ReleaseId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Reporter", "Reporter") + .WithMany() + .HasForeignKey("ReporterId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Severity", "Severity") + .WithMany() + .HasForeignKey("SeverityId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Wiki.WikiDocument", "SourceWikiDocument") + .WithMany() + .HasForeignKey("SourceWikiDocumentId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Status", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.SubModule", "SubModule") + .WithMany() + .HasForeignKey("SubModuleId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.TaskType", "TaskType") + .WithMany() + .HasForeignKey("TaskTypeId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "Tester") + .WithMany() + .HasForeignKey("TesterId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Assignee"); + + b.Navigation("CreatedBy"); + + b.Navigation("ModifiedBy"); + + b.Navigation("Module"); + + b.Navigation("Parent"); + + b.Navigation("Project"); + + b.Navigation("Release"); + + b.Navigation("Reporter"); + + b.Navigation("Severity"); + + b.Navigation("SourceWikiDocument"); + + b.Navigation("Status"); + + b.Navigation("SubModule"); + + b.Navigation("TaskType"); + + b.Navigation("Tester"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogComment", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Backlog") + .WithMany() + .HasForeignKey("BacklogId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "ModifiedBy") + .WithMany() + .HasForeignKey("ModifiedById") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Backlog"); + + b.Navigation("CreatedBy"); + + b.Navigation("ModifiedBy"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogCustomFieldValue", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Backlog") + .WithMany() + .HasForeignKey("BacklogId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.CustomField", "CustomField") + .WithMany() + .HasForeignKey("CustomFieldId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Backlog"); + + b.Navigation("CustomField"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogDocument", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Backlog") + .WithMany() + .HasForeignKey("BacklogId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Backlog"); + + b.Navigation("CreatedBy"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogStatusLog", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Backlog") + .WithMany() + .HasForeignKey("BacklogId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Status", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Backlog"); + + b.Navigation("CreatedBy"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.BacklogTag", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Backlog") + .WithMany() + .HasForeignKey("BacklogId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Backlog"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.GitBranch", b => + { + b.HasOne("Taskist.Core.Domain.Users.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Git.ProjectRepository", "ProjectRepository") + .WithMany() + .HasForeignKey("ProjectRepositoryId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("CreatedBy"); + + b.Navigation("Project"); + + b.Navigation("ProjectRepository"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.GitBranchTask", b => + { + b.HasOne("Taskist.Core.Domain.WorkItems.Backlog", "Backlog") + .WithMany() + .HasForeignKey("BacklogId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.WorkItems.GitBranch", "GitBranch") + .WithMany("Tasks") + .HasForeignKey("GitBranchId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Users.User", "LinkedBy") + .WithMany() + .HasForeignKey("LinkedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Backlog"); + + b.Navigation("GitBranch"); + + b.Navigation("LinkedBy"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.Release", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.ReleaseProject", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.WorkItems.Release", "Release") + .WithMany("ReleaseProjects") + .HasForeignKey("ReleaseId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Project"); + + b.Navigation("Release"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.StatusDurationMetric", b => + { + b.HasOne("Taskist.Core.Domain.Masters.Status", "FromStatus") + .WithMany() + .HasForeignKey("FromStatusId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Taskist.Core.Domain.Masters.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Taskist.Core.Domain.Masters.Status", "ToStatus") + .WithMany() + .HasForeignKey("ToStatusId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("FromStatus"); + + b.Navigation("Project"); + + b.Navigation("ToStatus"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Announcements.Announcement", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.User", b => + { + b.Navigation("UserUserRoleMaps"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRole", b => + { + b.Navigation("UserRolePermissionMaps"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.Users.UserRolePermission", b => + { + b.Navigation("UserRolePermissionMaps"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.GitBranch", b => + { + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Taskist.Core.Domain.WorkItems.Release", b => + { + b.Navigation("ReleaseProjects"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.cs b/src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.cs new file mode 100644 index 0000000..ab4cc39 --- /dev/null +++ b/src/Libraries/Taskist.Data/Migrations/20261113050423_AddCustomFieldSlot.cs @@ -0,0 +1,38 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Taskist.Data.Migrations +{ + /// + public partial class AddCustomFieldSlot : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DisplayOrder", + table: "CustomField", + type: "int", + nullable: true); + + migrationBuilder.AddColumn( + name: "Slot", + table: "CustomField", + type: "int", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DisplayOrder", + table: "CustomField"); + + migrationBuilder.DropColumn( + name: "Slot", + table: "CustomField"); + } + } +} diff --git a/src/Libraries/Taskist.Data/Migrations/ApplicationContextModelSnapshot.cs b/src/Libraries/Taskist.Data/Migrations/ApplicationContextModelSnapshot.cs index f0e4890..55c7040 100644 --- a/src/Libraries/Taskist.Data/Migrations/ApplicationContextModelSnapshot.cs +++ b/src/Libraries/Taskist.Data/Migrations/ApplicationContextModelSnapshot.cs @@ -816,6 +816,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(20) .HasColumnType("int"); + b.Property("DisplayOrder") + .HasColumnType("int"); + b.Property("FieldType") .HasColumnType("int"); @@ -840,6 +843,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(100) .HasColumnType("nvarchar(100)"); + b.Property("Slot") + .HasColumnType("int"); + b.HasKey("Id"); b.HasIndex("ProjectId"); diff --git a/src/Libraries/Taskist.Service/Masters/CustomFieldService.cs b/src/Libraries/Taskist.Service/Masters/CustomFieldService.cs index a2583a2..868fc32 100644 --- a/src/Libraries/Taskist.Service/Masters/CustomFieldService.cs +++ b/src/Libraries/Taskist.Service/Masters/CustomFieldService.cs @@ -1,3 +1,4 @@ +using Taskist.Core.Enums; using Taskist.Core.Common; using Taskist.Core.Domain.Masters; using Taskist.Data.Repository; @@ -34,7 +35,12 @@ public async Task> GetPagedListAsync(int projectId, stri if (!string.IsNullOrWhiteSpace(search)) query = query.Where(c => c.ResourceKey.Contains(search)); - return query; + return query + .OrderBy(x => x.Slot ?? (x.Placement == (int)CustomFieldPlacement.StatusSection + ? (int)BacklogFormSlot.StatusBottom + : (int)BacklogFormSlot.MainBottom)) + .ThenBy(x => x.DisplayOrder ?? int.MaxValue) + .ThenBy(x => x.Id); }, pageIndex, pageSize); } diff --git a/src/Presentation/Taskist.Web/Components/WorkItems/CustomFields.cs b/src/Presentation/Taskist.Web/Components/WorkItems/CustomFields.cs deleted file mode 100644 index c9462c8..0000000 --- a/src/Presentation/Taskist.Web/Components/WorkItems/CustomFields.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Taskist.Service.Masters; -using Taskist.Service.WorkItems; -using Taskist.Web.Helpers.Mapping; -using Taskist.Web.Models.Masters; - -namespace Taskist.Web.Components.WorkItems; - -public class CustomFields : ViewComponent -{ - #region Fields - - protected readonly ICustomFieldService _customFieldService; - protected readonly IBacklogService _backlogService; - protected readonly MastersMapper _mastersMapper; - protected readonly WorkItemsMapper _workItemsMapper; - - #endregion - - #region Ctor - - public CustomFields(ICustomFieldService customFieldService, - IBacklogService backlogService, - MastersMapper mastersMapper, - WorkItemsMapper workItemsMapper) - { - _customFieldService = customFieldService; - _backlogService = backlogService; - _mastersMapper = mastersMapper; - _workItemsMapper = workItemsMapper; - } - - #endregion - - #region Methods - - public async Task InvokeAsync(int backLogId, int placement, int projectId) - { - var customFields = await _customFieldService.GetAllAsync(projectId); - var customFieldValues = await _backlogService.GetAllCustomFieldValuesAsync(backLogId); - - var model = new CustomFieldsViewModel() - { - Index = placement > 1 ? customFields.Count(x => x.Placement == 1) : 0, - BacklogId = backLogId, - CustomFields = customFields.Where(x => x.Placement == placement).Select(x => _mastersMapper.ToRenderModel(x)).ToList(), - Values = customFieldValues.Select(x => _workItemsMapper.ToModel(x)).ToList() - }; - - return View(model); - } - - #endregion -} diff --git a/src/Presentation/Taskist.Web/Controllers/Masters/ProjectController.cs b/src/Presentation/Taskist.Web/Controllers/Masters/ProjectController.cs index cb49a55..4d60944 100644 --- a/src/Presentation/Taskist.Web/Controllers/Masters/ProjectController.cs +++ b/src/Presentation/Taskist.Web/Controllers/Masters/ProjectController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Taskist.Core.Common; using Taskist.Core.Domain.Users; using Taskist.Core.Enums; using Taskist.Core.Extensions; @@ -299,8 +300,10 @@ public async Task AddCustomField(int projectId) var model = new CustomFieldModel { ProjectId = projectId, - ProjectName = project.Name + ProjectName = project.Name, + Slot = (int)BacklogFormSlot.StatusBottom }; + await PrepareCustomFieldSlotsAsync(model); return PartialView(model); } @@ -310,6 +313,7 @@ public async Task AddCustomField(CustomFieldModel model) { if (ModelState.IsValid) { + model.Placement = (int)CustomFieldLayout.SectionOf((BacklogFormSlot)model.Slot!.Value); var entity = _mastersMapper.ToEntity(model); await _customFieldService.InsertAsync(entity); @@ -335,6 +339,8 @@ public async Task EditCustomField(int id) return NoDataPartial(); var model = _mastersMapper.ToModel(entity); + model.Slot = (int)CustomFieldLayout.ResolveSlot(entity.Slot, entity.Placement); + await PrepareCustomFieldSlotsAsync(model); return PartialView(model); } @@ -345,6 +351,15 @@ public async Task EditCustomField(CustomFieldModel model) if (ModelState.IsValid) { var entity = await _customFieldService.GetByIdAsync(model.Id); + if (entity == null) + return Json(new JsonResponseModel + { + Status = HttpStatusCode.NoData, + Message = await _localizationService.GetResourceAsync("FormNoData.Description") + }); + + model.ProjectId = entity.ProjectId; + model.Placement = (int)CustomFieldLayout.SectionOf((BacklogFormSlot)model.Slot!.Value); _mastersMapper.Update(model, entity); await _customFieldService.UpdateAsync(entity); @@ -442,6 +457,7 @@ public async Task DataReadCustomField(int projectId, DataTableReq { var data = await _customFieldService.GetPagedListAsync(projectId, request.SearchValue, request.Start, request.Length); + var slotNames = await GetCustomFieldSlotNamesAsync(); return Json(new { @@ -454,7 +470,8 @@ public async Task DataReadCustomField(int projectId, DataTableReq FieldType = x.FieldType.ToString(), Mandatory = x.Mandatory, ColumnClass = $"{x.ColumnClass} column", - Placement = x.Placement.ToString() + Placement = slotNames[CustomFieldLayout.ResolveSlot(x.Slot, x.Placement)], + DisplayOrder = x.DisplayOrder?.ToString() ?? "" }), recordsFiltered = data.TotalCount, recordsTotal = data.TotalCount @@ -465,6 +482,36 @@ public async Task DataReadCustomField(int projectId, DataTableReq #region Helper + private async Task> GetCustomFieldSlotNamesAsync() + { + var names = new Dictionary(); + foreach (var slot in Enum.GetValues()) + names[slot] = await _localizationService.GetResourceAsync($"BacklogFormSlot.{slot}"); + + return names; + } + + private async Task PrepareCustomFieldSlotsAsync(CustomFieldModel model) + { + var names = await GetCustomFieldSlotNamesAsync(); + var groups = new Dictionary + { + [CustomFieldPlacement.MainSection] = new() { Name = await _localizationService.GetResourceAsync("BacklogFormSlot.Group.Main") }, + [CustomFieldPlacement.StatusSection] = new() { Name = await _localizationService.GetResourceAsync("BacklogFormSlot.Group.Status") } + }; + + model.AvailableSlots = []; + foreach (var section in groups.Keys) + foreach (var slot in CustomFieldLayout.SlotsIn(section)) + model.AvailableSlots.Add(new SelectListItem + { + Text = names[slot], + Value = ((int)slot).ToString(), + Group = groups[section], + Selected = model.Slot == (int)slot + }); + } + [HttpGet] public async Task ReleaseVersionPreview(int id, string? format, int? fullIncrement) { diff --git a/src/Presentation/Taskist.Web/Controllers/WorkItems/BacklogController.cs b/src/Presentation/Taskist.Web/Controllers/WorkItems/BacklogController.cs index d74baf7..fa389e7 100644 --- a/src/Presentation/Taskist.Web/Controllers/WorkItems/BacklogController.cs +++ b/src/Presentation/Taskist.Web/Controllers/WorkItems/BacklogController.cs @@ -305,7 +305,7 @@ public async Task Create(BacklogModel model, if (!fieldValuesErrors) ModelState.AddModelError(string.Empty, await _localizationService.GetResourceAsync("Error.UnableToCreateTask")); - await InitModelAsync(model, model.ProjectId); + await InitModelAsync(model, model.ProjectId, fieldValues); return View(model); } @@ -1389,8 +1389,16 @@ public async Task> GetModules(int project) } [HttpPatch] + [CheckPermission(nameof(PermissionProvider.ManageBacklog))] public async Task UpdateCustomField(int id, int reference, string value) { + if (!await _backlogItemService.CanEditTaskAsync(id)) + return new JsonResponseModel + { + Status = HttpStatusCode.InternalServerError, + Message = "You are not allowed to edit this task." + }; + var message = await _backlogItemService.InsertFieldValueAsync(id, reference, value); return new JsonResponseModel @@ -1735,7 +1743,8 @@ private async Task GetProjectAccess(int projectId) }; } - private async Task InitModelAsync(BacklogModel model, int projectId) + private async Task InitModelAsync(BacklogModel model, int projectId, + IList? postedFieldValues = null) { var loggedUser = await _workContext.GetCurrentUserAsync(); var projectAccess = await GetProjectAccess(projectId); @@ -1977,6 +1986,35 @@ private async Task InitModelAsync(BacklogModel model, int projectId) }); } } + + model.CustomFieldLayout = await BuildCustomFieldLayoutAsync(model, postedFieldValues); + } + + private async Task BuildCustomFieldLayoutAsync(BacklogModel model, + IList? postedFieldValues) + { + var fields = CustomFieldLayout.Order(await _customFieldService.GetAllAsync(model.ProjectId)); + + IList values = []; + if (postedFieldValues != null) + values = postedFieldValues.Where(x => x != null).ToList(); + else if (model.Id > 0) + values = (await _backlogItemService.GetAllCustomFieldValuesAsync(model.Id)) + .Select(x => _workItemsMapper.ToModel(x)) + .ToList(); + + var layout = new CustomFieldLayoutModel { CanUpdate = model.Id > 0 && model.CanEdit }; + for (var i = 0; i < fields.Count; i++) + { + var field = fields[i]; + var render = _mastersMapper.ToRenderModel(field); + render.Index = i; + render.ResolvedSlot = (int)CustomFieldLayout.ResolveSlot(field.Slot, field.Placement); + render.Value = values.FirstOrDefault(x => x.CustomFieldId == field.Id)?.Value ?? ""; + layout.Fields.Add(render); + } + + return layout; } private async Task InitBatchUpdateModelAsync(BacklogBatchUpdateModel model, List projectIds) diff --git a/src/Presentation/Taskist.Web/Helpers/Mapping/MastersMapper.cs b/src/Presentation/Taskist.Web/Helpers/Mapping/MastersMapper.cs index a5fc284..6175e30 100644 --- a/src/Presentation/Taskist.Web/Helpers/Mapping/MastersMapper.cs +++ b/src/Presentation/Taskist.Web/Helpers/Mapping/MastersMapper.cs @@ -68,6 +68,9 @@ public partial class MastersMapper [MapperIgnoreTarget(nameof(CustomField.Project))] public partial void Update(CustomFieldModel source, CustomField target); + [MapperIgnoreTarget(nameof(CustomFieldRenderModel.ResolvedSlot))] + [MapperIgnoreTarget(nameof(CustomFieldRenderModel.Index))] + [MapperIgnoreTarget(nameof(CustomFieldRenderModel.Value))] public partial CustomFieldRenderModel ToRenderModel(CustomField source); public partial TagModel ToModel(Tag source); diff --git a/src/Presentation/Taskist.Web/Helpers/Validators/Masters/CustomFieldValidator.cs b/src/Presentation/Taskist.Web/Helpers/Validators/Masters/CustomFieldValidator.cs index 0dfda6d..68e2a80 100644 --- a/src/Presentation/Taskist.Web/Helpers/Validators/Masters/CustomFieldValidator.cs +++ b/src/Presentation/Taskist.Web/Helpers/Validators/Masters/CustomFieldValidator.cs @@ -1,3 +1,4 @@ +using Taskist.Core.Enums; using Taskist.Service.Localization; using Taskist.Service.Masters; using Taskist.Web.Helpers.Extensions; @@ -34,7 +35,13 @@ public CustomFieldValidator(ILocalizationService localizationService, RuleFor(r => r.ColumnClass) .NotEmpty().WithMessage(localizationService.GetResource("CustomFieldModel.ColumnClass.RequiredMsg")); - RuleFor(r => r.Placement) - .NotEmpty().WithMessage(localizationService.GetResource("CustomFieldModel.Placement.RequiredMsg")); + RuleFor(r => r.Slot) + .NotNull().WithMessage(localizationService.GetResource("CustomFieldModel.Slot.RequiredMsg")) + .Must(x => x.HasValue && Enum.IsDefined(typeof(BacklogFormSlot), x.Value)) + .WithMessage(localizationService.GetResource("CustomFieldModel.Slot.RequiredMsg")); + + RuleFor(r => r.DisplayOrder) + .InclusiveBetween(0, 9999).When(x => x.DisplayOrder.HasValue) + .WithMessage(localizationService.GetResource("CustomFieldModel.DisplayOrder.RangeMsg")); } } \ No newline at end of file diff --git a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldGridModel.cs b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldGridModel.cs new file mode 100644 index 0000000..84cbc91 --- /dev/null +++ b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldGridModel.cs @@ -0,0 +1,21 @@ +using Taskist.Web.Models.Common; + +namespace Taskist.Web.Models.Masters +{ + public class CustomFieldGridModel : BaseModel + { + public string Label { get; set; } + + public string ResourceKey { get; set; } + + public string FieldType { get; set; } + + public bool Mandatory { get; set; } + + public string ColumnClass { get; set; } + + public string Placement { get; set; } + + public string DisplayOrder { get; set; } + } +} diff --git a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs new file mode 100644 index 0000000..9d974cc --- /dev/null +++ b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs @@ -0,0 +1,27 @@ +using Taskist.Core.Common; +using Taskist.Core.Enums; + +namespace Taskist.Web.Models.Masters +{ + public class CustomFieldLayoutModel + { + public CustomFieldLayoutModel() + { + Fields = []; + } + + public bool CanUpdate { get; set; } + + public List Fields { get; set; } + + public CustomFieldsViewModel For(BacklogFormSlot slot) + { + return new CustomFieldsViewModel + { + InsideRow = CustomFieldLayout.RendersInsideStatusRow(slot), + CanUpdate = CanUpdate, + CustomFields = Fields.Where(x => x.ResolvedSlot == (int)slot).ToList() + }; + } + } +} diff --git a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldModel.cs b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldModel.cs index 734a95c..1ddf41e 100644 --- a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldModel.cs +++ b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldModel.cs @@ -37,28 +37,20 @@ public CustomFieldModel() [LocalizedDisplayName("CustomFieldModel.ColumnClass")] public int ColumnClass { get; set; } - [LocalizedDisplayName("CustomFieldModel.Placement")] public int Placement { get; set; } + [LocalizedDisplayName("CustomFieldModel.Slot")] + public int? Slot { get; set; } + + [LocalizedDisplayName("CustomFieldModel.DisplayOrder")] + public int? DisplayOrder { get; set; } + public int ProjectId { get; set; } public string ProjectName { get; set; } public IList AvailableColumnClasses { get; set; } - } - - public class CustomFieldGridModel : BaseModel - { - public string Label { get; set; } - - public string ResourceKey { get; set; } - - public string FieldType { get; set; } - - public bool Mandatory { get; set; } - - public string ColumnClass { get; set; } - public string Placement { get; set; } + public IList AvailableSlots { get; set; } = []; } } diff --git a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldRenderModel.cs b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldRenderModel.cs index d50132e..d4ec938 100644 --- a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldRenderModel.cs +++ b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldRenderModel.cs @@ -17,5 +17,11 @@ public class CustomFieldRenderModel : BaseModel public int ColumnClass { get; set; } public int Placement { get; set; } + + public int ResolvedSlot { get; set; } + + public int Index { get; set; } + + public string Value { get; set; } = ""; } } diff --git a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldsViewModel.cs b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldsViewModel.cs index 7b824ce..6c3323e 100644 --- a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldsViewModel.cs +++ b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldsViewModel.cs @@ -5,15 +5,12 @@ public class CustomFieldsViewModel public CustomFieldsViewModel() { CustomFields = []; - Values = []; } - public int Index { get; set; } + public bool InsideRow { get; set; } - public int BacklogId { get; set; } + public bool CanUpdate { get; set; } public List CustomFields { get; set; } - - public List Values { get; set; } } } diff --git a/src/Presentation/Taskist.Web/Models/WorkItems/BacklogModel.cs b/src/Presentation/Taskist.Web/Models/WorkItems/BacklogModel.cs index 91486ac..4fac870 100644 --- a/src/Presentation/Taskist.Web/Models/WorkItems/BacklogModel.cs +++ b/src/Presentation/Taskist.Web/Models/WorkItems/BacklogModel.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; using System.ComponentModel.DataAnnotations; using Taskist.Web.Helpers.Attributes; @@ -133,6 +134,9 @@ public BacklogModel() public CustomFieldValueModel CustomFieldValue { get; set; } + [BindNever] + public CustomFieldLayoutModel CustomFieldLayout { get; set; } = new(); + public IList AvailableProjects { get; set; } public IList AvailableTaskTypes { get; set; } diff --git a/src/Presentation/Taskist.Web/Views/Backlog/Create.cshtml b/src/Presentation/Taskist.Web/Views/Backlog/Create.cshtml index f354eb3..7e99caa 100644 --- a/src/Presentation/Taskist.Web/Views/Backlog/Create.cshtml +++ b/src/Presentation/Taskist.Web/Views/Backlog/Create.cshtml @@ -4,16 +4,17 @@ } @section PageStyles { - + } @section PageScripts { - + + } diff --git a/src/Presentation/Taskist.Web/Views/Backlog/Edit.cshtml b/src/Presentation/Taskist.Web/Views/Backlog/Edit.cshtml index 2374adf..513e96c 100644 --- a/src/Presentation/Taskist.Web/Views/Backlog/Edit.cshtml +++ b/src/Presentation/Taskist.Web/Views/Backlog/Edit.cshtml @@ -4,13 +4,14 @@ } @section PageStyles { - + } @section PageScripts { - + + diff --git a/src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml b/src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml new file mode 100644 index 0000000..5694b7e --- /dev/null +++ b/src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml @@ -0,0 +1,88 @@ +@model CustomFieldsViewModel + +@if (Model.CustomFields.Count > 0) +{ + var updateCssClassName = Model.CanUpdate ? "ajax-update-custom-field" : ""; + +
+ @foreach (var field in Model.CustomFields) + { + var i = field.Index; + var fieldValue = field.Value ?? ""; + var mandatory = field.Mandatory.ToString().ToLower(); + var label = Localize(field.ResourceKey).Text; + if (string.IsNullOrWhiteSpace(label) || string.Equals(label, field.ResourceKey, StringComparison.OrdinalIgnoreCase)) + label = field.Label; + var requiredMsg = Localize($"{field.ResourceKey}.RequiredMsg").Text; + if (string.IsNullOrWhiteSpace(requiredMsg) || string.Equals(requiredMsg, $"{field.ResourceKey}.RequiredMsg", StringComparison.OrdinalIgnoreCase)) + requiredMsg = $"{field.Label} is required"; + var options = (field.Options ?? "").Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + +
+ + @if (field.FieldType == (int)FieldType.TextBox) + { +
+ + + +
+ } + else if (field.FieldType == (int)FieldType.Dropdown) + { +
+ + + +
+ } + else if (field.FieldType == (int)FieldType.Checkbox) + { +
+
+ + +
+
+ } + else if (field.FieldType == (int)FieldType.Radio) + { +
+ + @for (var o = 0; o < options.Length; o++) + { + var option = options[o]; +
+ + +
+ } + +
+ } + else if (field.FieldType == (int)FieldType.RangeSlider) + { +
+ + + +
+ } + else if (field.FieldType == (int)FieldType.DatePicker) + { +
+ + + +
+ } +
+ } +
+} diff --git a/src/Presentation/Taskist.Web/Views/Backlog/_Form.cshtml b/src/Presentation/Taskist.Web/Views/Backlog/_Form.cshtml index 2f9f6db..5a324f9 100644 --- a/src/Presentation/Taskist.Web/Views/Backlog/_Form.cshtml +++ b/src/Presentation/Taskist.Web/Views/Backlog/_Form.cshtml @@ -20,6 +20,7 @@ +
+
@@ -107,6 +109,7 @@
+
@@ -124,7 +127,7 @@
-@await Component.InvokeAsync("CustomFields", new { backLogId = Model.Id, placement = CustomFieldPlacement.MainSection, projectId = Model.ProjectId }) +
+ data-similar-url="@Url.Action("SimilarTasks")" + data-custom-field-url="@Url.Action("UpdateCustomField")">
diff --git a/src/Presentation/Taskist.Web/Views/Backlog/_FormStatus.cshtml b/src/Presentation/Taskist.Web/Views/Backlog/_FormStatus.cshtml index 21527ff..5d23d1f 100644 --- a/src/Presentation/Taskist.Web/Views/Backlog/_FormStatus.cshtml +++ b/src/Presentation/Taskist.Web/Views/Backlog/_FormStatus.cshtml @@ -17,6 +17,7 @@ +
@@ -24,6 +25,7 @@
+
@@ -31,6 +33,7 @@
+
@@ -38,6 +41,7 @@
+
@@ -45,6 +49,7 @@
+
@@ -52,6 +57,7 @@
+
@@ -59,6 +65,7 @@
+
@@ -67,6 +74,7 @@
+
@@ -75,6 +83,7 @@
+
@@ -82,6 +91,7 @@
+
@@ -89,6 +99,7 @@
+
@@ -96,6 +107,7 @@
+
@@ -116,5 +128,4 @@
- -@await Component.InvokeAsync("CustomFields", new { backLogId = Model.Id, placement = CustomFieldPlacement.StatusSection, projectId = Model.ProjectId }) + diff --git a/src/Presentation/Taskist.Web/Views/Project/AddCustomField.cshtml b/src/Presentation/Taskist.Web/Views/Project/AddCustomField.cshtml index c30ede9..4942ab2 100644 --- a/src/Presentation/Taskist.Web/Views/Project/AddCustomField.cshtml +++ b/src/Presentation/Taskist.Web/Views/Project/AddCustomField.cshtml @@ -3,6 +3,10 @@ Layout = "~/Views/Shared/_LayoutPartial.cshtml"; } +@section Scripts { + +} +
@await Html.PartialAsync("_FormCustomField", Model) diff --git a/src/Presentation/Taskist.Web/Views/Project/CustomFields.cshtml b/src/Presentation/Taskist.Web/Views/Project/CustomFields.cshtml index 08946f7..b781361 100644 --- a/src/Presentation/Taskist.Web/Views/Project/CustomFields.cshtml +++ b/src/Presentation/Taskist.Web/Views/Project/CustomFields.cshtml @@ -56,7 +56,8 @@ new ColumnModel { Title = Localize("CustomFieldGrid.ResourceKey").Text, DataColumn = "ResourceKey" }, new ColumnModel { Title = Localize("CustomFieldGrid.FieldType").Text, DataColumn = "FieldType" }, new ColumnModel { Title = Localize("CustomFieldGrid.ColumnClass").Text, DataColumn = "ColumnClass" }, - new ColumnModel { Title = Localize("CustomFieldGrid.Placement").Text, DataColumn = "Placement" }, + new ColumnModel { Title = Localize("CustomFieldGrid.Slot").Text, DataColumn = "Placement" }, + new ColumnModel { Title = Localize("CustomFieldGrid.DisplayOrder").Text, DataColumn = "DisplayOrder" }, new ColumnModel { Title = Localize("CustomFieldGrid.Mandatory").Text, DataColumn = "Mandatory", Conditions = new List{ new ColumnConditionModel { Value = "true", Operator = Operator.EQUAL, Icon = "fa fa-check", TextColor = "#2eb85c" }, new ColumnConditionModel { Value = "false", Operator = Operator.EQUAL, Icon = "fa fa-times", TextColor = "#e55353" } diff --git a/src/Presentation/Taskist.Web/Views/Project/EditCustomField.cshtml b/src/Presentation/Taskist.Web/Views/Project/EditCustomField.cshtml index d5e8540..b63d9a0 100644 --- a/src/Presentation/Taskist.Web/Views/Project/EditCustomField.cshtml +++ b/src/Presentation/Taskist.Web/Views/Project/EditCustomField.cshtml @@ -3,6 +3,10 @@ Layout = "~/Views/Shared/_LayoutPartial.cshtml"; } +@section Scripts { + +} + @await Html.PartialAsync("_FormCustomField", Model) diff --git a/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml b/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml index feeaadd..e30b890 100644 --- a/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml +++ b/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml @@ -6,7 +6,7 @@
- +
@@ -25,7 +25,7 @@
- +
@@ -39,9 +39,18 @@
- - - + + + +
+
+ +
+
+
+ + +
@@ -64,14 +73,3 @@ - \ No newline at end of file diff --git a/src/Presentation/Taskist.Web/Views/Shared/Components/CustomFields/Default.cshtml b/src/Presentation/Taskist.Web/Views/Shared/Components/CustomFields/Default.cshtml deleted file mode 100644 index 845e59b..0000000 --- a/src/Presentation/Taskist.Web/Views/Shared/Components/CustomFields/Default.cshtml +++ /dev/null @@ -1,137 +0,0 @@ -@model CustomFieldsViewModel - -@{ - var i = Model.Index; - var updateCssClassName = ""; - - if (Model.BacklogId > 0) - { - updateCssClassName = "ajax-update-custom-field"; - } -} - -@if (Model.CustomFields.Count > 0) -{ -
- @for (int k = 0; k < Model.CustomFields.Count; k++) - { - var field = Model.CustomFields[k]; - var fieldValue = Model.Values.FirstOrDefault(f => f.CustomFieldId == field.Id)?.Value ?? ""; - -
- @if (field.FieldType == (int)FieldType.TextBox) - { -
- - - -
- - } - else if (field.FieldType == (int)FieldType.Dropdown) - { - var optionsArr = (field.Options ?? "").Split(',', StringSplitOptions.RemoveEmptyEntries); -
- - - -
- } - else if (field.FieldType == (int)FieldType.Checkbox) - { - - } - else if (field.FieldType == (int)FieldType.Radio) - { - @foreach (var option in field.Options.Split(',')) - { - @option - } - } - else if (field.FieldType == (int)FieldType.RangeSlider) - { -
- - - -
- } - else if (field.FieldType == (int)FieldType.DatePicker) - { -
- - - -
- } -
- - i++; - } -
-} - - \ No newline at end of file diff --git a/src/Presentation/Taskist.Web/wwwroot/css/pages/backlog-task.css b/src/Presentation/Taskist.Web/wwwroot/css/pages/backlog-task.css index 1e15dd7..ab3312d 100644 --- a/src/Presentation/Taskist.Web/wwwroot/css/pages/backlog-task.css +++ b/src/Presentation/Taskist.Web/wwwroot/css/pages/backlog-task.css @@ -1250,4 +1250,8 @@ .task-issue-link--off { opacity: 0.6; -} \ No newline at end of file +} + +.custom-field-slot--inline { + display: contents; +} diff --git a/src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js b/src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js new file mode 100644 index 0000000..edb68dc --- /dev/null +++ b/src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js @@ -0,0 +1,71 @@ +(function () { + "use strict"; + + var UPDATE_CLASS = "ajax-update-custom-field"; + + var config = function () { + var $cfg = $("#backlog-form-config"); + return { + id: parseInt($cfg.data("id"), 10) || 0, + url: $cfg.data("custom-field-url") + }; + }; + + var valueOf = function ($input) { + if ($input.is(":checkbox")) + return $input.is(":checked") ? "true" : "false"; + if ($input.is(":radio")) + return $input.closest("form").find('input[name="' + $input.attr("name") + '"]:checked').val() || ""; + return ($input.val() || "").toString(); + }; + + var isValid = function ($input) { + if (String($input.data("val")) !== "true" || typeof $input.valid !== "function") + return true; + return $input.valid(); + }; + + var save = function (reference, value) { + if (window.BacklogEdit) { + window.BacklogEdit.markCustomDirty(reference, value); + return; + } + + var cfg = config(); + if (cfg.id <= 0 || !cfg.url) return; + + JSManager.ajaxPatch(cfg.url, { id: cfg.id, reference: reference, value: value }, undefined, undefined, function (response) { + JSManager.showSuccess(response.message); + }); + }; + + var initSliders = function (root) { + if (!$.fn.ionRangeSlider) return; + + $(root).find(".js-range-slider").each(function () { + var $input = $(this); + if ($input.data("ionRangeSlider")) return; + + $input.ionRangeSlider({ + skin: "big", + min: 0, + max: 100, + postfix: "%", + hide_min_max: true, + onFinish: function (data) { + if (!$input.hasClass(UPDATE_CLASS)) return; + save(parseInt($input.data("reference"), 10), data.from); + } + }); + }); + }; + + $(document).off("change.customFields").on("change.customFields", "." + UPDATE_CLASS + ":not(.js-range-slider)", function () { + var $input = $(this); + if (!isValid($input)) return; + + save(parseInt($input.data("reference"), 10), valueOf($input)); + }); + + $(function () { initSliders(document); }); +})(); diff --git a/src/Presentation/Taskist.Web/wwwroot/js/pages/masters/custom-field-form.js b/src/Presentation/Taskist.Web/wwwroot/js/pages/masters/custom-field-form.js new file mode 100644 index 0000000..5d32dae --- /dev/null +++ b/src/Presentation/Taskist.Web/wwwroot/js/pages/masters/custom-field-form.js @@ -0,0 +1,13 @@ +(function () { + "use strict"; + + var clean = function (value) { + return String(value || "").replace(/[^a-zA-Z0-9]/g, ""); + }; + + $(document).off("input.customFieldForm").on("input.customFieldForm", ".js-custom-field-label", function () { + var $label = $(this); + var $key = $label.closest("form").find("#ResourceKey"); + $key.val(clean($label.data("key-prefix")) + "." + clean($label.val())); + }); +})(); diff --git a/src/Tests/Taskist.Tests/WorkItems/CustomFieldLayoutTests.cs b/src/Tests/Taskist.Tests/WorkItems/CustomFieldLayoutTests.cs new file mode 100644 index 0000000..a12b287 --- /dev/null +++ b/src/Tests/Taskist.Tests/WorkItems/CustomFieldLayoutTests.cs @@ -0,0 +1,171 @@ +using Taskist.Core.Common; +using Taskist.Core.Domain.Masters; +using Taskist.Core.Enums; +using Taskist.Web.Models.Masters; + +namespace Taskist.Tests.WorkItems; + +public class CustomFieldLayoutTests +{ + #region Utilities + + private static CustomField Field(int id, int placement, int? slot = null, int? order = null) + { + return new CustomField { Id = id, Placement = placement, Slot = slot, DisplayOrder = order }; + } + + private const int Main = (int)CustomFieldPlacement.MainSection; + private const int Status = (int)CustomFieldPlacement.StatusSection; + + #endregion + + #region ResolveSlot + + [Fact] + public void ResolveSlot_LegacyMainField_GoesToMainBottom() + { + Assert.Equal(BacklogFormSlot.MainBottom, CustomFieldLayout.ResolveSlot(null, Main)); + } + + [Fact] + public void ResolveSlot_LegacyStatusField_GoesToStatusBottom() + { + Assert.Equal(BacklogFormSlot.StatusBottom, CustomFieldLayout.ResolveSlot(null, Status)); + } + + [Fact] + public void ResolveSlot_ExplicitSlot_WinsOverPlacement() + { + Assert.Equal(BacklogFormSlot.StatusAfterStatus, + CustomFieldLayout.ResolveSlot((int)BacklogFormSlot.StatusAfterStatus, Main)); + } + + [Theory] + [InlineData(0)] + [InlineData(999)] + [InlineData(-5)] + public void ResolveSlot_UnknownSlot_FallsBackToPlacementBottom(int slot) + { + Assert.Equal(BacklogFormSlot.StatusBottom, CustomFieldLayout.ResolveSlot(slot, Status)); + Assert.Equal(BacklogFormSlot.MainBottom, CustomFieldLayout.ResolveSlot(slot, Main)); + } + + [Fact] + public void ResolveSlot_UnknownPlacement_GoesToMainBottom() + { + Assert.Equal(BacklogFormSlot.MainBottom, CustomFieldLayout.ResolveSlot(null, 0)); + } + + #endregion + + #region Sections + + [Fact] + public void SectionOf_EverySlot_MatchesItsPrefix() + { + foreach (var slot in Enum.GetValues()) + { + var expected = slot.ToString().StartsWith("Status") + ? CustomFieldPlacement.StatusSection + : CustomFieldPlacement.MainSection; + Assert.Equal(expected, CustomFieldLayout.SectionOf(slot)); + } + } + + [Fact] + public void SlotsIn_CoverEverySlotOnceInFormOrder() + { + var main = CustomFieldLayout.SlotsIn(CustomFieldPlacement.MainSection); + var status = CustomFieldLayout.SlotsIn(CustomFieldPlacement.StatusSection); + + Assert.Equal(Enum.GetValues().Length, main.Count + status.Count); + Assert.Equal(BacklogFormSlot.MainAfterTitle, main[0]); + Assert.Equal(BacklogFormSlot.MainBottom, main[^1]); + Assert.Equal(BacklogFormSlot.StatusAfterProject, status[0]); + Assert.Equal(BacklogFormSlot.StatusBottom, status[^1]); + } + + [Fact] + public void RendersInsideStatusRow_OnlyForStatusSlotsAboveTheBottom() + { + Assert.True(CustomFieldLayout.RendersInsideStatusRow(BacklogFormSlot.StatusAfterProject)); + Assert.True(CustomFieldLayout.RendersInsideStatusRow(BacklogFormSlot.StatusAfterRelease)); + Assert.False(CustomFieldLayout.RendersInsideStatusRow(BacklogFormSlot.StatusBottom)); + Assert.False(CustomFieldLayout.RendersInsideStatusRow(BacklogFormSlot.MainAfterTitle)); + Assert.False(CustomFieldLayout.RendersInsideStatusRow(BacklogFormSlot.MainBottom)); + } + + #endregion + + #region Order + + [Fact] + public void Order_SortsBySlotThenDisplayOrderThenId() + { + var fields = new[] + { + Field(1, Status), + Field(2, Main, (int)BacklogFormSlot.MainAfterTitle, 5), + Field(3, Main, (int)BacklogFormSlot.MainAfterTitle, 1), + Field(4, Status, (int)BacklogFormSlot.StatusAfterStatus), + Field(5, Main), + Field(6, Main, (int)BacklogFormSlot.MainAfterTitle) + }; + + var ordered = CustomFieldLayout.Order(fields).Select(x => x.Id).ToArray(); + + Assert.Equal([3, 2, 6, 5, 4, 1], ordered); + } + + [Fact] + public void Order_NumberedFieldsComeBeforeUnnumbered() + { + var fields = new[] + { + Field(1, Main), + Field(2, Main, null, 0), + Field(3, Main, null, 9999) + }; + + Assert.Equal([2, 3, 1], CustomFieldLayout.Order(fields).Select(x => x.Id).ToArray()); + } + + [Fact] + public void Order_NullInputAndNullItems_AreIgnored() + { + Assert.Empty(CustomFieldLayout.Order(null!)); + Assert.Single(CustomFieldLayout.Order([null!, Field(1, Main)])); + } + + #endregion + + #region Layout model + + [Fact] + public void LayoutFor_ReturnsOnlyTheSlotsFieldsAndRowMode() + { + var layout = new CustomFieldLayoutModel + { + CanUpdate = true, + Fields = + [ + new CustomFieldRenderModel { Id = 1, Index = 0, ResolvedSlot = (int)BacklogFormSlot.MainAfterTitle }, + new CustomFieldRenderModel { Id = 2, Index = 1, ResolvedSlot = (int)BacklogFormSlot.StatusAfterStatus }, + new CustomFieldRenderModel { Id = 3, Index = 2, ResolvedSlot = (int)BacklogFormSlot.StatusAfterStatus } + ] + }; + + var status = layout.For(BacklogFormSlot.StatusAfterStatus); + var main = layout.For(BacklogFormSlot.MainAfterTitle); + var empty = layout.For(BacklogFormSlot.StatusBottom); + + Assert.Equal([2, 3], status.CustomFields.Select(x => x.Id).ToArray()); + Assert.True(status.InsideRow); + Assert.True(status.CanUpdate); + Assert.Single(main.CustomFields); + Assert.False(main.InsideRow); + Assert.Empty(empty.CustomFields); + } + + #endregion +} From bb1f4c9986ccc5657f8f08a885d1fe076f012575 Mon Sep 17 00:00:00 2001 From: Somaraj <17797942+somaraj@users.noreply.github.com> Date: Fri, 13 Nov 2026 15:02:52 +0530 Subject: [PATCH 2/2] fix(backlog): address SonarCloud findings on custom field positions - Make CustomFieldLayoutModel.CanUpdate nullable (S6964) - Use fieldset/legend for the radio group heading (S6853) - Give the Position select a literal label (InputWithoutLabelCheck) - Number.parseInt in backlog-custom-fields.js (S7773) --- .../Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs | 4 ++-- .../Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml | 6 +++--- .../Taskist.Web/Views/Project/_FormCustomField.cshtml | 5 +++-- .../wwwroot/js/pages/backlog/backlog-custom-fields.js | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs index 9d974cc..d26bab3 100644 --- a/src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs +++ b/src/Presentation/Taskist.Web/Models/Masters/CustomFieldLayoutModel.cs @@ -10,7 +10,7 @@ public CustomFieldLayoutModel() Fields = []; } - public bool CanUpdate { get; set; } + public bool? CanUpdate { get; set; } public List Fields { get; set; } @@ -19,7 +19,7 @@ public CustomFieldsViewModel For(BacklogFormSlot slot) return new CustomFieldsViewModel { InsideRow = CustomFieldLayout.RendersInsideStatusRow(slot), - CanUpdate = CanUpdate, + CanUpdate = CanUpdate == true, CustomFields = Fields.Where(x => x.ResolvedSlot == (int)slot).ToList() }; } diff --git a/src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml b/src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml index 5694b7e..8adddf3 100644 --- a/src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml +++ b/src/Presentation/Taskist.Web/Views/Backlog/_CustomFieldSlot.cshtml @@ -53,8 +53,8 @@ } else if (field.FieldType == (int)FieldType.Radio) { -
- +
+ @label @for (var o = 0; o < options.Length; o++) { var option = options[o]; @@ -64,7 +64,7 @@
} - + } else if (field.FieldType == (int)FieldType.RangeSlider) { diff --git a/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml b/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml index e30b890..50e2fdd 100644 --- a/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml +++ b/src/Presentation/Taskist.Web/Views/Project/_FormCustomField.cshtml @@ -48,8 +48,9 @@
- - + + +
@Localize("CustomFieldModel.Slot.Hint")
diff --git a/src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js b/src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js index edb68dc..12b2e6a 100644 --- a/src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js +++ b/src/Presentation/Taskist.Web/wwwroot/js/pages/backlog/backlog-custom-fields.js @@ -6,7 +6,7 @@ var config = function () { var $cfg = $("#backlog-form-config"); return { - id: parseInt($cfg.data("id"), 10) || 0, + id: Number.parseInt($cfg.data("id"), 10) || 0, url: $cfg.data("custom-field-url") }; }; @@ -54,7 +54,7 @@ hide_min_max: true, onFinish: function (data) { if (!$input.hasClass(UPDATE_CLASS)) return; - save(parseInt($input.data("reference"), 10), data.from); + save(Number.parseInt($input.data("reference"), 10), data.from); } }); }); @@ -64,7 +64,7 @@ var $input = $(this); if (!isValid($input)) return; - save(parseInt($input.data("reference"), 10), valueOf($input)); + save(Number.parseInt($input.data("reference"), 10), valueOf($input)); }); $(function () { initSliders(document); });