refactor: Basis-DTO für alle Erstellungs-, Lese- und Aktualisierungs-DTOs außer Module und ModuleOfUser vererbt

- Vererbung von BaseDTO auf alle Erstellungs-, Lese- und Aktualisierungs-DTOs angewendet, mit Ausnahme von Module und ModuleOfUser.
This commit is contained in:
Developer 02 2024-08-14 19:05:15 +02:00
parent a2077c58ca
commit a5002a3038
10 changed files with 39 additions and 35 deletions

View File

@ -1,9 +1,10 @@
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser using DigitalData.UserManager.Application.DTOs.Base;
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
{ {
public record GroupOfUserCreateDto( public record GroupOfUserCreateDto(
int UserId, int UserId,
int GroupId, int GroupId,
string? Comment, string? Comment
string? AddedWho ) : BaseCreateDto();
);
} }

View File

@ -1,4 +1,5 @@
using DigitalData.UserManager.Application.DTOs.Group; using DigitalData.UserManager.Application.DTOs.Base;
using DigitalData.UserManager.Application.DTOs.Group;
using DigitalData.UserManager.Application.DTOs.User; using DigitalData.UserManager.Application.DTOs.User;
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
@ -11,6 +12,8 @@ namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
string AddedWho, string AddedWho,
string? ChangedWho, string? ChangedWho,
UserReadDto User, UserReadDto User,
GroupReadDto Group GroupReadDto Group,
); DateTime? AddedWhen,
DateTime? ChangedWhen
) : BaseReadDto(Id, AddedWho, AddedWhen, ChangedWho, ChangedWhen);
} }

View File

@ -1,10 +1,11 @@
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser using DigitalData.UserManager.Application.DTOs.Base;
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
{ {
public record GroupOfUserUpdateDto( public record GroupOfUserUpdateDto(
int Id, int Id,
int? UserId, int? UserId,
int? GroupId, int? GroupId,
string? Comment, string? Comment
string? ChangedWho ) : BaseUpdateDto();
);
} }

View File

@ -1,6 +1,8 @@
namespace DigitalData.UserManager.Application.DTOs.User using DigitalData.UserManager.Application.DTOs.Base;
namespace DigitalData.UserManager.Application.DTOs.User
{ {
public record class UserCreateDto public record class UserCreateDto() : BaseCreateDto()
{ {
public string? Prename { get; init; } public string? Prename { get; init; }
public string? Name { get; init; } public string? Name { get; init; }
@ -11,7 +13,6 @@
public string? Comment { get; init; } public string? Comment { get; init; }
public bool? Deleted { get; init; } public bool? Deleted { get; init; }
public string DateFormat { get; init; } = "dd.MM.yyyy"; public string DateFormat { get; init; } = "dd.MM.yyyy";
public string AddedWho { get; init; } = "DEFAULT";
public string? ChangedWho { get; init; } public string? ChangedWho { get; init; }
public bool Active { get; init; } = true; public bool Active { get; init; } = true;
} }

View File

@ -1,4 +1,6 @@
namespace DigitalData.UserManager.Application.DTOs.User using DigitalData.UserManager.Application.DTOs.Base;
namespace DigitalData.UserManager.Application.DTOs.User
{ {
public record UserUpdateDto( public record UserUpdateDto(
int Id, int Id,
@ -11,8 +13,6 @@
string? Comment, string? Comment,
bool? Deleted, bool? Deleted,
string? DateFormat, string? DateFormat,
string? AddedWho,
string? ChangedWho,
bool? Active bool? Active
); ) : BaseUpdateDto();
} }

View File

@ -1,4 +1,6 @@
namespace DigitalData.UserManager.Application.DTOs.UserRep using DigitalData.UserManager.Application.DTOs.Base;
namespace DigitalData.UserManager.Application.DTOs.UserRep
{ {
public record UserRepCreateDto( public record UserRepCreateDto(
int UserId, int UserId,
@ -6,5 +8,5 @@
int RightGroupId, int RightGroupId,
string AddedWho, string AddedWho,
int RepUserId int RepUserId
); ) : BaseCreateDto();
} }

View File

@ -1,4 +1,5 @@
using DigitalData.UserManager.Application.DTOs.Group; using DigitalData.UserManager.Application.DTOs.Base;
using DigitalData.UserManager.Application.DTOs.Group;
using DigitalData.UserManager.Application.DTOs.User; using DigitalData.UserManager.Application.DTOs.User;
namespace DigitalData.UserManager.Application.DTOs.UserRep namespace DigitalData.UserManager.Application.DTOs.UserRep
@ -9,10 +10,13 @@ namespace DigitalData.UserManager.Application.DTOs.UserRep
int? RepGroupId, int? RepGroupId,
int RightGroupId, int RightGroupId,
string AddedWho, string AddedWho,
string ChangedWho,
int? RepUserId, int? RepUserId,
UserReadDto? User, UserReadDto? User,
GroupReadDto? RepGroup, GroupReadDto? RepGroup,
GroupReadDto? RightGroup, GroupReadDto? RightGroup,
UserReadDto? RepUser UserReadDto? RepUser,
); DateTime? AddedWhen,
DateTime? ChangedWhen
) : BaseReadDto(Id, AddedWho, AddedWhen, ChangedWho, ChangedWhen);
} }

View File

@ -1,9 +1,11 @@
namespace DigitalData.UserManager.Application.DTOs.UserRep using DigitalData.UserManager.Application.DTOs.Base;
namespace DigitalData.UserManager.Application.DTOs.UserRep
{ {
public record UserRepUpdateDto( public record UserRepUpdateDto(
int UserId, int UserId,
int? RepGroupId, int? RepGroupId,
int RightGroupId, int RightGroupId,
int RepUserId int RepUserId
); ) : BaseUpdateDto();
} }

View File

@ -18,15 +18,10 @@ namespace DigitalData.UserManager.Domain.Entities
[StringLength(200)] [StringLength(200)]
public string? Comment { get; set; } public string? Comment { get; set; }
[StringLength(50)]
[Column("CHANGED_WHO")]
public string? ChangedWho { get; set; }
[ForeignKey("UserId")] [ForeignKey("UserId")]
public virtual User? User { get; set; } public virtual User? User { get; set; }
[ForeignKey("GroupId")] [ForeignKey("GroupId")]
public virtual Group? Group { get; set; } public virtual Group? Group { get; set; }
} }
} }

View File

@ -7,11 +7,6 @@ namespace DigitalData.UserManager.Domain.Entities
[Table("TBDD_USER_REPRESENTATION", Schema = "dbo")] [Table("TBDD_USER_REPRESENTATION", Schema = "dbo")]
public class UserRep : BaseEntity public class UserRep : BaseEntity
{ {
[Column("GUID")]
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required] [Required]
[Column("USER_ID")] [Column("USER_ID")]
public int UserId { get; set; } public int UserId { get; set; }