Added DTO for remaining models
This commit is contained in:
parent
99b3f65c97
commit
10cce72fbc
@ -1,4 +1,5 @@
|
|||||||
using DAL.Models;
|
using DAL.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace API.DTO.Base
|
namespace API.DTO.Base
|
||||||
{
|
{
|
||||||
@ -8,7 +9,10 @@ namespace API.DTO.Base
|
|||||||
public byte red { get; set; }
|
public byte red { get; set; }
|
||||||
public byte blue { get; set; }
|
public byte blue { get; set; }
|
||||||
public byte green { get; set; }
|
public byte green { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(64)]
|
||||||
public string name { get; set; } = null!;
|
public string name { get; set; } = null!;
|
||||||
|
|
||||||
public DateTime updated { get; set; }
|
public DateTime updated { get; set; }
|
||||||
public ulong updater { get; set; }
|
public ulong updater { get; set; }
|
||||||
public Color adaptToModel()
|
public Color adaptToModel()
|
||||||
|
37
API/DTO/Base/EventDTO.cs
Normal file
37
API/DTO/Base/EventDTO.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using DAL.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace API.DTO.Base
|
||||||
|
{
|
||||||
|
public class EventDTO : IAdaptable<Event>
|
||||||
|
{
|
||||||
|
public ulong id { get; set; }
|
||||||
|
public ulong savedEventId { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(64)]
|
||||||
|
public string? name { get; set; } = null!;
|
||||||
|
|
||||||
|
public ulong? bgColorId { get; set; }
|
||||||
|
public ulong? fgColorId { get; set; }
|
||||||
|
public ulong? imageId { get; set; }
|
||||||
|
public bool hidden { get; set; }
|
||||||
|
public DateTime updated { get; set; }
|
||||||
|
public ulong updater { get; set; }
|
||||||
|
|
||||||
|
public Event adaptToModel()
|
||||||
|
{
|
||||||
|
return new Event
|
||||||
|
{
|
||||||
|
id = id,
|
||||||
|
savedEventId = savedEventId,
|
||||||
|
name = name,
|
||||||
|
bgColorId = bgColorId,
|
||||||
|
fgColorId = fgColorId,
|
||||||
|
imageId = imageId,
|
||||||
|
hidden = hidden,
|
||||||
|
updated = updated,
|
||||||
|
updater = updater
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
API/DTO/Base/GrantDTO.cs
Normal file
31
API/DTO/Base/GrantDTO.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using DAL.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace API.DTO.Base
|
||||||
|
{
|
||||||
|
public class GrantDTO : IAdaptable<Grant>
|
||||||
|
{
|
||||||
|
public ulong id { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(128)]
|
||||||
|
public string name { get; set; } = null!;
|
||||||
|
|
||||||
|
public ulong permissionId { get; set; }
|
||||||
|
|
||||||
|
public DateTime updated { get; set; }
|
||||||
|
|
||||||
|
public ulong updater { get; set; }
|
||||||
|
|
||||||
|
public Grant adaptToModel()
|
||||||
|
{
|
||||||
|
return new Grant
|
||||||
|
{
|
||||||
|
id = id,
|
||||||
|
name = name,
|
||||||
|
permissionId = permissionId,
|
||||||
|
updated = updated,
|
||||||
|
updater = updater
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
API/DTO/Base/ImageDTO.cs
Normal file
32
API/DTO/Base/ImageDTO.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using DAL.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace API.DTO.Base
|
||||||
|
{
|
||||||
|
public class ImageDTO : IAdaptable<Image>
|
||||||
|
{
|
||||||
|
public ulong id { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(64)]
|
||||||
|
public string name { get; set; } = null!;
|
||||||
|
|
||||||
|
[MaxLength(128)]
|
||||||
|
public string filename { get; set; } = null!;
|
||||||
|
|
||||||
|
public DateTime updated { get; set; }
|
||||||
|
|
||||||
|
public ulong updater { get; set; }
|
||||||
|
|
||||||
|
public Image adaptToModel()
|
||||||
|
{
|
||||||
|
return new Image
|
||||||
|
{
|
||||||
|
id = id,
|
||||||
|
name = name,
|
||||||
|
filename = filename,
|
||||||
|
updated = updated,
|
||||||
|
updater = updater
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
API/DTO/Base/PermissionDTO.cs
Normal file
28
API/DTO/Base/PermissionDTO.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using DAL.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace API.DTO.Base
|
||||||
|
{
|
||||||
|
public class PermissionDTO : IAdaptable<Permission>
|
||||||
|
{
|
||||||
|
public ulong id { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(64)]
|
||||||
|
public string name { get; set; } = null!;
|
||||||
|
|
||||||
|
public DateTime updated { get; set; }
|
||||||
|
|
||||||
|
public ulong updater { get; set; }
|
||||||
|
|
||||||
|
public Permission adaptToModel()
|
||||||
|
{
|
||||||
|
return new Permission
|
||||||
|
{
|
||||||
|
id = id,
|
||||||
|
name = name,
|
||||||
|
updated = updated,
|
||||||
|
updater = updater
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
API/DTO/Base/SavedEventDTO.cs
Normal file
37
API/DTO/Base/SavedEventDTO.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using DAL.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace API.DTO.Base
|
||||||
|
{
|
||||||
|
public class SavedEventDTO : IAdaptable<SavedEvent>
|
||||||
|
{
|
||||||
|
public ulong id { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(64)]
|
||||||
|
public string name { get; set; } = null!;
|
||||||
|
|
||||||
|
public ulong bgColorId { get; set; }
|
||||||
|
|
||||||
|
public ulong fgColorId { get; set; }
|
||||||
|
|
||||||
|
public ulong? imageId { get; set; }
|
||||||
|
|
||||||
|
public DateTime updated { get; set; }
|
||||||
|
|
||||||
|
public ulong updater { get; set; }
|
||||||
|
|
||||||
|
public SavedEvent adaptToModel()
|
||||||
|
{
|
||||||
|
return new SavedEvent
|
||||||
|
{
|
||||||
|
id = id,
|
||||||
|
name = name,
|
||||||
|
bgColorId = bgColorId,
|
||||||
|
fgColorId = fgColorId,
|
||||||
|
imageId = imageId,
|
||||||
|
updated = updated,
|
||||||
|
updater = updater
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
API/DTO/Base/UserDTO.cs
Normal file
38
API/DTO/Base/UserDTO.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using DAL.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace API.DTO.Base
|
||||||
|
{
|
||||||
|
public class UserDTO : IAdaptable<User>
|
||||||
|
{
|
||||||
|
public ulong id { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(64)]
|
||||||
|
public string firstName { get; set; } = null!;
|
||||||
|
|
||||||
|
[MaxLength(64)]
|
||||||
|
public string lastName { get; set; } = null!;
|
||||||
|
|
||||||
|
public ulong phoneNumber { get; set; }
|
||||||
|
|
||||||
|
public ulong permissionId { get; set; }
|
||||||
|
|
||||||
|
public DateTime updated { get; set; }
|
||||||
|
|
||||||
|
public ulong updater { get; set; }
|
||||||
|
|
||||||
|
public User adaptToModel()
|
||||||
|
{
|
||||||
|
return new User
|
||||||
|
{
|
||||||
|
id = id,
|
||||||
|
firstName = firstName,
|
||||||
|
lastName = lastName,
|
||||||
|
phoneNumber = phoneNumber,
|
||||||
|
permissionId = permissionId,
|
||||||
|
updated = updated,
|
||||||
|
updater = updater
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user