Compare commits
39 Commits
547b8f0a01
...
1b21ccecf3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b21ccecf3 | ||
|
|
56344afdc8 | ||
|
|
dbbe07405b | ||
|
|
908dd6f170 | ||
|
|
dfb3dc3d08 | ||
|
|
9f175bc4e9 | ||
|
|
1453f9adb1 | ||
|
|
21956cfc16 | ||
|
|
1e6d247817 | ||
|
|
adc33bfee1 | ||
|
|
5ce6958122 | ||
|
|
23e2267d00 | ||
|
|
bc9ac273ea | ||
|
|
b0896c214f | ||
|
|
e1f0d611e5 | ||
|
|
8ff6bbf93f | ||
|
|
650b23def9 | ||
|
|
859f0631f0 | ||
|
|
31bf58919d | ||
|
|
480dcce051 | ||
|
|
e0877f5990 | ||
|
|
845f7fe729 | ||
|
|
a7081d3f74 | ||
|
|
e1ec8c581c | ||
|
|
c76f9d1709 | ||
|
|
4bcac51473 | ||
|
|
1f4c7589d0 | ||
|
|
8290699b2f | ||
|
|
f611847e2a | ||
|
|
3c5df5bc6a | ||
|
|
3f70bdc8f7 | ||
|
|
f0b182fb94 | ||
|
|
3d35c1ab21 | ||
|
|
16f694eb67 | ||
|
|
5dab28d99d | ||
|
|
1df7858423 | ||
|
|
cb5a6afde0 | ||
|
|
d4d6c29225 | ||
|
|
dd15b520c1 |
10
WorkFlow.Application/Contracts/IConfigService.cs
Normal file
10
WorkFlow.Application/Contracts/IConfigService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using WorkFlow.Application.DTO.Config;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Application.Contracts
|
||||
{
|
||||
public interface IConfigService : ICRUDService<ConfigCreateDto, ConfigDto, ConfigUpdateDto, Config, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
10
WorkFlow.Application/Contracts/IProfileControlsTFService.cs
Normal file
10
WorkFlow.Application/Contracts/IProfileControlsTFService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using WorkFlow.Application.DTO.ProfileControlsTF;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Application.Contracts
|
||||
{
|
||||
public interface IProfileControlsTFService : ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTFUpdateDto, ProfileControlsTF, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
10
WorkFlow.Application/Contracts/IProfileObjStateService.cs
Normal file
10
WorkFlow.Application/Contracts/IProfileObjStateService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using WorkFlow.Application.DTO.ProfileObjState;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Application.Contracts
|
||||
{
|
||||
public interface IProfileObjStateService : ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjStateUpdateDto, ProfileObjState, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
10
WorkFlow.Application/Contracts/IProfileService.cs
Normal file
10
WorkFlow.Application/Contracts/IProfileService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using WorkFlow.Application.DTO.Profile;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Application.Contracts
|
||||
{
|
||||
public interface IProfileService : ICRUDService<ProfileCreateDto, ProfileDto, ProfileUpdateDto, Profile, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
10
WorkFlow.Application/Contracts/IStateService.cs
Normal file
10
WorkFlow.Application/Contracts/IStateService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using WorkFlow.Application.DTO.State;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Application.Contracts
|
||||
{
|
||||
public interface IStateService : ICRUDService<StateCreateDto, StateDto, StateUpdateDto, State, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
25
WorkFlow.Application/DIExtensions.cs
Normal file
25
WorkFlow.Application/DIExtensions.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using WorkFlow.Application.Contracts;
|
||||
using WorkFlow.Application.Services;
|
||||
using WorkFlow.Infrastructure;
|
||||
|
||||
namespace WorkFlow.Application
|
||||
{
|
||||
public static class DIExtensions
|
||||
{
|
||||
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddAutoMapper(typeof(MappingProfile).Assembly);
|
||||
services.TryAddScoped<IConfigService, ConfigService>();
|
||||
services.TryAddScoped<IProfileControlsTFService, ProfileControlsTFService>();
|
||||
services.TryAddScoped<IProfileObjStateService, ProfileObjStateService>();
|
||||
services.TryAddScoped<IProfileService, ProfileService>();
|
||||
services.TryAddScoped<IStateService, StateService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddWorkFlow(this IServiceCollection services) => services.AddWorkFlowRepositories().AddWorkFlowServices();
|
||||
}
|
||||
}
|
||||
13
WorkFlow.Application/DTO/BaseCreateDto.cs
Normal file
13
WorkFlow.Application/DTO/BaseCreateDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WorkFlow.Application.DTO
|
||||
{
|
||||
public record BaseCreateDto
|
||||
{
|
||||
[JsonIgnore]
|
||||
public required string AddedWho { get; set; } = "UNKNOWN";
|
||||
|
||||
[JsonIgnore]
|
||||
public required DateTime AddedWhen = DateTime.Now;
|
||||
}
|
||||
}
|
||||
16
WorkFlow.Application/DTO/BaseUpdateDto.cs
Normal file
16
WorkFlow.Application/DTO/BaseUpdateDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WorkFlow.Application.DTO
|
||||
{
|
||||
public record BaseUpdateDto : IUnique<int>
|
||||
{
|
||||
public required int Id { get; init; }
|
||||
|
||||
[JsonIgnore]
|
||||
public required string ChangedWho { get; set; } = "UNKNOWN";
|
||||
|
||||
[JsonIgnore]
|
||||
public required DateTime ChangedWhen = DateTime.Now;
|
||||
}
|
||||
}
|
||||
4
WorkFlow.Application/DTO/Config/ConfigCreateDto.cs
Normal file
4
WorkFlow.Application/DTO/Config/ConfigCreateDto.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace WorkFlow.Application.DTO.Config
|
||||
{
|
||||
public record ConfigCreateDto(string Title, string String);
|
||||
}
|
||||
10
WorkFlow.Application/DTO/Config/ConfigDto.cs
Normal file
10
WorkFlow.Application/DTO/Config/ConfigDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace WorkFlow.Application.DTO.Config
|
||||
{
|
||||
public record ConfigDto(int Id,
|
||||
string Title,
|
||||
string String,
|
||||
string AddedWho,
|
||||
DateTime AddedWhen,
|
||||
string? ChangedWho = null,
|
||||
DateTime? ChangedWhen = null);
|
||||
}
|
||||
4
WorkFlow.Application/DTO/Config/ConfigUpdateDto.cs
Normal file
4
WorkFlow.Application/DTO/Config/ConfigUpdateDto.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace WorkFlow.Application.DTO.Config
|
||||
{
|
||||
public record ConfigUpdateDto(string Title, string String) : BaseUpdateDto;
|
||||
}
|
||||
4
WorkFlow.Application/DTO/Profile/ProfileCreateDto.cs
Normal file
4
WorkFlow.Application/DTO/Profile/ProfileCreateDto.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace WorkFlow.Application.DTO.Profile
|
||||
{
|
||||
public record ProfileCreateDto(string IntlName, int ExtId1, bool Active, byte TypeId) : BaseCreateDto;
|
||||
}
|
||||
12
WorkFlow.Application/DTO/Profile/ProfileDto.cs
Normal file
12
WorkFlow.Application/DTO/Profile/ProfileDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace WorkFlow.Application.DTO.Profile
|
||||
{
|
||||
public record ProfileDto(int Id,
|
||||
string IntlName,
|
||||
int ExtId1,
|
||||
bool Active,
|
||||
byte TypeId,
|
||||
string AddedWho,
|
||||
DateTime AddedWhen,
|
||||
string? ChangedWho = null,
|
||||
DateTime? ChangedWhen = null);
|
||||
}
|
||||
4
WorkFlow.Application/DTO/Profile/ProfileUpdateDto.cs
Normal file
4
WorkFlow.Application/DTO/Profile/ProfileUpdateDto.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace WorkFlow.Application.DTO.Profile
|
||||
{
|
||||
public record ProfileUpdateDto(string IntlName, int ExtId1, bool Active, byte TypeId) : BaseUpdateDto;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace WorkFlow.Application.DTO.ProfileControlsTF
|
||||
{
|
||||
public record ProfileControlsTFCreateDto(int Id,
|
||||
int ProfileId,
|
||||
int UsrId,
|
||||
long ObjId,
|
||||
string ObjType,
|
||||
string AttrName,
|
||||
string CtrlType,
|
||||
string CtrlCaption,
|
||||
bool Mandatory,
|
||||
bool ReadOnly,
|
||||
string? ChoiceList = null) : BaseCreateDto;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using WorkFlow.Application.DTO.Profile;
|
||||
|
||||
namespace WorkFlow.Application.DTO.ProfileControlsTF
|
||||
{
|
||||
public record ProfileControlsTFDto(int Id,
|
||||
int ProfileId,
|
||||
int UsrId,
|
||||
long ObjId,
|
||||
string ObjType,
|
||||
string AttrName,
|
||||
string CtrlType,
|
||||
string CtrlCaption,
|
||||
bool Mandatory,
|
||||
bool ReadOnly,
|
||||
string AddedWho,
|
||||
DateTime AddedWhen,
|
||||
string? ChoiceList = null,
|
||||
ProfileDto? Profile = null,
|
||||
UserReadDto? User = null);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace WorkFlow.Application.DTO.ProfileControlsTF
|
||||
{
|
||||
/// <summary>
|
||||
/// This Data Transfer Object (DTO) serves as a placeholder and does not support updates.
|
||||
/// </summary>
|
||||
public record ProfileControlsTFUpdateDto(int Id) : IUnique<int>;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace WorkFlow.Application.DTO.ProfileObjState
|
||||
{
|
||||
public record ProfileObjStateCreateDto(
|
||||
int ProfileId,
|
||||
int UsrId,
|
||||
long ObjId,
|
||||
int StateId,
|
||||
string? State2 = null,
|
||||
string? State3 = null,
|
||||
string? State4 = null) : BaseCreateDto;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using WorkFlow.Application.DTO.Profile;
|
||||
using WorkFlow.Application.DTO.State;
|
||||
|
||||
namespace WorkFlow.Application.DTO.ProfileObjState
|
||||
{
|
||||
public record ProfileObjStateDto(int Id,
|
||||
int ProfileId,
|
||||
int UsrId,
|
||||
long ObjId,
|
||||
int StateId,
|
||||
string AddedWho,
|
||||
DateTime AddedWhen,
|
||||
string? State2 = null,
|
||||
string? State3 = null,
|
||||
string? State4 = null,
|
||||
ProfileDto? Profile = null,
|
||||
UserReadDto? User = null,
|
||||
StateDto? State = null);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace WorkFlow.Application.DTO.ProfileObjState
|
||||
{
|
||||
/// <summary>
|
||||
/// This Data Transfer Object (DTO) serves as a placeholder and does not support updates.
|
||||
/// </summary>
|
||||
public record ProfileObjStateUpdateDto(int Id) : IUnique<int>;
|
||||
}
|
||||
4
WorkFlow.Application/DTO/State/StateCreateDto.cs
Normal file
4
WorkFlow.Application/DTO/State/StateCreateDto.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace WorkFlow.Application.DTO.State
|
||||
{
|
||||
public record StateCreateDto(string IntlState) : BaseCreateDto;
|
||||
}
|
||||
4
WorkFlow.Application/DTO/State/StateDto.cs
Normal file
4
WorkFlow.Application/DTO/State/StateDto.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace WorkFlow.Application.DTO.State
|
||||
{
|
||||
public record StateDto(int Id, string IntlState, string AddedWho, DateTime AddedWhen);
|
||||
}
|
||||
9
WorkFlow.Application/DTO/State/StateUpdateDto.cs
Normal file
9
WorkFlow.Application/DTO/State/StateUpdateDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace WorkFlow.Application.DTO.State
|
||||
{
|
||||
/// <summary>
|
||||
/// This Data Transfer Object (DTO) serves as a placeholder and does not support updates.
|
||||
/// </summary>
|
||||
public record StateUpdateDto(int Id) : IUnique<int>;
|
||||
}
|
||||
37
WorkFlow.Application/MappingProfile.cs
Normal file
37
WorkFlow.Application/MappingProfile.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using AutoMapper;
|
||||
using WorkFlow.Application.DTO.Config;
|
||||
using WorkFlow.Application.DTO.Profile;
|
||||
using WorkFlow.Application.DTO.ProfileControlsTF;
|
||||
using WorkFlow.Application.DTO.ProfileObjState;
|
||||
using WorkFlow.Application.DTO.State;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Application
|
||||
{
|
||||
public class MappingProfile : AutoMapper.Profile
|
||||
{
|
||||
public MappingProfile()
|
||||
{
|
||||
// Mapping entity to DTO
|
||||
CreateMap<Config, ConfigDto>();
|
||||
CreateMap<Domain.Entities.Profile, ProfileDto>();
|
||||
CreateMap<ProfileControlsTF, ProfileControlsTFDto>();
|
||||
CreateMap<ProfileObjState, ProfileObjStateDto>();
|
||||
CreateMap<State, StateDto>();
|
||||
|
||||
// Mapping create-DTO to entity
|
||||
CreateMap<ConfigCreateDto, Config>();
|
||||
CreateMap<ProfileCreateDto, Domain.Entities.Profile>();
|
||||
CreateMap<ProfileControlsTFCreateDto, ProfileControlsTF>();
|
||||
CreateMap<ProfileObjStateCreateDto, ProfileObjState>();
|
||||
CreateMap<StateCreateDto, State>();
|
||||
|
||||
// Mapping update-DTO to entity
|
||||
CreateMap<ConfigUpdateDto, Config>();
|
||||
CreateMap<ProfileUpdateDto, Domain.Entities.Profile>();
|
||||
CreateMap<ProfileControlsTFUpdateDto, ProfileControlsTF>();
|
||||
CreateMap<ProfileObjStateUpdateDto, ProfileObjState>();
|
||||
CreateMap<StateUpdateDto, State>();
|
||||
}
|
||||
}
|
||||
}
|
||||
16
WorkFlow.Application/Services/ConfigService.cs
Normal file
16
WorkFlow.Application/Services/ConfigService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Application;
|
||||
using WorkFlow.Application.Contracts;
|
||||
using WorkFlow.Application.DTO.Config;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Application.Services
|
||||
{
|
||||
public class ConfigService(IConfigRepository repository, IMapper mapper)
|
||||
: CRUDService<IConfigRepository, ConfigCreateDto, ConfigDto, ConfigUpdateDto, Config, int>(repository, mapper),
|
||||
IConfigService, ICRUDService<ConfigCreateDto, ConfigDto, ConfigUpdateDto, Config, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
16
WorkFlow.Application/Services/ProfileControlsTFService.cs
Normal file
16
WorkFlow.Application/Services/ProfileControlsTFService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Application;
|
||||
using WorkFlow.Application.Contracts;
|
||||
using WorkFlow.Application.DTO.ProfileControlsTF;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Repositories;
|
||||
|
||||
namespace WorkFlow.Application.Services
|
||||
{
|
||||
public class ProfileControlsTFService(ProfileControlsTFRepository repository, IMapper mapper)
|
||||
: CRUDService<ProfileControlsTFRepository, ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTFUpdateDto, ProfileControlsTF, int>(repository, mapper),
|
||||
IProfileControlsTFService, ICRUDService<ProfileControlsTFCreateDto, ProfileControlsTFDto, ProfileControlsTFUpdateDto, ProfileControlsTF, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
16
WorkFlow.Application/Services/ProfileObjStateService.cs
Normal file
16
WorkFlow.Application/Services/ProfileObjStateService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Application;
|
||||
using WorkFlow.Application.Contracts;
|
||||
using WorkFlow.Application.DTO.ProfileObjState;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Application.Services
|
||||
{
|
||||
public class ProfileObjStateService(IProfileObjStateRepository repository, IMapper mapper)
|
||||
: CRUDService<IProfileObjStateRepository, ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjStateUpdateDto, ProfileObjState, int>(repository, mapper),
|
||||
IProfileObjStateService, ICRUDService<ProfileObjStateCreateDto, ProfileObjStateDto, ProfileObjStateUpdateDto, ProfileObjState, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
15
WorkFlow.Application/Services/ProfileService.cs
Normal file
15
WorkFlow.Application/Services/ProfileService.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Application;
|
||||
using WorkFlow.Application.Contracts;
|
||||
using WorkFlow.Application.DTO.Profile;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Application.Services
|
||||
{
|
||||
public class ProfileService(IProfileRepository repository, AutoMapper.IMapper mapper)
|
||||
: CRUDService<IProfileRepository, ProfileCreateDto, ProfileDto, ProfileUpdateDto, Profile, int>(repository, mapper),
|
||||
IProfileService, ICRUDService<ProfileCreateDto, ProfileDto, ProfileUpdateDto, Profile, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
16
WorkFlow.Application/Services/StateService.cs
Normal file
16
WorkFlow.Application/Services/StateService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Application;
|
||||
using WorkFlow.Application.Contracts;
|
||||
using WorkFlow.Application.DTO.State;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Application.Services
|
||||
{
|
||||
public class StateService(IStateRepository repository, IMapper mapper)
|
||||
: CRUDService<IStateRepository, StateCreateDto, StateDto, StateUpdateDto, State, int>(repository, mapper),
|
||||
IStateService, ICRUDService<StateCreateDto, StateDto, StateUpdateDto, State, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
19
WorkFlow.Application/WorkFlow.Application.csproj
Normal file
19
WorkFlow.Application/WorkFlow.Application.csproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DigitalData.Core.Application" Version="2.0.0" />
|
||||
<PackageReference Include="UserManager.Application" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WorkFlow.Domain\WorkFlow.Domain.csproj" />
|
||||
<ProjectReference Include="..\WorkFlow.Infrastructure\WorkFlow.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,10 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WorkFlow.Domain.Entities
|
||||
{
|
||||
[Table("TBMWF_CONFIG", Schema = "dbo")]
|
||||
public class Config
|
||||
public class Config : IUnique<int>
|
||||
{
|
||||
[Key]
|
||||
[Column("GUID")]
|
||||
@@ -12,11 +13,11 @@ namespace WorkFlow.Domain.Entities
|
||||
|
||||
[Required]
|
||||
[Column("CONF_TITLE", TypeName = "varchar(100)")]
|
||||
public required string ConfTitle { get; init; }
|
||||
public required string Title { get; init; }
|
||||
|
||||
[Required]
|
||||
[Column("CONF_STRING", TypeName = "varchar(900)")]
|
||||
public required string ConfString { get; init; }
|
||||
public required string String { get; init; }
|
||||
|
||||
[Required]
|
||||
[Column("ADDED_WHO", TypeName = "varchar(30)")]
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WorkFlow.Domain.Entities
|
||||
{
|
||||
[Table("TBMWF_PROFILE", Schema = "dbo")]
|
||||
public class Profile
|
||||
public class Profile : IUnique<int>
|
||||
{
|
||||
[Key]
|
||||
[Column("GUID")]
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WorkFlow.Domain.Entities
|
||||
{
|
||||
[Table("TBMWF_PROF_CONTROLS_TF", Schema = "dbo")]
|
||||
public class ProfControlsTf
|
||||
public class ProfileControlsTF : IUnique<int>
|
||||
{
|
||||
[Key]
|
||||
[Column("GUID")]
|
||||
@@ -12,7 +14,7 @@ namespace WorkFlow.Domain.Entities
|
||||
|
||||
[Required]
|
||||
[Column("MWF_PROFILE_ID")]
|
||||
public required int MwfProfileId { get; init; }
|
||||
public required int ProfileId { get; init; }
|
||||
|
||||
[Required]
|
||||
[Column("USR_ID")]
|
||||
@@ -57,7 +59,10 @@ namespace WorkFlow.Domain.Entities
|
||||
[Column("ADDED_WHEN", TypeName = "datetime")]
|
||||
public required DateTime AddedWhen { get; init; }
|
||||
|
||||
[ForeignKey("MwfProfileId")]
|
||||
public Profile? MwfProfile { get; init; } = default;
|
||||
[ForeignKey("ProfileId")]
|
||||
public Profile? Profile { get; init; } = default;
|
||||
|
||||
[ForeignKey("UsrId")]
|
||||
public User? User { get; set; } = default;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WorkFlow.Domain.Entities
|
||||
{
|
||||
[Table("TBMWF_PROFILE_OBJ_STATE", Schema = "dbo")]
|
||||
public class ProfileObjState
|
||||
public class ProfileObjState : IUnique<int>
|
||||
{
|
||||
[Key]
|
||||
[Column("GUID")]
|
||||
@@ -12,7 +14,7 @@ namespace WorkFlow.Domain.Entities
|
||||
|
||||
[Required]
|
||||
[Column("MWF_PROFILE_ID")]
|
||||
public required int MwfProfileId { get; init; }
|
||||
public required int ProfileId { get; init; }
|
||||
|
||||
[Required]
|
||||
[Column("USR_ID")]
|
||||
@@ -42,5 +44,14 @@ namespace WorkFlow.Domain.Entities
|
||||
[Required]
|
||||
[Column("ADDED_WHEN", TypeName = "datetime")]
|
||||
public required DateTime AddedWhen { get; init; }
|
||||
|
||||
[ForeignKey("ProfileId")]
|
||||
public Profile? Profile { get; init; } = null;
|
||||
|
||||
[ForeignKey("UsrId")]
|
||||
public User? User { get; init; } = null;
|
||||
|
||||
[ForeignKey("StateId")]
|
||||
public State? State { get; init; } = null;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WorkFlow.Domain.Entities
|
||||
{
|
||||
[Table("TBMWF_WF_STATE", Schema = "dbo")]
|
||||
public class WfState
|
||||
public class State : IUnique<int>
|
||||
{
|
||||
[Key]
|
||||
[Column("GUID")]
|
||||
@@ -6,4 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="UserManager.Domain" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
9
WorkFlow.Infrastructure/Contracts/IConfigRepository.cs
Normal file
9
WorkFlow.Infrastructure/Contracts/IConfigRepository.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Contracts
|
||||
{
|
||||
public interface IConfigRepository : ICRUDRepository<Config, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Contracts
|
||||
{
|
||||
public interface IProfileControlsTFRepository : ICRUDRepository<ProfileControlsTF, int>
|
||||
{
|
||||
Task<IEnumerable<ProfileControlsTF>> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = false, int? profileId = null, int? objId = null, bool? profileActive = null);
|
||||
|
||||
Task<ProfileControlsTF?> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = false, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Contracts
|
||||
{
|
||||
public interface IProfileObjStateRepository : ICRUDRepository<ProfileObjState, int>
|
||||
{
|
||||
Task<IEnumerable<ProfileObjState>> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = true, bool withState = true, int? profileId = null, int? objId = null, bool? profileActive = null);
|
||||
|
||||
Task<ProfileObjState?> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = false, bool withState = true, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null);
|
||||
}
|
||||
}
|
||||
9
WorkFlow.Infrastructure/Contracts/IProfileRepository.cs
Normal file
9
WorkFlow.Infrastructure/Contracts/IProfileRepository.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Contracts
|
||||
{
|
||||
public interface IProfileRepository : ICRUDRepository<Profile, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
9
WorkFlow.Infrastructure/Contracts/IStateRepository.cs
Normal file
9
WorkFlow.Infrastructure/Contracts/IStateRepository.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Contracts
|
||||
{
|
||||
public interface IStateRepository : ICRUDRepository<State, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
21
WorkFlow.Infrastructure/DIExtensions.cs
Normal file
21
WorkFlow.Infrastructure/DIExtensions.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
using WorkFlow.Infrastructure.Repositories;
|
||||
|
||||
namespace WorkFlow.Infrastructure
|
||||
{
|
||||
public static class DIExtensions
|
||||
{
|
||||
public static IServiceCollection AddWorkFlowRepositories(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddScoped<IConfigRepository, ConfigRepository>();
|
||||
services.TryAddScoped<IProfileControlsTFRepository, ProfileControlsTFRepository>();
|
||||
services.TryAddScoped<IProfileObjStateRepository, ProfileObjStateRepository>();
|
||||
services.TryAddScoped<IProfileRepository, ProfileRepository>();
|
||||
services.TryAddScoped<IStateRepository, StateRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
WorkFlow.Infrastructure/Repositories/ConfigRepository.cs
Normal file
11
WorkFlow.Infrastructure/Repositories/ConfigRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Repositories
|
||||
{
|
||||
public class ConfigRepository(WFDBContext dbContext) : CRUDRepository<Config, int, WFDBContext>(dbContext, dbContext.Configs), IConfigRepository, ICRUDRepository<Config, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Repositories
|
||||
{
|
||||
public class ProfileControlsTFRepository(WFDBContext dbContext) : CRUDRepository<ProfileControlsTF, int, WFDBContext>(dbContext, dbContext.ProfileControlsTFs), IProfileControlsTFRepository, ICRUDRepository<ProfileControlsTF, int>
|
||||
{
|
||||
protected override IQueryable<ProfileControlsTF> ReadOnly() => base.ReadOnly().Include(pctf => pctf.Profile).Include(pctf => pctf.User);
|
||||
|
||||
protected IQueryable<ProfileControlsTF> Read(bool isReadonly = false, bool withProfile = true, bool withUser = true, int? profileId = null, int? usrId = null, string? username = null, int? objId = null, bool? profileActive = null)
|
||||
{
|
||||
var query = isReadonly ? _dbSet.AsNoTracking() : _dbSet.AsQueryable();
|
||||
|
||||
if (withProfile)
|
||||
query = query.Include(pctf => pctf.Profile);
|
||||
|
||||
if (withUser)
|
||||
query = query.Include(pctf => pctf.User);
|
||||
|
||||
if (profileId is not null)
|
||||
query = query.Where(pctf => pctf.ProfileId == profileId);
|
||||
|
||||
if (usrId is not null)
|
||||
query = query.Where(pctf => pctf.UsrId == usrId);
|
||||
|
||||
if (username is null)
|
||||
query = query.Where(pctf => pctf.User!.Username == username);
|
||||
|
||||
if (objId is not null)
|
||||
query = query.Where(pctf => pctf.ObjId == objId);
|
||||
|
||||
if (profileActive is not null)
|
||||
query = query.Where(pctf => pctf.Profile!.Active == profileActive);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ProfileControlsTF>> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = true, int? profileId = null, int? objId = null, bool? profileActive = null)
|
||||
=> await Read(isReadonly: isReadonly, withProfile: withProfile, withUser: withUser, profileId: profileId, objId: objId, profileActive: profileActive).ToListAsync();
|
||||
|
||||
public async Task<ProfileControlsTF?> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = false, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null)
|
||||
=> await Read(isReadonly: isReadonly, withProfile: withProfile, withUser: withUser, usrId: usrId, username: username, profileId: profileId, objId: objId, profileActive: profileActive)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Repositories
|
||||
{
|
||||
public class ProfileObjStateRepository(WFDBContext dbContext) : CRUDRepository<ProfileObjState, int, WFDBContext>(dbContext, dbContext.ProfileObjStates), IProfileObjStateRepository, ICRUDRepository<ProfileObjState, int>
|
||||
{
|
||||
protected override IQueryable<ProfileObjState> ReadOnly() => base.ReadOnly().Include(pos => pos.Profile).Include(pos => pos.State);
|
||||
|
||||
protected IQueryable<ProfileObjState> Read(bool isReadonly = false, bool withProfile = true, bool withUser = true, bool withState = true, int? profileId = null, int? usrId = null, string? username = null, int? stateId = null, int? objId = null, bool? profileActive = null)
|
||||
{
|
||||
var query = isReadonly ? _dbSet.AsNoTracking() : _dbSet.AsQueryable();
|
||||
|
||||
if (withProfile)
|
||||
query = query.Include(pctf => pctf.Profile);
|
||||
|
||||
if (withUser)
|
||||
query = query.Include(pctf => pctf.User);
|
||||
|
||||
if (withState)
|
||||
query = query.Include(pctf => pctf.State);
|
||||
|
||||
if (profileId is not null)
|
||||
query = query.Where(pctf => pctf.ProfileId == profileId);
|
||||
|
||||
if (usrId is not null)
|
||||
query = query.Where(pctf => pctf.UsrId == usrId);
|
||||
|
||||
if (username is null)
|
||||
query = query.Where(pctf => pctf.User!.Username == username);
|
||||
|
||||
if (stateId is null)
|
||||
query = query.Where(pctf => pctf.State!.Id == stateId);
|
||||
|
||||
if (objId is not null)
|
||||
query = query.Where(pctf => pctf.ObjId == objId);
|
||||
|
||||
if (profileActive is not null)
|
||||
query = query.Where(pctf => pctf.Profile!.Active == profileActive);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ProfileObjState>> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = true, bool withState = true, int? profileId = null, int? objId = null, bool? profileActive = null)
|
||||
=> await Read(isReadonly: isReadonly, withProfile: withProfile, withUser: withUser, withState: withState, profileId: profileId, objId: objId, profileActive: profileActive).ToListAsync();
|
||||
|
||||
public async Task<ProfileObjState?> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = false, bool withState = true, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null)
|
||||
=> await Read(isReadonly: isReadonly, withProfile: withProfile, withUser: withUser, withState: withState, usrId: usrId, username: username, profileId: profileId, objId: objId, profileActive: profileActive)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
11
WorkFlow.Infrastructure/Repositories/ProfileRepository.cs
Normal file
11
WorkFlow.Infrastructure/Repositories/ProfileRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
|
||||
namespace WorkFlow.Infrastructure.Repositories
|
||||
{
|
||||
public class ProfileRepository(WFDBContext dbContext) : CRUDRepository<Profile, int, WFDBContext>(dbContext, dbContext.Profiles), IProfileRepository, ICRUDRepository<Profile, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
10
WorkFlow.Infrastructure/Repositories/StateRepository.cs
Normal file
10
WorkFlow.Infrastructure/Repositories/StateRepository.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using WorkFlow.Domain.Entities;
|
||||
using WorkFlow.Infrastructure.Contracts;
|
||||
namespace WorkFlow.Infrastructure.Repositories
|
||||
{
|
||||
public class StateRepository(WFDBContext dbContext) : CRUDRepository<State, int, WFDBContext>(dbContext, dbContext.States), IStateRepository, ICRUDRepository<State, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ namespace WorkFlow.Infrastructure
|
||||
{
|
||||
public DbSet<Config> Configs { get; set; }
|
||||
|
||||
public DbSet<ProfControlsTf> ProfControlsTf { get; set; }
|
||||
public DbSet<ProfileControlsTF> ProfileControlsTFs { get; set; }
|
||||
|
||||
public DbSet<Profile> Profiles { get; set; }
|
||||
|
||||
public DbSet<ProfileObjState> ProfileObjStates { get; set; }
|
||||
|
||||
public DbSet<WfState> WfStates { get; set; }
|
||||
public DbSet<State> States { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@ VisualStudioVersion = 17.9.34622.214
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkFlow.Domain", "WorkFlow.Domain\WorkFlow.Domain.csproj", "{71E9264E-A2F0-4E5A-B010-8E4618C0C6AC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Infrastructure", "WorkFlow.Infrastructure\WorkFlow.Infrastructure.csproj", "{62526D0D-3365-4113-854A-3656191D7C63}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkFlow.Infrastructure", "WorkFlow.Infrastructure\WorkFlow.Infrastructure.csproj", "{62526D0D-3365-4113-854A-3656191D7C63}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Application", "WorkFlow.Application\WorkFlow.Application.csproj", "{5700B5DD-D17E-4E17-ADE5-48C95A0CC364}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -21,6 +23,10 @@ Global
|
||||
{62526D0D-3365-4113-854A-3656191D7C63}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{62526D0D-3365-4113-854A-3656191D7C63}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{62526D0D-3365-4113-854A-3656191D7C63}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5700B5DD-D17E-4E17-ADE5-48C95A0CC364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5700B5DD-D17E-4E17-ADE5-48C95A0CC364}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5700B5DD-D17E-4E17-ADE5-48C95A0CC364}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5700B5DD-D17E-4E17-ADE5-48C95A0CC364}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Reference in New Issue
Block a user