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(
int UserId,
int GroupId,
string? Comment,
string? AddedWho
);
string? Comment
) : 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;
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
@ -11,6 +12,8 @@ namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
string AddedWho,
string? ChangedWho,
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(
int Id,
int? UserId,
int? GroupId,
string? Comment,
string? ChangedWho
);
string? Comment
) : 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? Name { get; init; }
@ -11,7 +13,6 @@
public string? Comment { get; init; }
public bool? Deleted { get; init; }
public string DateFormat { get; init; } = "dd.MM.yyyy";
public string AddedWho { get; init; } = "DEFAULT";
public string? ChangedWho { get; init; }
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(
int Id,
@ -11,8 +13,6 @@
string? Comment,
bool? Deleted,
string? DateFormat,
string? AddedWho,
string? ChangedWho,
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(
int UserId,
@ -6,5 +8,5 @@
int RightGroupId,
string AddedWho,
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;
namespace DigitalData.UserManager.Application.DTOs.UserRep
@ -9,10 +10,13 @@ namespace DigitalData.UserManager.Application.DTOs.UserRep
int? RepGroupId,
int RightGroupId,
string AddedWho,
string ChangedWho,
int? RepUserId,
UserReadDto? User,
GroupReadDto? RepGroup,
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(
int UserId,
int? RepGroupId,
int RightGroupId,
int RepUserId
);
) : BaseUpdateDto();
}

View File

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

View File

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