Compare commits
4 Commits
08efea943c
...
6876b623ac
Author | SHA1 | Date | |
---|---|---|---|
6876b623ac | |||
2a99a5ba62 | |||
e5522ed559 | |||
d5642e4744 |
@ -12,7 +12,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-preview.3.24172.4"/>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2-dev-00338" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2-dev-00338"/>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -18,8 +18,8 @@ namespace API.Controllers
|
||||
where TService : ServiceBase<TService, TDTO, TModel, TAuditModel, TAuthentication>
|
||||
{
|
||||
public readonly ILogger<TLoggerCategory> Logger;
|
||||
public readonly UserService UserService;
|
||||
public readonly TService Service;
|
||||
public readonly UserService UserService;
|
||||
|
||||
public CRUDBase(ILogger<TLoggerCategory> logger, UserService userService, TService service)
|
||||
{
|
||||
|
19
API/Controllers/EventController.cs
Normal file
19
API/Controllers/EventController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using API.Authentication.Interfaces;
|
||||
using API.DTO.Base;
|
||||
using API.DTO.Base.Update;
|
||||
using API.Services;
|
||||
using DAL.Models;
|
||||
using DAL.Models.Audits;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class EventController : CRUDBase<EventController, EventDTO, EventUpdateDTO, Event, AuditEvent, IYesAuthentication, EventService>
|
||||
{
|
||||
public EventController(ILogger<EventController> logger, UserService userService, EventService service) : base(logger, userService, service)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
19
API/Controllers/GrantController.cs
Normal file
19
API/Controllers/GrantController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using API.Authentication.Interfaces;
|
||||
using API.DTO.Base;
|
||||
using API.DTO.Base.Update;
|
||||
using API.Services;
|
||||
using DAL.Models;
|
||||
using DAL.Models.Audits;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class GrantController : CRUDBase<GrantController, GrantDTO, GrantUpdateDTO, Grant, AuditGrant, IYesAuthentication, GrantService>
|
||||
{
|
||||
public GrantController(ILogger<GrantController> logger, UserService userService, GrantService service) : base(logger, userService, service)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
19
API/Controllers/ImageController.cs
Normal file
19
API/Controllers/ImageController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using API.Authentication.Interfaces;
|
||||
using API.DTO.Base;
|
||||
using API.DTO.Base.Update;
|
||||
using API.Services;
|
||||
using DAL.Models;
|
||||
using DAL.Models.Audits;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class ImageController : CRUDBase<ImageController, ImageDTO, ImageUpdateDTO, Image, AuditImage, IYesAuthentication, ImageService>
|
||||
{
|
||||
public ImageController(ILogger<ImageController> logger, UserService userService, ImageService service) : base(logger, userService, service)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
19
API/Controllers/PermissionController.cs
Normal file
19
API/Controllers/PermissionController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using API.Authentication.Interfaces;
|
||||
using API.DTO.Base;
|
||||
using API.DTO.Base.Update;
|
||||
using API.Services;
|
||||
using DAL.Models;
|
||||
using DAL.Models.Audits;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class PermissionController : CRUDBase<PermissionController, PermissionDTO, PermissionUpdateDTO, Permission, AuditPermission, IYesAuthentication, PermissionService>
|
||||
{
|
||||
public PermissionController(ILogger<PermissionController> logger, UserService userService, PermissionService service) : base(logger, userService, service)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
19
API/Controllers/SavedEventController.cs
Normal file
19
API/Controllers/SavedEventController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using API.Authentication.Interfaces;
|
||||
using API.DTO.Base;
|
||||
using API.DTO.Base.Update;
|
||||
using API.Services;
|
||||
using DAL.Models;
|
||||
using DAL.Models.Audits;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class SavedEventController : CRUDBase<SavedEventController, SavedEventDTO, SavedEventUpdateDTO, SavedEvent, AuditSavedEvent, IYesAuthentication, SavedEventService>
|
||||
{
|
||||
public SavedEventController(ILogger<SavedEventController> logger, UserService userService, SavedEventService service) : base(logger, userService, service)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
19
API/Controllers/UserController.cs
Normal file
19
API/Controllers/UserController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using API.Authentication.Interfaces;
|
||||
using API.DTO.Base;
|
||||
using API.DTO.Base.Update;
|
||||
using API.Services;
|
||||
using DAL.Models;
|
||||
using DAL.Models.Audits;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class UserController : CRUDBase<UserController, UserDTO, UserUpdateDTO, User, AuditUser, IYesAuthentication, UserService>
|
||||
{
|
||||
public UserController(ILogger<UserController> logger, UserService userService, UserService service) : base(logger, userService, service)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -23,7 +23,9 @@ namespace API.DTO.Base
|
||||
red = red,
|
||||
blue = blue,
|
||||
green = green,
|
||||
name = name
|
||||
name = name,
|
||||
updated = updated,
|
||||
updater = updater
|
||||
};
|
||||
}
|
||||
public void adaptFromModel(in Color model)
|
||||
@ -33,6 +35,8 @@ namespace API.DTO.Base
|
||||
blue = model.blue;
|
||||
green = model.green;
|
||||
name = model.name;
|
||||
updated = model.updated;
|
||||
updater = model.updater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace API.DTO.Base
|
||||
public ulong savedEventId { get; set; }
|
||||
|
||||
[MaxLength(64)]
|
||||
public string? name { get; set; } = null!;
|
||||
public string? name { get; set; }
|
||||
|
||||
public ulong? bgColorId { get; set; }
|
||||
public ulong? fgColorId { get; set; }
|
||||
@ -35,7 +35,15 @@ namespace API.DTO.Base
|
||||
}
|
||||
public void adaptFromModel(in Event model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
id = model.id;
|
||||
savedEventId = model.savedEventId;
|
||||
name = model.name;
|
||||
bgColorId = model.bgColorId;
|
||||
fgColorId = model.fgColorId;
|
||||
imageId = model.imageId;
|
||||
hidden = model.hidden;
|
||||
updated = model.updated;
|
||||
updater = model.updater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,11 @@ namespace API.DTO.Base
|
||||
}
|
||||
public void adaptFromModel(in Grant model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
id = model.id;
|
||||
name = model.name;
|
||||
permissionId = model.permissionId;
|
||||
updated = model.updated;
|
||||
updater = model.updater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,11 @@ namespace API.DTO.Base
|
||||
}
|
||||
public void adaptFromModel(in Image model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
id = model.id;
|
||||
name = model.name;
|
||||
filename = model.filename;
|
||||
updated = model.updated;
|
||||
updater = model.updater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,10 @@ namespace API.DTO.Base
|
||||
}
|
||||
public void adaptFromModel(in Permission model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
id = model.id;
|
||||
name = model.name;
|
||||
updated = model.updated;
|
||||
updater = model.updater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,13 @@ namespace API.DTO.Base
|
||||
}
|
||||
public void adaptFromModel(in SavedEvent model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
id = model.id;
|
||||
name = model.name;
|
||||
bgColorId = model.bgColorId;
|
||||
fgColorId = model.fgColorId;
|
||||
imageId = model.imageId;
|
||||
updated = model.updated;
|
||||
updater = model.updater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
28
API/DTO/Base/Update/EventUpdateDTO.cs
Normal file
28
API/DTO/Base/Update/EventUpdateDTO.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using DAL.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.DTO.Base.Update
|
||||
{
|
||||
public class EventUpdateDTO : IUpdateAdaptable<Event>
|
||||
{
|
||||
public ulong? savedEventId { get; set; }
|
||||
|
||||
[MaxLength(64)]
|
||||
public UnSettable<string?>? name { get; set; }
|
||||
|
||||
public UnSettable<ulong?>? bgColorId { get; set; }
|
||||
public UnSettable<ulong?>? fgColorId { get; set; }
|
||||
public UnSettable<ulong?>? imageId { get; set; }
|
||||
public bool? hidden { get; set; }
|
||||
|
||||
public void adaptModel(ref Event model)
|
||||
{
|
||||
if (savedEventId != null) model.savedEventId = (ulong)savedEventId;
|
||||
if (name != null) model.name = ((UnSettable<string?>)name).value;
|
||||
if (bgColorId != null) model.bgColorId = bgColorId.Value.value;
|
||||
if (fgColorId != null) model.bgColorId = fgColorId.Value.value;
|
||||
if (imageId != null) model.imageId = imageId.Value.value;
|
||||
if (hidden != null) model.hidden = (bool)hidden;
|
||||
}
|
||||
}
|
||||
}
|
19
API/DTO/Base/Update/GrantUpdateDTO.cs
Normal file
19
API/DTO/Base/Update/GrantUpdateDTO.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using DAL.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.DTO.Base.Update
|
||||
{
|
||||
public class GrantUpdateDTO : IUpdateAdaptable<Grant>
|
||||
{
|
||||
[MaxLength(128)]
|
||||
public string? name { get; set; }
|
||||
|
||||
public ulong? permissionId { get; set; }
|
||||
|
||||
public void adaptModel(ref Grant model)
|
||||
{
|
||||
if (name != null) model.name = name;
|
||||
if (permissionId != null) model.permissionId = (ulong)permissionId;
|
||||
}
|
||||
}
|
||||
}
|
20
API/DTO/Base/Update/ImageUpdateDTO.cs
Normal file
20
API/DTO/Base/Update/ImageUpdateDTO.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using DAL.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.DTO.Base.Update
|
||||
{
|
||||
public class ImageUpdateDTO : IUpdateAdaptable<Image>
|
||||
{
|
||||
[MaxLength(64)]
|
||||
public string? name { get; set; }
|
||||
|
||||
[MaxLength(128)]
|
||||
public string? filename { get; set; }
|
||||
|
||||
public void adaptModel(ref Image model)
|
||||
{
|
||||
if (name != null) model.name = name;
|
||||
if (filename != null) model.filename = filename;
|
||||
}
|
||||
}
|
||||
}
|
16
API/DTO/Base/Update/PermissionUpdateDTO.cs
Normal file
16
API/DTO/Base/Update/PermissionUpdateDTO.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using DAL.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.DTO.Base.Update
|
||||
{
|
||||
public class PermissionUpdateDTO : IUpdateAdaptable<Permission>
|
||||
{
|
||||
[MaxLength(64)]
|
||||
public string? name { get; set; }
|
||||
|
||||
public void adaptModel(ref Permission model)
|
||||
{
|
||||
if (name != null) model.name = name;
|
||||
}
|
||||
}
|
||||
}
|
25
API/DTO/Base/Update/SavedEventUpdateDTO.cs
Normal file
25
API/DTO/Base/Update/SavedEventUpdateDTO.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using DAL.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.DTO.Base.Update
|
||||
{
|
||||
public class SavedEventUpdateDTO : IUpdateAdaptable<SavedEvent>
|
||||
{
|
||||
[MaxLength(64)]
|
||||
public string? name { get; set; }
|
||||
|
||||
public ulong? bgColorId { get; set; }
|
||||
|
||||
public ulong? fgColorId { get; set; }
|
||||
|
||||
public UnSettable<ulong?>? imageId { get; set; }
|
||||
|
||||
public void adaptModel(ref SavedEvent model)
|
||||
{
|
||||
if (name != null) model.name = name;
|
||||
if (bgColorId != null) model.bgColorId = (ulong)bgColorId;
|
||||
if (fgColorId != null) model.fgColorId = (ulong)fgColorId;
|
||||
if (imageId != null) model.imageId = imageId.Value.value;
|
||||
}
|
||||
}
|
||||
}
|
26
API/DTO/Base/Update/UserUpdateDTO.cs
Normal file
26
API/DTO/Base/Update/UserUpdateDTO.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using DAL.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.DTO.Base.Update
|
||||
{
|
||||
public class UserUpdateDTO : IUpdateAdaptable<User>
|
||||
{
|
||||
[MaxLength(64)]
|
||||
public string? firstName { get; set; }
|
||||
|
||||
[MaxLength(64)]
|
||||
public string? lastName { get; set; }
|
||||
|
||||
public ulong? phoneNumber { get; set; }
|
||||
|
||||
public ulong? permissionId { get; set; }
|
||||
|
||||
public void adaptModel(ref User model)
|
||||
{
|
||||
if (firstName != null) model.firstName = firstName;
|
||||
if (lastName != null) model.lastName = lastName;
|
||||
if (phoneNumber != null) model.phoneNumber = (ulong)phoneNumber;
|
||||
if (permissionId != null) model.permissionId = (ulong)permissionId;
|
||||
}
|
||||
}
|
||||
}
|
@ -36,7 +36,13 @@ namespace API.DTO.Base
|
||||
}
|
||||
public void adaptFromModel(in User model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
id = model.id;
|
||||
firstName = model.firstName;
|
||||
lastName = model.lastName;
|
||||
phoneNumber = model.phoneNumber;
|
||||
permissionId = model.permissionId;
|
||||
updated = model.updated;
|
||||
updater = model.updater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
API/DTO/UnSettable.cs
Normal file
7
API/DTO/UnSettable.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace API.DTO
|
||||
{
|
||||
public struct UnSettable<T>
|
||||
{
|
||||
public T value { get; set; }
|
||||
}
|
||||
}
|
@ -7,12 +7,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-preview.3.24172.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MySql.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-preview.3.24172.4"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MySql.EntityFrameworkCore" Version="8.0.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user