Enhance law management functionality and API

Updated ILawApplication with new methods for activating and deactivating laws by type. Added UpsertLaw method for creating and updating laws. Modified LawViewModel and EditLaw to include LawType. Enhanced LawApplication methods to support new features and updated GetLawByType to return default laws when none exist. Introduced LawController with endpoints for law operations.
This commit is contained in:
MahanCh
2025-09-14 10:47:31 +03:30
parent e1dfd8c8e1
commit 18e559f1ae
4 changed files with 220 additions and 8 deletions

View File

@@ -10,13 +10,15 @@ namespace CompanyManagment.App.Contracts.Law
OperationResult Edit(EditLaw command);
OperationResult Activate(long id);
OperationResult Deactivate(long id);
OperationResult ActivateByType(LawType type);
OperationResult DeactivateByType(LawType type);
EditLaw GetDetails(long id);
List<LawViewModel> GetList();
Task<LawViewModel> GetLawWithItems(long id);
Task<LawViewModel> GetLawByType(LawType type);
OperationResult UpsertLaw(EditLaw command);
}
public enum LawType
{
/// <summary>

View File

@@ -10,6 +10,7 @@ namespace CompanyManagment.App.Contracts.Law
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public List<LawItemViewModel> Items { get; set; }
public LawType Type { get; set; }
}
public class LawItemViewModel
@@ -33,6 +34,7 @@ namespace CompanyManagment.App.Contracts.Law
public long Id { get; set; }
public string Title { get; set; }
public List<LawItemViewModel> Items { get; set; }
public LawType Type { get; set; }
}
}