From f67fa0db2490f38ed21cbe897972a433c86d85da Mon Sep 17 00:00:00 2001 From: Denis Prokharchyk Date: Sun, 25 Dec 2022 02:04:03 +0300 Subject: [PATCH 1/5] fix: update cgen-api helm --- deploy/helm/cgen-api/values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy/helm/cgen-api/values.yaml b/deploy/helm/cgen-api/values.yaml index 43bf6b69..7b6215e9 100644 --- a/deploy/helm/cgen-api/values.yaml +++ b/deploy/helm/cgen-api/values.yaml @@ -59,7 +59,8 @@ env: values: - name: ConnectionString value: Server=tcp:mssql-data;Initial Catalog=O2Bionics.O2NextGen.CGenDb;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30; - + - name: DatabaseInitializerSettings__Initialize + value: false resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little From 1a8a6b10d6dd47eb8cf00d368db867acfde58c28 Mon Sep 17 00:00:00 2001 From: Denis Prokharchyk Date: Sun, 25 Dec 2022 02:09:42 +0300 Subject: [PATCH 2/5] fix: update cgen-api and publish swagger --- .../O2NextGen.CertificateManagement.Application/Program.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs index e5a829fb..cdf20d88 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs @@ -23,9 +23,11 @@ // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { - app.UseSwagger(); - app.UseSwaggerUI(); + + } +app.UseSwagger(); +app.UseSwaggerUI(); app.Use(async (context, next) => { context.Response.OnStarting(() => From 23c0d7252b86f4b8eff0fc478f963c67442ab83d Mon Sep 17 00:00:00 2001 From: Denis Prokharchyk Date: Sun, 25 Dec 2022 14:20:52 +0300 Subject: [PATCH 3/5] fix(issue-319): extend controllers for cgen-api --- .../Categories/CategoriesControlller.cs | 38 +++ .../Certificates/CertificatesController.cs | 46 +++- .../CreateCertificateDetailsCommandModel.cs | 22 +- .../UpdateCertificateDetailsCommandModel.cs | 25 +- ...n.CertificateManagement.Application.csproj | 19 +- .../appsettings.json | 2 +- .../Data/Queries/CertificateQuery.cs | 34 ++- .../Data/Queries/CertificatesQuery.cs | 2 +- .../Entities/CategoryDbEntity.cs | 21 ++ .../Entities/CategoryEntity.cs | 10 - .../Entities/CertificateDbEntity.cs | 30 +++ .../Entities/CertificateEntity.cs | 10 - .../Entities/LanguageInfoDbEntity.cs | 18 ++ ...extGen.CertificateManagement.Domain.csproj | 2 +- .../CreateCertificateCommand.cs | 40 +++- .../CreateCertificateCommandHandler.cs | 42 +++- .../CreateCertificateCommandResult.cs | 47 +++- .../DeleteCertificateCommandHandler.cs | 8 +- .../GetCertificateQueryHandler.cs | 23 +- .../GetCertificateQueryResult.cs | 56 ++++- .../GetCertificatesQueryHandler.cs | 28 ++- .../GetCertificatesQueryResult.cs | 40 +++- .../UpdateCertificateDetailsCommand.cs | 68 +++++- .../UpdateCertificateDetailsCommandHandler.cs | 61 ++++- .../UpdateCertificateDetailsCommandResult.cs | 40 ++++ .../Data/CertificateManagementDbContext.cs | 2 +- .../CategoryDbEntityConfiguration.cs | 24 ++ ...cs => CertificateDbEntityConfiguration.cs} | 5 +- .../LanguageInfoDbEntityConfiguration.cs | 24 ++ .../20211031114457_InitialCreate.Designer.cs | 41 ---- .../20211031114457_InitialCreate.cs | 35 --- .../20221225101744_InitDatabase.Designer.cs | 216 ++++++++++++++++++ .../Migrations/20221225101744_InitDatabase.cs | 136 +++++++++++ ...ificateManagementDbContextModelSnapshot.cs | 214 +++++++++++++++++ ...ertificateManagerDbContextModelSnapshot.cs | 39 ---- ...ertificateManagement.Infrastructure.csproj | 4 +- .../Queries/CertificateQueryHandler.cs | 6 +- .../Queries/CertificatesQueryHandler.cs | 4 +- 38 files changed, 1274 insertions(+), 208 deletions(-) create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryDbEntity.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryEntity.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateDbEntity.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateEntity.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfoDbEntity.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs rename src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/{CertificateEntityConfiguration.cs => CertificateDbEntityConfiguration.cs} (72%) create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.Designer.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagementDbContextModelSnapshot.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagerDbContextModelSnapshot.cs diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs new file mode 100644 index 00000000..95d92a45 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using MediatR; +using Microsoft.AspNetCore.Mvc; +using O2NextGen.CertificateManagement.Application.Controllers; + +namespace O2NextGen.CertificateManagement.Application.Features.Categories +{ + [Route("api/[controller]")] + public class CategoriesControlller : ControllerBase + { + #region Fields + + private readonly IMediator mediator; + private readonly ILogger logger; + + #endregion + + + #region Ctors + + public CategoriesControlller(IMediator mediator, ILogger logger) + { + this.mediator = mediator; + this.logger = logger; + } + + #endregion + + + #region Methods + + #endregion + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs index 4eaabc44..26f18508 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs @@ -6,6 +6,7 @@ using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCertificate; using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate; +using static O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate.GetCertificatesQueryResult; namespace O2NextGen.CertificateManagement.Application.Controllers { @@ -60,8 +61,27 @@ public async Task GetAllAsync() public async Task> UpdateAsync( long id, UpdateCertificateDetailsCommandModel model, CancellationToken ct) { - var result = await _mediator.Send(new UpdateCertificateDetailsCommand(id, - model.Name)); + var result = await _mediator.Send( + new UpdateCertificateDetailsCommand( + id, + model.ExternalId, + model.ModifiedDate, + model.AddedDate, + model.DeletedDate, + model.IsDeleted, + model.OwnerAccountId, + model.CustomerId, + model.ExpiredDate, + model.PublishDate, + model.CreatorId, + model.PublishCode, + model.IsVisible, + model.CategoryId, + model.Category, + model.Lock, + model.LockedDate, + model.LockInfo, + model.LanguageInfos)); if (result is null) { @@ -78,8 +98,26 @@ public async Task> AddAsync( CreateCertificateDetailsCommandModel model, CancellationToken ct) { - var result = await _mediator.Send(new CreateCertificateCommand(model.Name)); - return CreatedAtAction(GetByIdActionName, new { id = result.Id }, result); + var result = await _mediator.Send( + new CreateCertificateCommand( + model.ExternalId, + model.IsDeleted, + model.OwnerAccountId, + model.CustomerId, + model.ExpiredDate, + model.PublishDate, + model.CreatorId, + model.PublishCode, + model.IsVisible, + model.CategoryId, + model.Category, + model.Lock, + model.LockedDate, + model.LockInfo, + model.LanguageInfos + )); + return CreatedAtAction(GetByIdActionName, + new { id = result.Id }, result); } [HttpDelete] diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs index eaa4d560..a6a51300 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs @@ -1,5 +1,23 @@ -public class CreateCertificateDetailsCommandModel +using O2NextGen.CertificateManagement.Domain.Entities; + +public class CreateCertificateDetailsCommandModel { - public string Name { get; set; } + public string ExternalId { get; set; } + public bool? IsDeleted { get; set; } + + public string OwnerAccountId { get; set; } + public string CustomerId { get; set; } + public long ExpiredDate { get; set; } + public long PublishDate { get; set; } + public string CreatorId { get; set; } + public string PublishCode { get; set; } + public bool IsVisible { get; set; } + + public long CategoryId { get; set; } + public CategoryDbEntity Category { get; set; } + public bool Lock { get; set; } + public long LockedDate { get; set; } + public string LockInfo { get; set; } + public ICollection LanguageInfos { get; } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs index dd519c9b..3f6fd2bc 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs @@ -1,5 +1,26 @@ -public class UpdateCertificateDetailsCommandModel +using O2NextGen.CertificateManagement.Domain.Entities; + +public class UpdateCertificateDetailsCommandModel { - public string Name { get; set; } + public string ExternalId { get; set; } + public bool? IsDeleted { get; set; } + + public string OwnerAccountId { get; set; } + public string CustomerId { get; set; } + public long ExpiredDate { get; set; } + public long PublishDate { get; set; } + public string CreatorId { get; set; } + public string PublishCode { get; set; } + public bool IsVisible { get; set; } + + public long CategoryId { get; set; } + public CategoryDbEntity Category { get; set; } + public bool Lock { get; set; } + public long LockedDate { get; set; } + public string LockInfo { get; set; } + public ICollection LanguageInfos { get; } + public bool? ModifiedDate { get; internal set; } + public string AddedDate { get; internal set; } + public string DeletedDate { get; internal set; } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj index dae4806d..85935ca5 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj @@ -2,7 +2,7 @@ net6.0 - enable + disable enable @@ -12,6 +12,10 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + @@ -22,6 +26,13 @@ + + + + + + + @@ -38,5 +49,11 @@ + + + + + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json index 7a006974..40a7b0b9 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json @@ -1,6 +1,6 @@ { "DatabaseInitializerSettings": { - "Initialize": false + "Initialize": true }, "ConnectionString": "Server=20.112.192.201;Initial Catalog=O2NextGen.CertificateDb;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30;", "Urls": { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs index 19efaca1..7262d197 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs @@ -4,7 +4,7 @@ namespace O2NextGen.CertificateManagement.Domain.Data.Queries { - public class CertificateQuery: IQuery + public class CertificateQuery: IQuery { public CertificateQuery(long id) @@ -12,7 +12,39 @@ public CertificateQuery(long id) Id = id; } + public CertificateQuery(string externalId, bool? isDeleted, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) + { + ExternalId = externalId; + IsDeleted = isDeleted; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos = languageInfos; + } + public long Id { get; } + public string ExternalId { get; } + public bool? IsDeleted { get; } + public string CustomerId { get; } + public long ExpiredDate { get; } + public long PublishDate { get; } + public string CreatorId { get; } + public string PublishCode { get; } + public bool IsVisible { get; } + public long CategoryId { get; } + public CategoryDbEntity Category { get; } + public bool Lock { get; } + public long LockedDate { get; } + public string LockInfo { get; } + public ICollection LanguageInfos { get; } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs index b389776c..1e930563 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs @@ -5,7 +5,7 @@ namespace O2NextGen.CertificateManagement.Domain.Data.Queries { - public class CertificatesQuery: IQuery> + public class CertificatesQuery: IQuery> { } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryDbEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryDbEntity.cs new file mode 100644 index 00000000..da805a70 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryDbEntity.cs @@ -0,0 +1,21 @@ +using O2NextGen.CertificateManagement.Domain.Data; + +namespace O2NextGen.CertificateManagement.Domain.Entities +{ + public class CategoryDbEntity + { + public long Id { get; set; } + public long ModifiedDate { get; set; } + public long AddedDate { get; set; } + public long? DeletedDate { get; set; } + public bool? IsDeleted { get; set; } + + public string CustomerId { get; set; } + public string CategorySeries { get; set; } + public int QuantityCertificates { get; set; } + public int QuantityPublishCode { get; set; } + public string CategoryName { get; set; } + public string CategoryDescription { get; set; } + public int TimeLifeInDays { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryEntity.cs deleted file mode 100644 index e8a08699..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryEntity.cs +++ /dev/null @@ -1,10 +0,0 @@ -using O2NextGen.CertificateManagement.Domain.Data; - -namespace O2NextGen.CertificateManagement.Domain.Entities -{ - public class CategoryEntity: IEntity - { - public long Id { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateDbEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateDbEntity.cs new file mode 100644 index 00000000..636eab11 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateDbEntity.cs @@ -0,0 +1,30 @@ +using O2NextGen.CertificateManagement.Domain.Data; + +namespace O2NextGen.CertificateManagement.Domain.Entities +{ + public class CertificateDbEntity + { + public long Id { get; set; } + public string ExternalId { get; set; } + public long ModifiedDate { get; set; } + public long AddedDate { get; set; } + public long? DeletedDate { get; set; } + public bool? IsDeleted { get; set; } + + public string OwnerAccountId { get; set; } + public string CustomerId { get; set; } + public long ExpiredDate { get; set; } + public long PublishDate { get; set; } + public string CreatorId { get; set; } + public string PublishCode { get; set; } + public bool IsVisible { get; set; } + + public long CategoryId { get; set; } + public CategoryDbEntity Category { get; set; } + public bool Lock { get; set; } + public long LockedDate { get; set; } + public string LockInfo { get; set; } + + public ICollection LanguageInfos { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateEntity.cs deleted file mode 100644 index aa63887b..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateEntity.cs +++ /dev/null @@ -1,10 +0,0 @@ -using O2NextGen.CertificateManagement.Domain.Data; - -namespace O2NextGen.CertificateManagement.Domain.Entities -{ - public class CertificateEntity: IEntity - { - public long Id { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfoDbEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfoDbEntity.cs new file mode 100644 index 00000000..aad4b551 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfoDbEntity.cs @@ -0,0 +1,18 @@ +namespace O2NextGen.CertificateManagement.Domain.Entities +{ + public class LanguageInfoDbEntity + { + public long Id { get; set; } + public long ModifiedDate { get; set; } + public long AddedDate { get; set; } + public long? DeletedDate { get; set; } + public bool? IsDeleted { get; set; } + + public long CertificateId { get; set; } + public int LanguageId { get; set; } + public CertificateDbEntity Certificate { get; set; } + public string Lastname { get; set; } + public string Firstname { get; set; } + public string Middlename { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj index d12f699e..622ee326 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj @@ -3,7 +3,7 @@ net6.0 enable - enable + disable diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs index 1a0560f0..5f68b261 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs @@ -1,14 +1,48 @@ using MediatR; +using O2NextGen.CertificateManagement.Domain.Entities; namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate { public class CreateCertificateCommand : IRequest { - public string Name { get; set; } + public string ExternalId { get; set; } + public bool? IsDeleted { get; set; } - public CreateCertificateCommand(string name) + public string OwnerAccountId { get; set; } + public string CustomerId { get; set; } + public long ExpiredDate { get; set; } + public long PublishDate { get; set; } + public string CreatorId { get; set; } + public string PublishCode { get; set; } + public bool IsVisible { get; set; } + + public long CategoryId { get; set; } + public CategoryDbEntity Category { get; set; } + public bool Lock { get; set; } + public long LockedDate { get; set; } + public string LockInfo { get; set; } + public ICollection LanguageInfos { get; } + + public CreateCertificateCommand( + string externalId, bool? IsDeleted, string ownerAccountId, string customerId, + long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, + long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, + ICollection languageInfos) { - Name = name; + ExternalId = externalId; + this.IsDeleted = IsDeleted; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos = languageInfos; } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs index 054ab6f3..18c14946 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs @@ -11,25 +11,51 @@ namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCert public class CreateCertificateCommandHandler : IRequestHandler { - private readonly IRepository groupsRepository; + private readonly IRepository certificatesRepository; - public CreateCertificateCommandHandler(IRepository groupsRepository) + public CreateCertificateCommandHandler(IRepository groupsRepository) { - this.groupsRepository = groupsRepository; + this.certificatesRepository = groupsRepository; } public async Task Handle( CreateCertificateCommand request, CancellationToken cancellationToken) { - var group = new CertificateEntity + var certificate = new CertificateDbEntity { - Name = request.Name + ExternalId = request.ExternalId, + IsDeleted = request.IsDeleted, + CustomerId = request.CustomerId, + ExpiredDate = request.ExpiredDate, + PublishDate = request.PublishDate, + CreatorId = request.CreatorId, + PublishCode = request.PublishCode, + IsVisible = request.IsVisible, + CategoryId = request.CategoryId, + Category = request.Category, + Lock = request.Lock, + LockedDate = request.LockedDate, + LockInfo = request.LockInfo, + LanguageInfos = request.LanguageInfos }; - var addedGroup = await groupsRepository.AddAsync(group, cancellationToken); + var addedCertificate = await certificatesRepository.AddAsync(certificate, cancellationToken); return new CreateCertificateCommandResult( - addedGroup.Id, - addedGroup.Name); + addedCertificate.ExternalId, + addedCertificate.IsDeleted, + addedCertificate.OwnerAccountId, + addedCertificate.CustomerId, + addedCertificate.ExpiredDate, + addedCertificate.PublishDate, + addedCertificate.CreatorId, + addedCertificate.PublishCode, + addedCertificate.IsVisible, + addedCertificate.CategoryId, + addedCertificate.Category, + addedCertificate.Lock, + addedCertificate.LockedDate, + addedCertificate.LockInfo, + addedCertificate.LanguageInfos); } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs index 29c2927c..0ee81074 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs @@ -1,17 +1,54 @@ using System; +using O2NextGen.CertificateManagement.Domain.Entities; namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate { public class CreateCertificateCommandResult { - public CreateCertificateCommandResult(long id, string name) + + + public CreateCertificateCommandResult( + string externalId, bool? isDeleted, string ownerAccountId, string customerId, + long expiredDate, long publishDate, string creatorId, string publishCode, + bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, + long lockedDate, string lockInfo, ICollection languageInfos) { - Id = id; - Name = name; + ExternalId = externalId; + IsDeleted = isDeleted; + OwnerAccountId = ownerAccountId; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos = languageInfos; } - public long Id { get; } - public string Name { get; } + public long Id { get; set; } + public string ExternalId { get; } + public long ModifiedDate { get; set; } + public long AddedDate { get; set; } + public long? DeletedDate { get; set; } + public bool? IsDeleted { get; } + public string OwnerAccountId { get; } + public string CustomerId { get; } + public long ExpiredDate { get; } + public long PublishDate { get; } + public string CreatorId { get; } + public string PublishCode { get; } + public bool IsVisible { get; } + public long CategoryId { get; } + public CategoryDbEntity Category { get; } + public bool Lock { get; } + public long LockedDate { get; } + public string LockInfo { get; } + public ICollection LanguageInfos { get; } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs index 55c24a38..3dc90e56 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs @@ -7,12 +7,12 @@ namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCert { public class DeleteCertificateCommandHandler : IRequestHandler { - private readonly IQueryHandler _userGroupQueryHandler; - private readonly IRepository groupsRepository; + private readonly IQueryHandler _userGroupQueryHandler; + private readonly IRepository groupsRepository; public DeleteCertificateCommandHandler( - IQueryHandler userGroupQueryHandler, - IRepository groupsRepository) + IQueryHandler userGroupQueryHandler, + IRepository groupsRepository) { _userGroupQueryHandler = userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler)); this.groupsRepository = groupsRepository; diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs index 9546c541..d8372516 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs @@ -12,9 +12,9 @@ namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertifi public class GetCertificateQueryHandler : IRequestHandler { - private readonly IQueryHandler _queryHandler; + private readonly IQueryHandler _queryHandler; - public GetCertificateQueryHandler(IQueryHandler queryHandler) + public GetCertificateQueryHandler(IQueryHandler queryHandler) { _queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler)); @@ -33,7 +33,24 @@ public async Task Handle(GetCertificateQuery request, return new GetCertificateQueryResult( certificate.Id, - certificate.Name); + certificate.ExternalId, + certificate.ModifiedDate, + certificate.AddedDate, + certificate.DeletedDate, + certificate.IsDeleted, + certificate.OwnerAccountId, + certificate.CustomerId, + certificate.ExpiredDate, + certificate.PublishDate, + certificate.CreatorId, + certificate.PublishCode, + certificate.IsVisible, + certificate.CategoryId, + certificate.Category, + certificate.Lock, + certificate.LockedDate, + certificate.LockInfo, + certificate.LanguageInfos); //var result = await certificatesService.GetByIdAsync(request.Id, cancellationToken); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs index c980af9c..369f0d3d 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs @@ -1,17 +1,55 @@ -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate { public class GetCertificateQueryResult { - private long id; - private string name; - - public GetCertificateQueryResult(long id, string name) + + public GetCertificateQueryResult(long id, string externalId, long modifiedDate, long addedDate, + long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, + long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, + CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, + ICollection languageInfos) { - this.Id = id; - this.Name = name; + Id = id; + ExternalId = externalId; + ModifiedDate = modifiedDate; + AddedDate = addedDate; + DeletedDate = deletedDate; + IsDeleted = isDeleted; + OwnerAccountId = ownerAccountId; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos = languageInfos; } - public long Id { get => id; set => id = value; } - public string Name { get => name; set => name = value; } + public long Id { get; } + public string ExternalId { get; } + public long ModifiedDate { get; } + public long AddedDate { get; } + public long? DeletedDate { get; } + public bool? IsDeleted { get; } + public string OwnerAccountId { get; } + public string CustomerId { get; } + public long ExpiredDate { get; } + public long PublishDate { get; } + public string CreatorId { get; } + public string PublishCode { get; } + public bool IsVisible { get; } + public long CategoryId { get; } + public CategoryDbEntity Category { get; } + public bool Lock { get; } + public long LockedDate { get; } + public string LockInfo { get; } + public ICollection LanguageInfos { get; } } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs index c6d08220..61962b86 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs @@ -5,16 +5,17 @@ using O2NextGen.CertificateManagement.Domain.Entities; using O2NextGen.CertificateManagement.Domain.Mappings; using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; +using static O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate.GetCertificatesQueryResult; namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificates { public class GetCertificatesQueryHandler : IRequestHandler { - private readonly IQueryHandler> queryHandler; + private readonly IQueryHandler> queryHandler; public GetCertificatesQueryHandler( - IQueryHandler> queryHandler) + IQueryHandler> queryHandler) { this.queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler)); } @@ -26,10 +27,27 @@ public async Task Handle(GetCertificatesQuery reques cancellationToken); return new GetCertificatesQueryResult( - certificates.MapAsReadOnly(g => + certificates.MapAsReadOnly(certificate => new GetCertificatesQueryResult.Certificate( - g.Id, - g.Name))); + certificate.Id, + certificate.ExternalId, + certificate.ModifiedDate, + certificate.AddedDate, + certificate.DeletedDate, + certificate.IsDeleted, + certificate.OwnerAccountId, + certificate.CustomerId, + certificate.ExpiredDate, + certificate.PublishDate, + certificate.CreatorId, + certificate.PublishCode, + certificate.IsVisible, + certificate.CategoryId, + certificate.Category, + certificate.Lock, + certificate.LockedDate, + certificate.LockInfo, + certificate.LanguageInfos))); } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs index 2d0183c3..93f91cbc 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs @@ -1,4 +1,5 @@ using System.Text.RegularExpressions; +using O2NextGen.CertificateManagement.Domain.Entities; namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate { @@ -14,13 +15,50 @@ public GetCertificatesQueryResult(IReadOnlyCollection certificates) public class Certificate { - public Certificate(long id, string name) + + public Certificate( + long id, string name, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) { Id = id; Name = name; + ModifiedDate = modifiedDate; + AddedDate = addedDate; + DeletedDate = deletedDate; + IsDeleted = isDeleted; + OwnerAccountId = ownerAccountId; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos = languageInfos; } + public long Id { get; set; } public string Name { get; set; } + public long ModifiedDate { get; } + public long AddedDate { get; } + public long? DeletedDate { get; } + public bool? IsDeleted { get; } + public string OwnerAccountId { get; } + public string CustomerId { get; } + public long ExpiredDate { get; } + public long PublishDate { get; } + public string CreatorId { get; } + public string PublishCode { get; } + public bool IsVisible { get; } + public long CategoryId { get; } + public CategoryDbEntity Category { get; } + public bool Lock { get; } + public long LockedDate { get; } + public string LockInfo { get; } + public ICollection LanguageInfos { get; } } } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs index 408c801a..269bb763 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs @@ -1,18 +1,80 @@ using System; using MediatR; +using O2NextGen.CertificateManagement.Domain.Entities; namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate { public class UpdateCertificateDetailsCommand: IRequest { - public UpdateCertificateDetailsCommand(long id, string name) + public UpdateCertificateDetailsCommand( + long id, + string externalId, bool? isDeleted, string ownerAccountId, string customerId, + long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, + long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, + ICollection languageInfos) { Id = id; - Name = name; + ExternalId = externalId; + IsDeleted = isDeleted; + OwnerAccountId = ownerAccountId; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos = languageInfos; + } + + public UpdateCertificateDetailsCommand(long id, string externalId, bool? modifiedDate, string addedDate, string deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) + { + Id = id; + ExternalId = externalId; + ModifiedDate = modifiedDate; + AddedDate = addedDate; + DeletedDate = deletedDate; + IsDeleted = isDeleted; + OwnerAccountId = ownerAccountId; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category1 = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos1 = languageInfos; } public long Id { get; } - public string Name { get; } + public string ExternalId { get; } + public bool? IsDeleted { get; } + public string OwnerAccountId { get; } + public string CustomerId { get; } + public long ExpiredDate { get; } + public long PublishDate { get; } + public string CreatorId { get; } + public string PublishCode { get; } + public bool IsVisible { get; } + public long CategoryId { get; } + public CategoryDbEntity Category { get; } + public bool Lock { get; } + public long LockedDate { get; } + public string LockInfo { get; } + public ICollection LanguageInfos { get; } + public bool? ModifiedDate { get; } + public string AddedDate { get; } + public string DeletedDate { get; } + public CategoryDbEntity Category1 { get; } + public ICollection LanguageInfos1 { get; } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs index 0cc8fd57..18157ae4 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs @@ -9,12 +9,12 @@ namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCert public class UpdateCertificateDetailsCommandHandler : IRequestHandler { - private readonly IQueryHandler _userGroupQueryHandler; - private readonly IRepository _groupsRepository; + private readonly IQueryHandler _userGroupQueryHandler; + private readonly IRepository _groupsRepository; public UpdateCertificateDetailsCommandHandler( - IQueryHandler userGroupQueryHandler, - IRepository groupsRepository) + IQueryHandler userGroupQueryHandler, + IRepository groupsRepository) { _userGroupQueryHandler = userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler)); @@ -24,7 +24,21 @@ public UpdateCertificateDetailsCommandHandler( public async Task Handle(UpdateCertificateDetailsCommand request, CancellationToken cancellationToken) { var certificate = await _userGroupQueryHandler.HandleAsync( - new CertificateQuery(request.Id), + new CertificateQuery( + request.ExternalId, + request.IsDeleted, + request.CustomerId, + request.ExpiredDate, + request.PublishDate, + request.CreatorId, + request.PublishCode, + request.IsVisible, + request.CategoryId, + request.Category, + request.Lock, + request.LockedDate, + request.LockInfo, + request.LanguageInfos), cancellationToken); if (certificate is null) @@ -32,13 +46,44 @@ public async Task Handle(UpdateCertificat return null; } - certificate.Name = request.Name; - + certificate.ExternalId = request.ExternalId; + certificate.IsDeleted = request.IsDeleted; + certificate.CustomerId = request.CustomerId; + certificate.ExpiredDate = request.ExpiredDate; + certificate.PublishDate = request.PublishDate; + certificate.CreatorId = request.CreatorId; + certificate.PublishCode = request.PublishCode; + certificate.IsVisible = request.IsVisible; + certificate.CategoryId = request.CategoryId; + certificate.Category = request.Category; + certificate.Lock = request.Lock; + certificate.LockedDate = request.LockedDate; + certificate.LockInfo = request.LockInfo; + certificate.LanguageInfos = request.LanguageInfos; + + await _groupsRepository.UpdateAsync(certificate, cancellationToken); return new UpdateCertificateDetailsCommandResult( certificate.Id, - certificate.Name); + certificate.ExternalId, + certificate.ModifiedDate, + certificate.AddedDate, + certificate.DeletedDate, + certificate.IsDeleted, + certificate.OwnerAccountId, + certificate.CustomerId, + certificate.ExpiredDate, + certificate.PublishDate, + certificate.CreatorId, + certificate.PublishCode, + certificate.IsVisible, + certificate.CategoryId, + certificate.Category, + certificate.Lock, + certificate.LockedDate, + certificate.LockInfo, + certificate.LanguageInfos); } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs index c71a5fe2..aab322bf 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs @@ -1,4 +1,6 @@  +using O2NextGen.CertificateManagement.Domain.Entities; + public class UpdateCertificateDetailsCommandResult { public UpdateCertificateDetailsCommandResult(long id, string name) @@ -7,8 +9,46 @@ public UpdateCertificateDetailsCommandResult(long id, string name) Name = name; } + public UpdateCertificateDetailsCommandResult(long id, string name, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) : this(id, name) + { + ModifiedDate = modifiedDate; + AddedDate = addedDate; + DeletedDate = deletedDate; + IsDeleted = isDeleted; + OwnerAccountId = ownerAccountId; + CustomerId = customerId; + ExpiredDate = expiredDate; + PublishDate = publishDate; + CreatorId = creatorId; + PublishCode = publishCode; + IsVisible = isVisible; + CategoryId = categoryId; + Category = category; + Lock = @lock; + LockedDate = lockedDate; + LockInfo = lockInfo; + LanguageInfos = languageInfos; + } + public long Id { get; } public string Name { get; } + public long ModifiedDate { get; } + public long AddedDate { get; } + public long? DeletedDate { get; } + public bool? IsDeleted { get; } + public string OwnerAccountId { get; } + public string CustomerId { get; } + public long ExpiredDate { get; } + public long PublishDate { get; } + public string CreatorId { get; } + public string PublishCode { get; } + public bool IsVisible { get; } + public long CategoryId { get; } + public CategoryDbEntity Category { get; } + public bool Lock { get; } + public long LockedDate { get; } + public string LockInfo { get; } + public ICollection LanguageInfos { get; } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs index 554ab08e..5a1100d3 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs @@ -9,7 +9,7 @@ public class CertificateManagementDbContext : DbContext #region Fields - public DbSet Certificates { get; set; } + public DbSet Certificates { get; set; } #endregion diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs new file mode 100644 index 00000000..4eecd53e --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Configurations +{ + + public class CategoryDbEntityConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("Category"); + + builder.Property(ci => ci.Id) + .HasColumnType("bigint") + .UseHiLo("category_hilo") + .IsRequired(); + + //builder.Property(ci => ci.ExternalId) + // .IsRequired(); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateEntityConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateDbEntityConfiguration.cs similarity index 72% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateEntityConfiguration.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateDbEntityConfiguration.cs index c8e68969..2dc8f8ec 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateEntityConfiguration.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateDbEntityConfiguration.cs @@ -4,9 +4,10 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Data.Configurations { - public class CertificateEntityConfiguration: IEntityTypeConfiguration + + public class CertificateDbEntityConfiguration : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { builder.ToTable("Certificate"); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs new file mode 100644 index 00000000..72440063 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Configurations +{ + public class LanguageInfoDbEntityConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("LanguageInfos") + .HasOne(e => e.Certificate) + .WithMany(e => e.LanguageInfos) + .HasForeignKey(e => e.CertificateId) + .OnDelete(DeleteBehavior.Cascade); + + builder.Property(ci => ci.Id) + .HasColumnType("bigint") + .UseHiLo("languageInfo_hilo") + .IsRequired(); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.Designer.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.Designer.cs deleted file mode 100644 index 8e29eaf9..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.Designer.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using O2NextGen.CertificateManagement.Data; - -namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations -{ - [DbContext(typeof(CertificateManagementDbContext))] - [Migration("20211031114457_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.1.14-servicing-32113") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("Relational:Sequence:.certificate_hilo", "'certificate_hilo', '', '1', '10', '', '', 'Int64', 'False'") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("O2NextGen.CertificateManagement.Data.Entities.CertificateEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("SqlServer:HiLoSequenceName", "certificate_hilo") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); - - b.Property("Name"); - - b.HasKey("Id"); - - b.ToTable("Certificate"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.cs deleted file mode 100644 index 8a92e8d0..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations -{ - public partial class InitialCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateSequence( - name: "certificate_hilo", - incrementBy: 10); - - migrationBuilder.CreateTable( - name: "Certificate", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - Name = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Certificate", x => x.Id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Certificate"); - - migrationBuilder.DropSequence( - name: "certificate_hilo"); - } - } -} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs new file mode 100644 index 00000000..1a1c36eb --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs @@ -0,0 +1,216 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using O2NextGen.CertificateManagement.Infrastructure.Data; + +#nullable disable + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations +{ + [DbContext(typeof(CertificateManagementDbContext))] + [Migration("20221225101744_InitDatabase")] + partial class InitDatabase + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.HasSequence("category_hilo") + .IncrementsBy(10); + + modelBuilder.HasSequence("certificate_hilo") + .IncrementsBy(10); + + modelBuilder.HasSequence("languageInfo_hilo") + .IncrementsBy(10); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CategoryDbEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "category_hilo"); + + b.Property("AddedDate") + .HasColumnType("bigint"); + + b.Property("CategoryDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("CategoryName") + .HasColumnType("nvarchar(max)"); + + b.Property("CategorySeries") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerId") + .HasColumnType("nvarchar(max)"); + + b.Property("DeletedDate") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedDate") + .HasColumnType("bigint"); + + b.Property("QuantityCertificates") + .HasColumnType("int"); + + b.Property("QuantityPublishCode") + .HasColumnType("int"); + + b.Property("TimeLifeInDays") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Category", (string)null); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "certificate_hilo"); + + b.Property("AddedDate") + .HasColumnType("bigint"); + + b.Property("CategoryId") + .HasColumnType("bigint"); + + b.Property("CreatorId") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerId") + .HasColumnType("nvarchar(max)"); + + b.Property("DeletedDate") + .HasColumnType("bigint"); + + b.Property("ExpiredDate") + .HasColumnType("bigint"); + + b.Property("ExternalId") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsVisible") + .HasColumnType("bit"); + + b.Property("Lock") + .HasColumnType("bit"); + + b.Property("LockInfo") + .HasColumnType("nvarchar(max)"); + + b.Property("LockedDate") + .HasColumnType("bigint"); + + b.Property("ModifiedDate") + .HasColumnType("bigint"); + + b.Property("OwnerAccountId") + .HasColumnType("nvarchar(max)"); + + b.Property("PublishCode") + .HasColumnType("nvarchar(max)"); + + b.Property("PublishDate") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Certificate", (string)null); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.LanguageInfoDbEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "languageInfo_hilo"); + + b.Property("AddedDate") + .HasColumnType("bigint"); + + b.Property("CertificateId") + .HasColumnType("bigint"); + + b.Property("DeletedDate") + .HasColumnType("bigint"); + + b.Property("Firstname") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LanguageId") + .HasColumnType("int"); + + b.Property("Lastname") + .HasColumnType("nvarchar(max)"); + + b.Property("Middlename") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedDate") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CertificateId"); + + b.ToTable("LanguageInfos", (string)null); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", b => + { + b.HasOne("O2NextGen.CertificateManagement.Domain.Entities.CategoryDbEntity", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.LanguageInfoDbEntity", b => + { + b.HasOne("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", "Certificate") + .WithMany("LanguageInfos") + .HasForeignKey("CertificateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Certificate"); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", b => + { + b.Navigation("LanguageInfos"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs new file mode 100644 index 00000000..a7a4c0bc --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs @@ -0,0 +1,136 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations +{ + public partial class InitDatabase : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateSequence( + name: "category_hilo", + incrementBy: 10); + + migrationBuilder.CreateSequence( + name: "certificate_hilo", + incrementBy: 10); + + migrationBuilder.CreateSequence( + name: "languageInfo_hilo", + incrementBy: 10); + + migrationBuilder.CreateTable( + name: "Category", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false), + ModifiedDate = table.Column(type: "bigint", nullable: false), + AddedDate = table.Column(type: "bigint", nullable: false), + DeletedDate = table.Column(type: "bigint", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: true), + CustomerId = table.Column(type: "nvarchar(max)", nullable: true), + CategorySeries = table.Column(type: "nvarchar(max)", nullable: true), + QuantityCertificates = table.Column(type: "int", nullable: false), + QuantityPublishCode = table.Column(type: "int", nullable: false), + CategoryName = table.Column(type: "nvarchar(max)", nullable: true), + CategoryDescription = table.Column(type: "nvarchar(max)", nullable: true), + TimeLifeInDays = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Category", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Certificate", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false), + ExternalId = table.Column(type: "nvarchar(max)", nullable: true), + ModifiedDate = table.Column(type: "bigint", nullable: false), + AddedDate = table.Column(type: "bigint", nullable: false), + DeletedDate = table.Column(type: "bigint", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: true), + OwnerAccountId = table.Column(type: "nvarchar(max)", nullable: true), + CustomerId = table.Column(type: "nvarchar(max)", nullable: true), + ExpiredDate = table.Column(type: "bigint", nullable: false), + PublishDate = table.Column(type: "bigint", nullable: false), + CreatorId = table.Column(type: "nvarchar(max)", nullable: true), + PublishCode = table.Column(type: "nvarchar(max)", nullable: true), + IsVisible = table.Column(type: "bit", nullable: false), + CategoryId = table.Column(type: "bigint", nullable: false), + Lock = table.Column(type: "bit", nullable: false), + LockedDate = table.Column(type: "bigint", nullable: false), + LockInfo = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Certificate", x => x.Id); + table.ForeignKey( + name: "FK_Certificate_Category_CategoryId", + column: x => x.CategoryId, + principalTable: "Category", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LanguageInfos", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false), + ModifiedDate = table.Column(type: "bigint", nullable: false), + AddedDate = table.Column(type: "bigint", nullable: false), + DeletedDate = table.Column(type: "bigint", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: true), + CertificateId = table.Column(type: "bigint", nullable: false), + LanguageId = table.Column(type: "int", nullable: false), + Lastname = table.Column(type: "nvarchar(max)", nullable: true), + Firstname = table.Column(type: "nvarchar(max)", nullable: true), + Middlename = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_LanguageInfos", x => x.Id); + table.ForeignKey( + name: "FK_LanguageInfos_Certificate_CertificateId", + column: x => x.CertificateId, + principalTable: "Certificate", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Certificate_CategoryId", + table: "Certificate", + column: "CategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_LanguageInfos_CertificateId", + table: "LanguageInfos", + column: "CertificateId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "LanguageInfos"); + + migrationBuilder.DropTable( + name: "Certificate"); + + migrationBuilder.DropTable( + name: "Category"); + + migrationBuilder.DropSequence( + name: "category_hilo"); + + migrationBuilder.DropSequence( + name: "certificate_hilo"); + + migrationBuilder.DropSequence( + name: "languageInfo_hilo"); + } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagementDbContextModelSnapshot.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagementDbContextModelSnapshot.cs new file mode 100644 index 00000000..00eacb29 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagementDbContextModelSnapshot.cs @@ -0,0 +1,214 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using O2NextGen.CertificateManagement.Infrastructure.Data; + +#nullable disable + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations +{ + [DbContext(typeof(CertificateManagementDbContext))] + partial class CertificateManagementDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.HasSequence("category_hilo") + .IncrementsBy(10); + + modelBuilder.HasSequence("certificate_hilo") + .IncrementsBy(10); + + modelBuilder.HasSequence("languageInfo_hilo") + .IncrementsBy(10); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CategoryDbEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "category_hilo"); + + b.Property("AddedDate") + .HasColumnType("bigint"); + + b.Property("CategoryDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("CategoryName") + .HasColumnType("nvarchar(max)"); + + b.Property("CategorySeries") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerId") + .HasColumnType("nvarchar(max)"); + + b.Property("DeletedDate") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedDate") + .HasColumnType("bigint"); + + b.Property("QuantityCertificates") + .HasColumnType("int"); + + b.Property("QuantityPublishCode") + .HasColumnType("int"); + + b.Property("TimeLifeInDays") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Category", (string)null); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "certificate_hilo"); + + b.Property("AddedDate") + .HasColumnType("bigint"); + + b.Property("CategoryId") + .HasColumnType("bigint"); + + b.Property("CreatorId") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerId") + .HasColumnType("nvarchar(max)"); + + b.Property("DeletedDate") + .HasColumnType("bigint"); + + b.Property("ExpiredDate") + .HasColumnType("bigint"); + + b.Property("ExternalId") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsVisible") + .HasColumnType("bit"); + + b.Property("Lock") + .HasColumnType("bit"); + + b.Property("LockInfo") + .HasColumnType("nvarchar(max)"); + + b.Property("LockedDate") + .HasColumnType("bigint"); + + b.Property("ModifiedDate") + .HasColumnType("bigint"); + + b.Property("OwnerAccountId") + .HasColumnType("nvarchar(max)"); + + b.Property("PublishCode") + .HasColumnType("nvarchar(max)"); + + b.Property("PublishDate") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Certificate", (string)null); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.LanguageInfoDbEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseHiLo(b.Property("Id"), "languageInfo_hilo"); + + b.Property("AddedDate") + .HasColumnType("bigint"); + + b.Property("CertificateId") + .HasColumnType("bigint"); + + b.Property("DeletedDate") + .HasColumnType("bigint"); + + b.Property("Firstname") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LanguageId") + .HasColumnType("int"); + + b.Property("Lastname") + .HasColumnType("nvarchar(max)"); + + b.Property("Middlename") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedDate") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CertificateId"); + + b.ToTable("LanguageInfos", (string)null); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", b => + { + b.HasOne("O2NextGen.CertificateManagement.Domain.Entities.CategoryDbEntity", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.LanguageInfoDbEntity", b => + { + b.HasOne("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", "Certificate") + .WithMany("LanguageInfos") + .HasForeignKey("CertificateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Certificate"); + }); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Domain.Entities.CertificateDbEntity", b => + { + b.Navigation("LanguageInfos"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagerDbContextModelSnapshot.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagerDbContextModelSnapshot.cs deleted file mode 100644 index 3f18d762..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagerDbContextModelSnapshot.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using O2NextGen.CertificateManagement.Data; - -namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations -{ - [DbContext(typeof(CertificateManagementDbContext))] - partial class CertificateManagerDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.1.14-servicing-32113") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("Relational:Sequence:.certificate_hilo", "'certificate_hilo', '', '1', '10', '', '', 'Int64', 'False'") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("O2NextGen.CertificateManagement.Data.Entities.CertificateEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("SqlServer:HiLoSequenceName", "certificate_hilo") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); - - b.Property("Name"); - - b.HasKey("Id"); - - b.ToTable("Certificate"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj index 2ec5fcde..d9adbbdc 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj @@ -3,7 +3,7 @@ net6.0 enable - enable + disable @@ -11,13 +11,11 @@ - - diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs index 0859a68d..f3d7e336 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs @@ -8,7 +8,7 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Queries { - public class CertificateQueryHandler : IQueryHandler + public class CertificateQueryHandler : IQueryHandler { private readonly CertificateManagementDbContext context; @@ -16,9 +16,9 @@ public CertificateQueryHandler(CertificateManagementDbContext context) { this.context = context; } - public async Task HandleAsync(CertificateQuery query, CancellationToken ct) + public async Task HandleAsync(CertificateQuery query, CancellationToken ct) { - var result = await context.Set().FindAsync(new object[] { query.Id }, ct); + var result = await context.Set().FindAsync(new object[] { query.Id }, ct); return result; } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs index 54814a3d..066e39a0 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs @@ -6,7 +6,7 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Queries { - public class CertificatesQueryHandler : IQueryHandler> + public class CertificatesQueryHandler : IQueryHandler> { private readonly CertificateManagementDbContext context; @@ -14,7 +14,7 @@ public CertificatesQueryHandler(CertificateManagementDbContext context) { this.context = context; } - public async Task> HandleAsync(CertificatesQuery query, CancellationToken ct) + public async Task> HandleAsync(CertificatesQuery query, CancellationToken ct) => (await context .Certificates .ToListAsync(ct)) From 76cd8d42cbbdc1076a62815a23839daeecf36f6e Mon Sep 17 00:00:00 2001 From: Denis Prokharchyk Date: Fri, 6 Jan 2023 10:51:13 +0300 Subject: [PATCH 4/5] fix(issue-319): update cgen-api --- src/Services/c-gen/O2NextGen.CGen.sln | 36 +++++---- .../c-gen/O2NextGen.CGen.v3.ncrunchsolution | 7 ++ .../Controllers/CategoryController.cs | 11 ++- .../Controllers/CertificatesController.cs | 9 +-- .../Controllers/VersionController.cs | 2 +- .../Filters/ApiExceptionFilter.cs | 4 +- .../IoC/ServiceCollectionExtensions.cs | 11 ++- .../Logging/ElasticJsonFormatter.cs | 2 +- .../Mappings/CategoryMappings.cs | 6 +- .../Mappings/CertificateMappings.cs | 4 +- ...ertificateManagement.Api.v3.ncrunchproject | 7 ++ .../Program.cs | 16 ++-- .../Services/CustomerService.cs | 4 +- .../Setup/BasicConfiguration.cs | 2 +- .../Startup.cs | 21 +++--- .../StartupHelpers/DatabaseExtensions.cs | 2 +- .../ViewModels/CategoryViewModel.cs | 3 +- .../Controllers/VersionController.cs | 4 +- .../Categories/CategoriesController.cs | 75 +++++++++++++++++++ .../Categories/CategoriesControlller.cs | 38 ---------- .../CreateCategoryDetailsCommandModel.cs | 6 ++ .../Certificates/CertificatesController.cs | 61 +++++++-------- .../CreateCertificateDetailsCommandModel.cs | 7 +- .../UpdateCertificateDetailsCommandModel.cs | 7 +- .../IoC/ServiceCollectionExtensions.cs | 27 +++---- ...n.CertificateManagement.Application.csproj | 20 ++--- ...teManagement.Application.v3.ncrunchproject | 8 ++ .../Program.cs | 9 ++- .../Properties/launchSettings.json | 2 +- .../WeatherForecast.cs | 15 ---- .../appsettings.Development.json | 3 + .../Models/Category.cs | 3 +- ...icateManagement.Business.v3.ncrunchproject | 7 ++ .../Services/ICategoryService.cs | 4 +- .../Services/ICertificatesService.cs | 4 +- .../Entities/CertificateEntity.cs | 14 ++-- ...rtificateManagement.Data.v3.ncrunchproject | 7 ++ .../Data/IEntity.cs | 3 +- .../Data/IRepository.cs | 3 +- .../Data/Queries/CategoriesQuery.cs | 11 +++ .../Data/Queries/CategoryQuery.cs | 13 ++++ .../Data/Queries/CertificateQuery.cs | 14 ++-- .../Data/Queries/CertificatesQuery.cs | 6 +- .../{CategoryDbEntity.cs => Category.cs} | 6 +- ...{CertificateDbEntity.cs => Certificate.cs} | 8 +- ...anguageInfoDbEntity.cs => LanguageInfo.cs} | 4 +- ...extGen.CertificateManagement.Domain.csproj | 38 ++-------- ...ificateManagement.Domain.v3.ncrunchproject | 8 ++ .../CreateCategory/CreateCategoryCommand.cs | 9 --- .../CreateCategoryCommandResult.cs | 8 -- .../CreateCategory/CreateCategoryHandler.cs | 23 ------ .../GetCertificate/GetCertificateQuery.cs | 18 ----- .../GetCertificates/GetCertificatesQuery.cs | 10 --- .../GetCertificatesQueryHandler.cs | 54 ------------- .../CreateCategory/CreateCategoryCommand.cs | 20 +++++ .../CreateCategoryCommandHandler.cs | 54 +++++++++++++ .../CreateCategoryCommandResult.cs | 34 +++++++++ .../DeleteCategory/DeleteCategoryCommand.cs | 11 +++ .../GetCategories/GetCategoriesQuery.cs | 7 ++ .../GetCategoriesQueryHandler.cs | 38 ++++++++++ .../GetCategories/GetCategoriesQueryResult.cs | 22 ++++++ .../GetCategory/GetCategoryQuery.cs | 15 ++++ .../GetCategory/GetCategoryQueryHandler.cs | 42 +++++++++++ .../GetCategory/GetCategoryQueryResult.cs | 24 ++++++ .../CreateCertificateCommand.cs | 13 ++-- .../CreateCertificateCommandHandler.cs | 15 ++-- .../CreateCertificateCommandResult.cs | 14 ++-- .../DeleteCertificateCommand.cs | 9 +-- .../DeleteCertificateCommandHandler.cs | 21 ++++-- .../GetCertificate/GetCertificateQuery.cs | 18 +++++ .../GetCertificateQueryHandler.cs | 20 ++--- .../GetCertificateQueryResult.cs | 16 ++-- .../GetCertificates/GetCertificatesQuery.cs | 9 +++ .../GetCertificatesQueryHandler.cs | 55 ++++++++++++++ .../GetCertificatesQueryResult.cs | 27 ++++--- .../UpdateCertificateDetailsCommand.cs | 20 ++--- .../UpdateCertificateDetailsCommandHandler.cs | 15 ++-- .../UpdateCertificateDetailsCommandResult.cs | 8 +- .../Mappings/CategoryMappings.cs | 4 +- .../Mappings/CertificateMappings.cs | 6 +- ...rtificateManagement.Impl.v3.ncrunchproject | 7 ++ .../Services/CertificatesService.cs | 14 ++-- .../Services/InMemoryCategoriesService.cs | 6 +- .../Services/InMemoryCertificatesService.cs | 6 +- ...anagementDbContext.cs => CGenDbContext.cs} | 9 +-- .../CategoryDbEntityConfiguration.cs | 4 +- .../CertificateDbEntityConfiguration.cs | 4 +- .../LanguageInfoDbEntityConfiguration.cs | 4 +- .../Data/EfRepository.cs | 8 +- .../20221225101744_InitDatabase.Designer.cs | 2 +- .../Migrations/20221225101744_InitDatabase.cs | 6 +- ...pshot.cs => CGenDbContextModelSnapshot.cs} | 8 +- ...ertificateManagement.Infrastructure.csproj | 12 +-- ...anagement.Infrastructure.v3.ncrunchproject | 8 ++ .../Queries/CategoriesQueryHandler.cs | 27 +++++++ .../Queries/CategoryQueryHandler.cs | 26 +++++++ .../Queries/CertificateQueryHandler.cs | 17 ++--- .../Queries/CertificatesQueryHandler.cs | 13 ++-- .../DatabaseInitializerHostedService.cs | 1 + ...eManagement.StartupTasks.v3.ncrunchproject | 8 ++ .../CategoryServiceTests.cs | 3 +- .../CertificateManagementTestsStartup.cs | 3 +- ...ertificateManagement.Api.v3.ncrunchproject | 7 ++ .../CertificateControllerTests.cs | 41 +++++++--- ...n.CertificateManagement.Application.csproj | 5 ++ ...teManagement.Application.v3.ncrunchproject | 7 ++ .../TestsStartup.cs | 11 +-- ...ertificateManagement.Api.v3.ncrunchproject | 7 ++ ...rtificateManagement.Impl.v3.ncrunchproject | 7 ++ .../Data/Queries/QueryHandlerTests.cs | 48 ++++++++++++ ...ertificateManagement.Infrastructure.csproj | 29 +++++++ ...anagement.Infrastructure.v3.ncrunchproject | 7 ++ .../Usings.cs | 1 + src/Services/c-gen/global.json | 7 ++ 114 files changed, 1060 insertions(+), 554 deletions(-) create mode 100644 src/Services/c-gen/O2NextGen.CGen.v3.ncrunchsolution create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.v3.ncrunchproject create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryDetailsCommandModel.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.v3.ncrunchproject delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Application/WeatherForecast.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.v3.ncrunchproject create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.v3.ncrunchproject create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/{CategoryDbEntity.cs => Category.cs} (80%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/{CertificateDbEntity.cs => Certificate.cs} (76%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/{LanguageInfoDbEntity.cs => LanguageInfo.cs} (84%) create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.v3.ncrunchproject delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommand.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommandResult.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryHandler.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQuery.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQuery.cs delete mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandHandler.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/CreateCertificate/CreateCertificateCommand.cs (79%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/CreateCertificate/CreateCertificateCommandHandler.cs (79%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/CreateCertificate/CreateCertificateCommandResult.cs (82%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/DeleteCertificate/DeleteCertificateCommand.cs (56%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/DeleteCertificate/DeleteCertificateCommandHandler.cs (55%) create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/GetCertificate/GetCertificateQueryHandler.cs (76%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/GetCertificate/GetCertificateQueryResult.cs (78%) create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/GetCertificates/GetCertificatesQueryResult.cs (66%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/UpdateCertificate/UpdateCertificateDetailsCommand.cs (76%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs (86%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/{Certificate => ForCertificate}/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs (85%) create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.v3.ncrunchproject rename src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/{CertificateManagementDbContext.cs => CGenDbContext.cs} (78%) rename src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/{CertificateManagementDbContextModelSnapshot.cs => CGenDbContextModelSnapshot.cs} (95%) create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoriesQueryHandler.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoryQueryHandler.cs create mode 100644 src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.v3.ncrunchproject create mode 100644 src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject create mode 100644 src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject create mode 100644 src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Api/Tests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject create mode 100644 src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Impl/Tests.O2NextGen.CertificateManagement.Impl.v3.ncrunchproject create mode 100644 src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Data/Queries/QueryHandlerTests.cs create mode 100644 src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.csproj create mode 100644 src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject create mode 100644 src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Usings.cs create mode 100644 src/Services/c-gen/global.json diff --git a/src/Services/c-gen/O2NextGen.CGen.sln b/src/Services/c-gen/O2NextGen.CGen.sln index a616a905..5ca96657 100644 --- a/src/Services/c-gen/O2NextGen.CGen.sln +++ b/src/Services/c-gen/O2NextGen.CGen.sln @@ -17,25 +17,29 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.O2NextGen.Certificate EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.O2NextGen.CertificateManagement.Impl", "Tests\Tests.O2NextGen.CertificateManagement.Impl\Tests.O2NextGen.CertificateManagement.Impl.csproj", "{6FB50F98-47E7-4960-80F0-58562914ADDE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests.O2NextGen.CertificateManagement.Api", "Tests\IntegrationTests.O2NextGen.CertificateManagement.Api\IntegrationTests.O2NextGen.CertificateManagement.Api.csproj", "{094FF4EB-0351-44BF-9739-4F3A62721DFC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests.O2NextGen.CertificateManagement.Api", "Tests\IntegrationTests.O2NextGen.CertificateManagement.Api\IntegrationTests.O2NextGen.CertificateManagement.Api.csproj", "{094FF4EB-0351-44BF-9739-4F3A62721DFC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SDKs", "SDKs", "{54AADF48-C069-49F7-B8A8-3B72F5FC3F14}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.Sdk.NetCore.Models", "..\..\SDKs\O2NG.Sdk.NetCore\O2NG.Sdk.NetCore.Models\O2NextGen.Sdk.NetCore.Models.csproj", "{AFA64E01-DA06-4432-9BEA-34D0F4AD6A54}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.Sdk.NetCore.Models", "..\..\SDKs\O2NG.Sdk.NetCore\O2NG.Sdk.NetCore.Models\O2NextGen.Sdk.NetCore.Models.csproj", "{AFA64E01-DA06-4432-9BEA-34D0F4AD6A54}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Domain", "O2NextGen.CertificateManagement.Domain\O2NextGen.CertificateManagement.Domain.csproj", "{30072535-9AFD-45CE-8258-87BF3CAA2EC2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.Domain", "O2NextGen.CertificateManagement.Domain\O2NextGen.CertificateManagement.Domain.csproj", "{30072535-9AFD-45CE-8258-87BF3CAA2EC2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.StartupTasks", "O2NextGen.CertificateManagement.StartupTasks\O2NextGen.CertificateManagement.StartupTasks.csproj", "{9BE85DEE-293B-4E57-BD0F-01E3B48F7A61}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.StartupTasks", "O2NextGen.CertificateManagement.StartupTasks\O2NextGen.CertificateManagement.StartupTasks.csproj", "{9BE85DEE-293B-4E57-BD0F-01E3B48F7A61}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Infrastructure", "O2NextGen.CertificateManagement.Infrastructure\O2NextGen.CertificateManagement.Infrastructure.csproj", "{125F9B7B-1508-4F01-A9AA-2EBC01BE0C19}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.Infrastructure", "O2NextGen.CertificateManagement.Infrastructure\O2NextGen.CertificateManagement.Infrastructure.csproj", "{125F9B7B-1508-4F01-A9AA-2EBC01BE0C19}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CQRS", "CQRS", "{716B7603-CDF7-460D-A869-20FE90F84EC2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Skeleton", "Skeleton", "{2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Application", "O2NextGen.CertificateManagement.Application\O2NextGen.CertificateManagement.Application.csproj", "{BC6D2691-1006-4B6D-B661-81157E493F3B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.Application", "O2NextGen.CertificateManagement.Application\O2NextGen.CertificateManagement.Application.csproj", "{BC6D2691-1006-4B6D-B661-81157E493F3B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests.O2NextGen.CertificateManagement.Application", "Tests\IntegrationTests.O2NextGen.CertificateManagement.Application\IntegrationTests.O2NextGen.CertificateManagement.Application.csproj", "{58CC0839-863D-4708-A6D4-42F245593538}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests.O2NextGen.CertificateManagement.Application", "Tests\IntegrationTests.O2NextGen.CertificateManagement.Application\IntegrationTests.O2NextGen.CertificateManagement.Application.csproj", "{58CC0839-863D-4708-A6D4-42F245593538}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CQRS", "CQRS", "{0835E199-8062-45E0-899E-38ECAD9437CD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.O2NextGen.CertificateManagement.Infrastructure", "Tests\Tests.O2NextGen.CertificateManagement.Infrastructure\Tests.O2NextGen.CertificateManagement.Infrastructure.csproj", "{EC5B79FF-4A87-4740-B5EC-2778861EB017}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -95,24 +99,30 @@ Global {58CC0839-863D-4708-A6D4-42F245593538}.Debug|Any CPU.Build.0 = Debug|Any CPU {58CC0839-863D-4708-A6D4-42F245593538}.Release|Any CPU.ActiveCfg = Release|Any CPU {58CC0839-863D-4708-A6D4-42F245593538}.Release|Any CPU.Build.0 = Release|Any CPU + {EC5B79FF-4A87-4740-B5EC-2778861EB017}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC5B79FF-4A87-4740-B5EC-2778861EB017}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC5B79FF-4A87-4740-B5EC-2778861EB017}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC5B79FF-4A87-4740-B5EC-2778861EB017}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {EA540B06-8A73-49C7-A799-49423B316458} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} + {C6E0B2A5-6349-4C1D-8E14-82249AF8F58A} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} + {01805439-2954-49CE-93D2-5EB06B82146C} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} + {B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} {CEA7184F-87D5-4141-A4BC-A983BF257AC6} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} {6FB50F98-47E7-4960-80F0-58562914ADDE} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} {094FF4EB-0351-44BF-9739-4F3A62721DFC} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} {AFA64E01-DA06-4432-9BEA-34D0F4AD6A54} = {54AADF48-C069-49F7-B8A8-3B72F5FC3F14} - {EA540B06-8A73-49C7-A799-49423B316458} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} - {C6E0B2A5-6349-4C1D-8E14-82249AF8F58A} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} - {B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} - {01805439-2954-49CE-93D2-5EB06B82146C} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} {30072535-9AFD-45CE-8258-87BF3CAA2EC2} = {716B7603-CDF7-460D-A869-20FE90F84EC2} - {125F9B7B-1508-4F01-A9AA-2EBC01BE0C19} = {716B7603-CDF7-460D-A869-20FE90F84EC2} {9BE85DEE-293B-4E57-BD0F-01E3B48F7A61} = {716B7603-CDF7-460D-A869-20FE90F84EC2} + {125F9B7B-1508-4F01-A9AA-2EBC01BE0C19} = {716B7603-CDF7-460D-A869-20FE90F84EC2} {BC6D2691-1006-4B6D-B661-81157E493F3B} = {716B7603-CDF7-460D-A869-20FE90F84EC2} - {58CC0839-863D-4708-A6D4-42F245593538} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} + {58CC0839-863D-4708-A6D4-42F245593538} = {0835E199-8062-45E0-899E-38ECAD9437CD} + {0835E199-8062-45E0-899E-38ECAD9437CD} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} + {EC5B79FF-4A87-4740-B5EC-2778861EB017} = {0835E199-8062-45E0-899E-38ECAD9437CD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A6DFC9F0-3FA7-492B-ACE9-3EFBF3477712} diff --git a/src/Services/c-gen/O2NextGen.CGen.v3.ncrunchsolution b/src/Services/c-gen/O2NextGen.CGen.v3.ncrunchsolution new file mode 100644 index 00000000..63251f99 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CGen.v3.ncrunchsolution @@ -0,0 +1,7 @@ + + + True + + True + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CategoryController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CategoryController.cs index 7793b011..d78835a9 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CategoryController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CategoryController.cs @@ -1,11 +1,10 @@ -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using O2NextGen.CertificateManagement.Api.Setup; -using O2NextGen.CertificateManagement.Business.Services; +using Microsoft.AspNetCore.Mvc; using O2NextGen.CertificateManagement.Api.Mappings; -using O2NextGen.Sdk.NetCore.Models.c_gen; +using O2NextGen.CertificateManagement.Api.Setup; using O2NextGen.CertificateManagement.Api.ViewModels; +using O2NextGen.CertificateManagement.Business.Services; +using System.Threading; +using System.Threading.Tasks; namespace O2NextGen.CertificateManagement.Api.Controllers { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs index 70262f6f..ae0b2b68 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs @@ -1,13 +1,10 @@ -using System.Threading; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using O2NextGen.CertificateManagement.Api.Mappings; using O2NextGen.CertificateManagement.Api.Setup; using O2NextGen.CertificateManagement.Business.Services; -using O2NextGen.CertificateManagement.Api.Mappings; using O2NextGen.Sdk.NetCore.Models.c_gen; -using O2NextGen.CertificateManagement.Impl.Services; -using MediatR; -using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate; +using System.Threading; +using System.Threading.Tasks; namespace O2NextGen.CertificateManagement.Api.Controllers { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs index a35164d5..5b16a180 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs @@ -1,8 +1,8 @@ -using System.Reflection; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; +using System.Reflection; namespace O2NextGen.CertificateManagement.Api.Controllers { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Filters/ApiExceptionFilter.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Filters/ApiExceptionFilter.cs index 34aecb64..d1aa33e3 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Filters/ApiExceptionFilter.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Filters/ApiExceptionFilter.cs @@ -4,7 +4,7 @@ namespace O2NextGen.CertificateManagement.Api.Filters { - public class ApiExceptionFilter: IExceptionFilter + public class ApiExceptionFilter : IExceptionFilter { public void OnException(ExceptionContext context) @@ -12,7 +12,7 @@ public void OnException(ExceptionContext context) if (context.ExceptionHandled is DbUpdateConcurrencyException) { context.Result = - new ConflictObjectResult(new {Message = "Entity was updated, please refresh your copy."}); + new ConflictObjectResult(new { Message = "Entity was updated, please refresh your copy." }); } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/IoC/ServiceCollectionExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/IoC/ServiceCollectionExtensions.cs index 91fa50c2..da71868b 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/IoC/ServiceCollectionExtensions.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/IoC/ServiceCollectionExtensions.cs @@ -1,5 +1,3 @@ -using System; -using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -9,6 +7,7 @@ using O2NextGen.CertificateManagement.Business.Services; using O2NextGen.CertificateManagement.Data; using O2NextGen.CertificateManagement.Impl.Services; +using System; namespace O2NextGen.CertificateManagement.Api.IoC { @@ -18,10 +17,10 @@ public static class ServiceCollectionExtensions public static TConfig ConfigurePOCO(this IServiceCollection services, IConfiguration configuration) where TConfig : class, new() { - if (services == null) - throw new ArgumentNullException(nameof(services)); - - if (configuration == null) + if (services == null) + throw new ArgumentNullException(nameof(services)); + + if (configuration == null) throw new ArgumentNullException(nameof(configuration)); var config = new TConfig(); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Logging/ElasticJsonFormatter.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Logging/ElasticJsonFormatter.cs index 1cbb943d..669cdaf6 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Logging/ElasticJsonFormatter.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Logging/ElasticJsonFormatter.cs @@ -1,9 +1,9 @@ -using System.IO; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Serilog.Events; using Serilog.Formatting; using Serilog.Formatting.Json; +using System.IO; namespace O2NextGen.CertificateManagement.Api.Logging { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CategoryMappings.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CategoryMappings.cs index a5b7f968..67760f58 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CategoryMappings.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CategoryMappings.cs @@ -1,8 +1,8 @@ -using System; +using O2NextGen.CertificateManagement.Api.ViewModels; +using O2NextGen.CertificateManagement.Business.Models; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using O2NextGen.CertificateManagement.Api.ViewModels; -using O2NextGen.CertificateManagement.Business.Models; namespace O2NextGen.CertificateManagement.Api.Mappings { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CertificateMappings.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CertificateMappings.cs index 3955d335..6d4dad0a 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CertificateMappings.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CertificateMappings.cs @@ -1,8 +1,8 @@ +using O2NextGen.CertificateManagement.Business.Models; +using O2NextGen.Sdk.NetCore.Models.c_gen; using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using O2NextGen.CertificateManagement.Business.Models; -using O2NextGen.Sdk.NetCore.Models.c_gen; namespace O2NextGen.CertificateManagement.Api.Mappings { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Program.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Program.cs index cd8ff93b..7b53c438 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Program.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Program.cs @@ -1,8 +1,8 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Serilog; +using System; +using System.Threading.Tasks; namespace O2NextGen.CertificateManagement.Api { @@ -11,11 +11,11 @@ public class Program public static readonly string Namespace = typeof(Program).Namespace; public static readonly string AppName = - Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); - + Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); + public static async Task Main(string[] args) - { - + { + try { var host = CreateHostBuilder(args); @@ -44,6 +44,6 @@ public static IWebHost CreateHostBuilder(string[] args) => configuration.ReadFrom.Configuration(context.Configuration); }) .UseStartup() - .Build(); + .Build(); } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/CustomerService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/CustomerService.cs index 01455903..fccb8e57 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/CustomerService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/CustomerService.cs @@ -1,5 +1,5 @@ -using System; -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; +using System; namespace O2NextGen.CertificateManagement.Api.Services { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Setup/BasicConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Setup/BasicConfiguration.cs index b35d28e0..985a09f4 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Setup/BasicConfiguration.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Setup/BasicConfiguration.cs @@ -2,6 +2,6 @@ namespace O2NextGen.CertificateManagement.Api.Setup { public class UrlsConfig { - public string Auth { get; set; } + public string Auth { get; set; } } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs index 2c092f89..0da04bad 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs @@ -1,18 +1,17 @@ -using System.Net; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using O2NextGen.CertificateManagement.Api.Setup; -using O2NextGen.CertificateManagement.Api.Helpers; -using O2NextGen.CertificateManagement.Api.IoC; -using Swashbuckle.AspNetCore.Swagger; using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; +using O2NextGen.CertificateManagement.Api.Helpers; +using O2NextGen.CertificateManagement.Api.IoC; +using O2NextGen.CertificateManagement.Api.Setup; +using System.Net; +using System.Threading.Tasks; [assembly: ApiController] namespace O2NextGen.CertificateManagement.Api @@ -35,7 +34,7 @@ public void ConfigureServices(IServiceCollection services) services.AddSwaggerGen(options => { options.DescribeAllParametersInCamelCase(); - options.SwaggerDoc("v1",new OpenApiInfo() + options.SwaggerDoc("v1", new OpenApiInfo() { Title = "O2NextGen Platform. C-Gen HTTP API", Version = "v1", @@ -59,7 +58,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { builder.Run(async context => { - context.Response.StatusCode = (int) HttpStatusCode.InternalServerError; + context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get(); @@ -70,8 +69,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) } }); }); - } - + } + app.UseStaticFiles(); app.UseSwagger() .UseSwaggerUI(c => diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/StartupHelpers/DatabaseExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/StartupHelpers/DatabaseExtensions.cs index 83f7c4d2..80fb8edb 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/StartupHelpers/DatabaseExtensions.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/StartupHelpers/DatabaseExtensions.cs @@ -1,7 +1,7 @@ -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using O2NextGen.CertificateManagement.Data; +using System.Threading.Tasks; // ReSharper disable once CheckNamespace namespace Microsoft.AspNetCore.Hosting diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/ViewModels/CategoryViewModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/ViewModels/CategoryViewModel.cs index 862aa9b2..aceabcbe 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/ViewModels/CategoryViewModel.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/ViewModels/CategoryViewModel.cs @@ -1,5 +1,4 @@ -using System; -namespace O2NextGen.CertificateManagement.Api.ViewModels +namespace O2NextGen.CertificateManagement.Api.ViewModels { public class CategoryViewModel { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs index fda1c655..2b79c796 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs @@ -1,7 +1,7 @@ -using System.Reflection; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using System.Reflection; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Logging; namespace O2NextGen.CertificateManagement.Application.Controllers diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs new file mode 100644 index 00000000..b16cb8bc --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs @@ -0,0 +1,75 @@ +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using O2NextGen.CertificateManagement.Application.Controllers; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory; + +namespace O2NextGen.CertificateManagement.Application.Features.Categories +{ + [Route("api/[controller]")] + public class CategoriesController : ControllerBase + { + #region Fields + + private readonly IMediator _mediator; + private readonly ILogger _logger; + + private static readonly string GetByIdActionName + = nameof(GetByIdAsync).Replace("Async", string.Empty); + #endregion + + + #region Ctors + + public CategoriesController(IMediator mediator, ILogger logger) + { + _mediator = mediator; + _logger = logger; + } + + #endregion + + + #region Methods + + [HttpGet] + [Route("{id}")] + public async Task GetByIdAsync(long id, CancellationToken ct) + { + var result = await _mediator.Send(new GetCategoryQuery(id)); + + if (result is null) + return NotFound(); + + return Ok(result); + } + + [HttpGet] + [Route("")] + public async Task GetAllAsync() + { + var result = await _mediator.Send(new GetCategoriesQuery()); + return Ok(result.Categories); + } + + [HttpPut] + [HttpPost] + [Route("")] + public async Task> AddAsync( + CreateCategoryDetailsCommandModel model, + CancellationToken ct) + { + var result = await _mediator.Send( + new CreateCategoryCommand()); + return CreatedAtAction(GetByIdActionName, + new { id = result.Id }, result); + } + + #endregion + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs deleted file mode 100644 index 95d92a45..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesControlller.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using MediatR; -using Microsoft.AspNetCore.Mvc; -using O2NextGen.CertificateManagement.Application.Controllers; - -namespace O2NextGen.CertificateManagement.Application.Features.Categories -{ - [Route("api/[controller]")] - public class CategoriesControlller : ControllerBase - { - #region Fields - - private readonly IMediator mediator; - private readonly ILogger logger; - - #endregion - - - #region Ctors - - public CategoriesControlller(IMediator mediator, ILogger logger) - { - this.mediator = mediator; - this.logger = logger; - } - - #endregion - - - #region Methods - - #endregion - } -} - diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryDetailsCommandModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryDetailsCommandModel.cs new file mode 100644 index 00000000..65941ff2 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryDetailsCommandModel.cs @@ -0,0 +1,6 @@ +namespace O2NextGen.CertificateManagement.Application.Features.Categories +{ + public class CreateCategoryDetailsCommandModel + { + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs index 26f18508..311075df 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs @@ -1,12 +1,13 @@ -using System; -using System.Threading; +using System.Threading; +using System.Threading.Tasks; using MediatR; using Microsoft.AspNetCore.Mvc; -using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate; -using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCertificate; -using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; -using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate; -using static O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate.GetCertificatesQueryResult; +using Microsoft.Extensions.Logging; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.UpdateCertificate; namespace O2NextGen.CertificateManagement.Application.Controllers { @@ -16,7 +17,7 @@ public partial class CertificatesController : ControllerBase #region Fields private readonly IMediator _mediator; - private readonly ILogger logger; + private readonly ILogger _logger; private static readonly string GetByIdActionName = nameof(GetByIdAsync).Replace("Async", string.Empty); @@ -28,7 +29,7 @@ private static readonly string GetByIdActionName public CertificatesController(IMediator mediator, ILogger logger) { _mediator = mediator; - this.logger = logger; + _logger = logger; } #endregion @@ -40,7 +41,7 @@ public CertificatesController(IMediator mediator, ILogger GetByIdAsync(long id, CancellationToken ct) { - var result = await _mediator.Send(new GetCertificateQuery(id)); + var result = await _mediator.Send(new CertificateQuery(id)); if (result is null) return NotFound(); @@ -64,24 +65,24 @@ public async Task> UpdateAsy var result = await _mediator.Send( new UpdateCertificateDetailsCommand( id, - model.ExternalId, - model.ModifiedDate, - model.AddedDate, - model.DeletedDate, - model.IsDeleted, - model.OwnerAccountId, - model.CustomerId, - model.ExpiredDate, - model.PublishDate, - model.CreatorId, - model.PublishCode, - model.IsVisible, - model.CategoryId, - model.Category, - model.Lock, - model.LockedDate, - model.LockInfo, - model.LanguageInfos)); + model.ExternalId, + model.ModifiedDate, + model.AddedDate, + model.DeletedDate, + model.IsDeleted, + model.OwnerAccountId, + model.CustomerId, + model.ExpiredDate, + model.PublishDate, + model.CreatorId, + model.PublishCode, + model.IsVisible, + model.CategoryId, + model.Category, + model.Lock, + model.LockedDate, + model.LockInfo, + model.LanguageInfos)); if (result is null) { @@ -127,7 +128,7 @@ public async Task RemoveAsync(long id, CancellationToken ct) await _mediator.Send(new DeleteCertificateCommand(id)); return NoContent(); } - } - #endregion + #endregion + } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs index a6a51300..91cb0f14 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs @@ -1,4 +1,5 @@ -using O2NextGen.CertificateManagement.Domain.Entities; +using System.Collections.Generic; +using O2NextGen.CertificateManagement.Domain.Entities; public class CreateCertificateDetailsCommandModel { @@ -14,10 +15,10 @@ public class CreateCertificateDetailsCommandModel public bool IsVisible { get; set; } public long CategoryId { get; set; } - public CategoryDbEntity Category { get; set; } + public Category Category { get; set; } public bool Lock { get; set; } public long LockedDate { get; set; } public string LockInfo { get; set; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs index 3f6fd2bc..cb0a07ef 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs @@ -1,4 +1,5 @@ -using O2NextGen.CertificateManagement.Domain.Entities; +using System.Collections.Generic; +using O2NextGen.CertificateManagement.Domain.Entities; public class UpdateCertificateDetailsCommandModel { @@ -14,11 +15,11 @@ public class UpdateCertificateDetailsCommandModel public bool IsVisible { get; set; } public long CategoryId { get; set; } - public CategoryDbEntity Category { get; set; } + public Category Category { get; set; } public bool Lock { get; set; } public long LockedDate { get; set; } public string LockInfo { get; set; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } public bool? ModifiedDate { get; internal set; } public string AddedDate { get; internal set; } public string DeletedDate { get; internal set; } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs index 1c9482d7..1571b777 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs @@ -1,25 +1,22 @@ using System; using MediatR; using Microsoft.EntityFrameworkCore; -using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; -using O2NextGen.CertificateManagement.Infrastructure.Data; using Microsoft.Extensions.Configuration; using O2NextGen.CertificateManagement.Domain.Data; -using System.Text.RegularExpressions; -using O2NextGen.CertificateManagement.Business.Models; using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Infrastructure.Data; namespace Microsoft.Extensions.DependencyInjection +{ + public static class ServiceCollectionExtensions { - public static class ServiceCollectionExtensions + public static IServiceCollection AddBusiness(this IServiceCollection services) { - public static IServiceCollection AddBusiness(this IServiceCollection services) - { - services.AddMediatR( - typeof(GetCertificateQuery)); + services.AddMediatR( + typeof(CertificateQuery)); - return services; - } + return services; + } public static TConfig ConfigurePOCO(this IServiceCollection services, IConfiguration configuration) where TConfig : class, new() @@ -33,10 +30,10 @@ public static TConfig ConfigurePOCO(this IServiceCollection services, I return config; } - public static IServiceCollection AddConfigEf(this IServiceCollection services, IConfiguration configuration) + public static IServiceCollection AddConfigEf(this IServiceCollection services, ConfigurationManager configuration) { var connectionString = configuration["ConnectionString"]; - services.AddDbContext(x => + services.AddDbContext(x => x.UseSqlServer(connectionString)); return services; } @@ -47,7 +44,7 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi services.Scan(scan => scan - .FromAssembliesOf(typeof(CertificateManagementDbContext)) + .FromAssembliesOf(typeof(CGenDbContext)) .AddClasses(classes => classes.AssignableTo(typeof(IRepository<>))) .AsImplementedInterfaces() .WithScopedLifetime() @@ -67,6 +64,6 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi return services; } } - + } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj index 85935ca5..69a7a6c5 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -34,26 +34,18 @@ - - - - - - - - - - - - - + + + + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.v3.ncrunchproject new file mode 100644 index 00000000..44cdd50f --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + True + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs index cdf20d88..6bee5714 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs @@ -1,12 +1,13 @@ -using Microsoft.AspNetCore.Builder; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using O2NextGen.CertificateManagement.Infrastructure.Data; using O2NextGen.CertificateManagement.StartupTasks.DatabaseInitializer; var builder = WebApplication.CreateBuilder(args); -ConfigurationManager configuration = builder.Configuration; -IWebHostEnvironment environment = builder.Environment; +var configuration = builder.Configuration; +var environment = builder.Environment; // Add services to the container. builder.Services.AddControllers(); @@ -14,7 +15,7 @@ builder.Services.AddSwaggerGen(); builder.Services .AddConfigEf(configuration) - .AddDatabaseInitializer() + .AddDatabaseInitializer() .AddBusiness() .AddInfrastructure(); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Properties/launchSettings.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Properties/launchSettings.json index bb0fe2e9..c03bb64c 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Properties/launchSettings.json +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Properties/launchSettings.json @@ -12,7 +12,7 @@ "O2NextGen.CertificateManagement.Application": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "http://localhost:33597", + "applicationUrl": "http://localhost:2579", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/WeatherForecast.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/WeatherForecast.cs deleted file mode 100644 index aee3dfcc..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/WeatherForecast.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace O2NextGen.CertificateManagement.Application -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json index 612a141b..8722d7d1 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json @@ -1,4 +1,7 @@ { + "DatabaseInitializerSettings": { + "Initialize": true + }, "ConnectionString": "Server=20.112.192.201;Initial Catalog=O2NextGen.CertificateDb-Dev;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30;", "Logging": { "LogLevel": { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Models/Category.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Models/Category.cs index 86bbdb44..73bd17d9 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Models/Category.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Models/Category.cs @@ -1,5 +1,4 @@ -using System; -namespace O2NextGen.CertificateManagement.Business.Models +namespace O2NextGen.CertificateManagement.Business.Models { public class Category { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICategoryService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICategoryService.cs index 50f72be1..1e98b36d 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICategoryService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICategoryService.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; +using O2NextGen.CertificateManagement.Business.Models; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using O2NextGen.CertificateManagement.Business.Models; namespace O2NextGen.CertificateManagement.Business.Services { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs index 1d46c006..0fc1e0cd 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; +using O2NextGen.CertificateManagement.Business.Models; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using O2NextGen.CertificateManagement.Business.Models; namespace O2NextGen.CertificateManagement.Business.Services { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CertificateEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CertificateEntity.cs index 5d48f262..be555747 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CertificateEntity.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CertificateEntity.cs @@ -1,8 +1,8 @@ -namespace O2NextGen.CertificateManagement.Data.Entities -{ - public class CertificateEntity - { - public long Id { get; set; } - public string Name { get; set; } - } +namespace O2NextGen.CertificateManagement.Data.Entities +{ + public class CertificateEntity + { + public long Id { get; set; } + public string Name { get; set; } + } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs index 9e56e9ba..b04a206a 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs @@ -1,5 +1,4 @@ -using System; -namespace O2NextGen.CertificateManagement.Domain.Data +namespace O2NextGen.CertificateManagement.Domain.Data { public interface IEntity { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs index d4367dbb..ad19cffd 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading; +using System.Threading; using System.Threading.Tasks; namespace O2NextGen.CertificateManagement.Domain.Data diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs new file mode 100644 index 00000000..c152c550 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.Data.Queries +{ + public class CategoriesQuery : IQuery> + { + + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs new file mode 100644 index 00000000..36e5ee0c --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs @@ -0,0 +1,13 @@ +namespace O2NextGen.CertificateManagement.Domain.Data.Queries +{ + public class CategoryQuery : IQuery + { + public CategoryQuery(long id) + { + Id = id; + } + + public long Id { get; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs index 7262d197..1ac47ad2 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs @@ -1,18 +1,18 @@ -using System; -using System.Text.RegularExpressions; +using System.Collections.Generic; using O2NextGen.CertificateManagement.Domain.Entities; namespace O2NextGen.CertificateManagement.Domain.Data.Queries { - public class CertificateQuery: IQuery + public class CertificateQuery : IQuery { - public CertificateQuery(long id) { Id = id; } - public CertificateQuery(string externalId, bool? isDeleted, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) + public CertificateQuery(string externalId, bool? isDeleted, string customerId, long expiredDate, long publishDate, + string creatorId, string publishCode, bool isVisible, long categoryId, Category category, + bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) { ExternalId = externalId; IsDeleted = isDeleted; @@ -40,11 +40,11 @@ public CertificateQuery(string externalId, bool? isDeleted, string customerId, l public string PublishCode { get; } public bool IsVisible { get; } public long CategoryId { get; } - public CategoryDbEntity Category { get; } + public Category Category { get; } public bool Lock { get; } public long LockedDate { get; } public string LockInfo { get; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs index 1e930563..ccc4d174 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs @@ -1,11 +1,9 @@ -using System; -using O2NextGen.CertificateManagement.Domain.Data; -using System.Text.RegularExpressions; +using System.Collections.Generic; using O2NextGen.CertificateManagement.Domain.Entities; namespace O2NextGen.CertificateManagement.Domain.Data.Queries { - public class CertificatesQuery: IQuery> + public class CertificatesQuery : IQuery> { } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryDbEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Category.cs similarity index 80% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryDbEntity.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Category.cs index da805a70..9312d93f 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryDbEntity.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Category.cs @@ -1,8 +1,6 @@ -using O2NextGen.CertificateManagement.Domain.Data; - -namespace O2NextGen.CertificateManagement.Domain.Entities +namespace O2NextGen.CertificateManagement.Domain.Entities { - public class CategoryDbEntity + public class Category { public long Id { get; set; } public long ModifiedDate { get; set; } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateDbEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Certificate.cs similarity index 76% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateDbEntity.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Certificate.cs index 636eab11..ed5e2920 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateDbEntity.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Certificate.cs @@ -1,8 +1,8 @@ -using O2NextGen.CertificateManagement.Domain.Data; +using System.Collections.Generic; namespace O2NextGen.CertificateManagement.Domain.Entities { - public class CertificateDbEntity + public class Certificate { public long Id { get; set; } public string ExternalId { get; set; } @@ -20,11 +20,11 @@ public class CertificateDbEntity public bool IsVisible { get; set; } public long CategoryId { get; set; } - public CategoryDbEntity Category { get; set; } + public Category Category { get; set; } public bool Lock { get; set; } public long LockedDate { get; set; } public string LockInfo { get; set; } - public ICollection LanguageInfos { get; set; } = new List(); + public ICollection LanguageInfos { get; set; } = new List(); } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfoDbEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfo.cs similarity index 84% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfoDbEntity.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfo.cs index aad4b551..606549f3 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfoDbEntity.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfo.cs @@ -1,6 +1,6 @@ namespace O2NextGen.CertificateManagement.Domain.Entities { - public class LanguageInfoDbEntity + public class LanguageInfo { public long Id { get; set; } public long ModifiedDate { get; set; } @@ -10,7 +10,7 @@ public class LanguageInfoDbEntity public long CertificateId { get; set; } public int LanguageId { get; set; } - public CertificateDbEntity Certificate { get; set; } + public Certificate Certificate { get; set; } public string Lastname { get; set; } public string Firstname { get; set; } public string Middlename { get; set; } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj index 622ee326..4aaabf2d 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj @@ -11,49 +11,25 @@ - - - - - - - - - - + - - - - - - - - - - - - - - - + + + + + - - + - - - - diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.v3.ncrunchproject new file mode 100644 index 00000000..44cdd50f --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + True + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommand.cs deleted file mode 100644 index a2d431e0..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommand.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; -using MediatR; - -namespace O2NextGen.CertificateManagement.Domain.UseCases.Category.CreateCategory -{ - public class CreateCategoryCommand: IRequest - { - } -} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommandResult.cs deleted file mode 100644 index b1430118..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommandResult.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace O2NextGen.CertificateManagement.Domain.UseCases.Category.CreateCategory -{ - public class CreateCategoryCommandResult - { - } -} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryHandler.cs deleted file mode 100644 index 5fc73ca9..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryHandler.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using MediatR; - -namespace O2NextGen.CertificateManagement.Domain.UseCases.Category.CreateCategory -{ - public class CreateCategoryHandler : IRequestHandler - { - public Task Handle(CreateCategoryCommand request, CancellationToken cancellationToken) - { - // grab user by id - - // setup category info - - // persist category - - // return persisted category info - - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQuery.cs deleted file mode 100644 index d57c8da9..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQuery.cs +++ /dev/null @@ -1,18 +0,0 @@ -using MediatR; - -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate -{ - - public class GetCertificateQuery : IRequest - { - private long id; - - public GetCertificateQuery(long id) - { - this.Id = id; - } - - public long Id { get => id; set => id = value; } - } -} - diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQuery.cs deleted file mode 100644 index d81918b2..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQuery.cs +++ /dev/null @@ -1,10 +0,0 @@ -using MediatR; - -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate -{ - public class GetCertificatesQuery:IRequest - { - - } -} - diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs deleted file mode 100644 index 61962b86..00000000 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using MediatR; -using O2NextGen.CertificateManagement.Domain.Data; -using O2NextGen.CertificateManagement.Domain.Data.Queries; -using O2NextGen.CertificateManagement.Domain.Entities; -using O2NextGen.CertificateManagement.Domain.Mappings; -using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; -using static O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate.GetCertificatesQueryResult; - -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificates -{ - public class GetCertificatesQueryHandler - : IRequestHandler - { - private readonly IQueryHandler> queryHandler; - - public GetCertificatesQueryHandler( - IQueryHandler> queryHandler) - { - this.queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler)); - } - - public async Task Handle(GetCertificatesQuery request, CancellationToken cancellationToken) - { - var certificates = await queryHandler.HandleAsync( - new CertificatesQuery(), - cancellationToken); - - return new GetCertificatesQueryResult( - certificates.MapAsReadOnly(certificate => - new GetCertificatesQueryResult.Certificate( - certificate.Id, - certificate.ExternalId, - certificate.ModifiedDate, - certificate.AddedDate, - certificate.DeletedDate, - certificate.IsDeleted, - certificate.OwnerAccountId, - certificate.CustomerId, - certificate.ExpiredDate, - certificate.PublishDate, - certificate.CreatorId, - certificate.PublishCode, - certificate.IsVisible, - certificate.CategoryId, - certificate.Category, - certificate.Lock, - certificate.LockedDate, - certificate.LockInfo, - certificate.LanguageInfos))); - } - } -} - diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs new file mode 100644 index 00000000..21d410ce --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs @@ -0,0 +1,20 @@ +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory +{ + public class CreateCategoryCommand : IRequest + { + public long Id { get; internal set; } + public string CategoryName { get; internal set; } + public string CategoryDescription { get; internal set; } + public string CategorySeries { get; internal set; } + public string CustomerId { get; internal set; } + public long AddedDate { get; internal set; } + public long ModifiedDate { get; internal set; } + public long? DeletedDate { get; internal set; } + public bool? IsDeleted { get; internal set; } + public int TimeLifeInDays { get; internal set; } + public int QuantityCertificates { get; internal set; } + public int QuantityPublishCode { get; internal set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandHandler.cs new file mode 100644 index 00000000..1c5cb983 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandHandler.cs @@ -0,0 +1,54 @@ +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory +{ + public class CreateCategoryCommandHandler : IRequestHandler + { + private readonly IRepository categoryRepository; + + public CreateCategoryCommandHandler(IRepository categoryRepository) + { + this.categoryRepository = categoryRepository; + } + + public async Task Handle(CreateCategoryCommand request, CancellationToken cancellationToken) + { + var category = new Entities.Category + { + Id = request.Id, + CategoryName = request.CategoryName, + CategoryDescription = request.CategoryDescription, + CategorySeries = request.CategorySeries, + CustomerId = request.CustomerId, + AddedDate = request.AddedDate, + ModifiedDate = request.ModifiedDate, + DeletedDate = request.DeletedDate, + IsDeleted = request.IsDeleted, + TimeLifeInDays = request.TimeLifeInDays, + QuantityCertificates = request.QuantityCertificates, + QuantityPublishCode = request.QuantityPublishCode + }; + + var addedCertificate = await categoryRepository.AddAsync(category, cancellationToken); + + return new CreateCategoryCommandResult( + addedCertificate.Id, + addedCertificate.CategoryName, + addedCertificate.CategoryDescription, + addedCertificate.CategorySeries, + addedCertificate.CustomerId, + addedCertificate.AddedDate, + addedCertificate.ModifiedDate, + addedCertificate.DeletedDate, + addedCertificate.IsDeleted, + addedCertificate.TimeLifeInDays, + addedCertificate.QuantityCertificates, + addedCertificate.QuantityPublishCode + ); + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs new file mode 100644 index 00000000..21213149 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs @@ -0,0 +1,34 @@ +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory +{ + public class CreateCategoryCommandResult + { + public CreateCategoryCommandResult(long id, string categoryName, string categoryDescription, string categorySeries, string customerId, long addedDate, long modifiedDate, long? deletedDate, bool? isDeleted, int timeLifeInDays, int quantityCertificates, int quantityPublishCode) + { + Id = id; + CategoryName = categoryName; + CategoryDescription = categoryDescription; + CategorySeries = categorySeries; + CustomerId = customerId; + AddedDate = addedDate; + ModifiedDate = modifiedDate; + DeletedDate = deletedDate; + IsDeleted = isDeleted; + TimeLifeInDays = timeLifeInDays; + QuantityCertificates = quantityCertificates; + QuantityPublishCode = quantityPublishCode; + } + + public long Id { get; } + public string CategoryName { get; } + public string CategoryDescription { get; } + public string CategorySeries { get; } + public string CustomerId { get; } + public long AddedDate { get; } + public long ModifiedDate { get; } + public long? DeletedDate { get; } + public bool? IsDeleted { get; } + public int TimeLifeInDays { get; } + public int QuantityCertificates { get; } + public int QuantityPublishCode { get; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs new file mode 100644 index 00000000..39167af3 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs @@ -0,0 +1,11 @@ + +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.DeleteCategory +{ + public class DeleteCategoryCommand : IRequest + { + + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs new file mode 100644 index 00000000..5056ad66 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs @@ -0,0 +1,7 @@ +using MediatR; +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories +{ + public class GetCategoriesQuery : IRequest + { + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs new file mode 100644 index 00000000..463f4c60 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Domain.Mappings; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories +{ + + public class GetCategoriesQueryHandler + : IRequestHandler + { + private readonly IQueryHandler> queryHandler; + + public GetCategoriesQueryHandler(IQueryHandler> queryHandler) + { + this.queryHandler = queryHandler; + } + + public async Task Handle(GetCategoriesQuery request, + CancellationToken cancellationToken) + { + var certificates = await queryHandler.HandleAsync( + new CategoriesQuery(), + cancellationToken); + + return new GetCategoriesQueryResult( + certificates.MapAsReadOnly(certificate => + new GetCategoriesQueryResult.CategoryViewModel())); + + + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs new file mode 100644 index 00000000..6900f0b6 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories +{ + + public class GetCategoriesQueryResult + { + public GetCategoriesQueryResult(IReadOnlyCollection categories) + { + Categories = categories; + } + + public IReadOnlyCollection Categories { get; } + + public class CategoryViewModel + { + public CategoryViewModel() + { + } + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs new file mode 100644 index 00000000..f07bec38 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs @@ -0,0 +1,15 @@ +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory +{ + + public sealed class GetCategoryQuery : IRequest + { + public GetCategoryQuery(long id) + { + Id = id; + } + + public long Id { get; } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs new file mode 100644 index 00000000..f973b036 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs @@ -0,0 +1,42 @@ +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory +{ + + public class GetCategoryQueryHandler : + IRequestHandler + { + private readonly IQueryHandler _queryHandler; + + public GetCategoryQueryHandler(IQueryHandler _queryHandler) + { + this._queryHandler = _queryHandler; + } + + public async Task Handle(GetCategoryQuery request, CancellationToken cancellationToken) + { + var certificate = await _queryHandler.HandleAsync( + new CategoryQuery(request.Id), + cancellationToken); + + if (certificate is null) + { + return null; + } + + return new GetCategoryQueryResult( + certificate.Id, + certificate.ModifiedDate, + certificate.AddedDate, + certificate.DeletedDate, + certificate.IsDeleted, + certificate.CustomerId); + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs new file mode 100644 index 00000000..67862f46 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs @@ -0,0 +1,24 @@ +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory +{ + + public class GetCategoryQueryResult + { + public GetCategoryQueryResult(long id, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted, + string customerId) + { + Id = id; + ModifiedDate = modifiedDate; + AddedDate = addedDate; + DeletedDate = deletedDate; + IsDeleted = isDeleted; + CustomerId = customerId; + } + + public long Id { get; } + public long ModifiedDate { get; } + public long AddedDate { get; } + public long? DeletedDate { get; } + public bool? IsDeleted { get; } + public string CustomerId { get; } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommand.cs similarity index 79% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommand.cs index 5f68b261..0c60e067 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommand.cs @@ -1,7 +1,8 @@ -using MediatR; +using System.Collections.Generic; +using MediatR; using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate { public class CreateCertificateCommand : IRequest { @@ -17,17 +18,17 @@ public class CreateCertificateCommand : IRequest public bool IsVisible { get; set; } public long CategoryId { get; set; } - public CategoryDbEntity Category { get; set; } + public Category Category { get; set; } public bool Lock { get; set; } public long LockedDate { get; set; } public string LockInfo { get; set; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } public CreateCertificateCommand( string externalId, bool? IsDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, - long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, - ICollection languageInfos) + long categoryId, Category category, bool @lock, long lockedDate, string lockInfo, + ICollection languageInfos) { ExternalId = externalId; this.IsDeleted = IsDeleted; diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandHandler.cs similarity index 79% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandHandler.cs index 18c14946..6dca818d 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandHandler.cs @@ -1,26 +1,23 @@ -using System; -using System.Text.RegularExpressions; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using MediatR; using O2NextGen.CertificateManagement.Domain.Data; -using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate { public class CreateCertificateCommandHandler : IRequestHandler { - private readonly IRepository certificatesRepository; + private readonly IRepository certificatesRepository; - public CreateCertificateCommandHandler(IRepository groupsRepository) + public CreateCertificateCommandHandler(IRepository certificatesRepository) { - this.certificatesRepository = groupsRepository; + this.certificatesRepository = certificatesRepository; } public async Task Handle( CreateCertificateCommand request, CancellationToken cancellationToken) { - var certificate = new CertificateDbEntity + var certificate = new Entities.Certificate { ExternalId = request.ExternalId, IsDeleted = request.IsDeleted, diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandResult.cs similarity index 82% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandResult.cs index 0ee81074..362d75b6 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandResult.cs @@ -1,17 +1,15 @@ -using System; +using System.Collections.Generic; using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate { public class CreateCertificateCommandResult { - - public CreateCertificateCommandResult( string externalId, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, - bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, - long lockedDate, string lockInfo, ICollection languageInfos) + bool isVisible, long categoryId, Category category, bool @lock, + long lockedDate, string lockInfo, ICollection languageInfos) { ExternalId = externalId; IsDeleted = isDeleted; @@ -44,11 +42,11 @@ public CreateCertificateCommandResult( public string PublishCode { get; } public bool IsVisible { get; } public long CategoryId { get; } - public CategoryDbEntity Category { get; } + public Category Category { get; } public bool Lock { get; } public long LockedDate { get; } public string LockInfo { get; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommand.cs similarity index 56% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommand.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommand.cs index b1fb888e..82950f37 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommand.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommand.cs @@ -1,9 +1,8 @@ -using System; -using System.Text.RegularExpressions; -using MediatR; +using MediatR; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate { + public sealed class DeleteCertificateCommand : IRequest { public DeleteCertificateCommand(long id) @@ -13,5 +12,5 @@ public DeleteCertificateCommand(long id) public long Id { get; set; } } -} +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommandHandler.cs similarity index 55% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommandHandler.cs index 3dc90e56..ccf7172e 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommandHandler.cs @@ -1,22 +1,27 @@ -using MediatR; +using System; +using System.Threading; +using System.Threading.Tasks; +using MediatR; using O2NextGen.CertificateManagement.Domain.Data; using O2NextGen.CertificateManagement.Domain.Data.Queries; -using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate { + public class DeleteCertificateCommandHandler : IRequestHandler { - private readonly IQueryHandler _userGroupQueryHandler; - private readonly IRepository groupsRepository; + private readonly IQueryHandler _userGroupQueryHandler; + private readonly IRepository groupsRepository; public DeleteCertificateCommandHandler( - IQueryHandler userGroupQueryHandler, - IRepository groupsRepository) + IQueryHandler userGroupQueryHandler, + IRepository groupsRepository) { - _userGroupQueryHandler = userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler)); + _userGroupQueryHandler = + userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler)); this.groupsRepository = groupsRepository; } + public async Task Handle(DeleteCertificateCommand request, CancellationToken cancellationToken) { var certificate = await _userGroupQueryHandler.HandleAsync( diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs new file mode 100644 index 00000000..c4331acc --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs @@ -0,0 +1,18 @@ +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate +{ + + public sealed class GetCertificateQuery : IRequest + { + private long id; + + public GetCertificateQuery(long id) + { + Id = id; + } + + public long Id { get => id; set => id = value; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryHandler.cs similarity index 76% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryHandler.cs index d8372516..b30ed881 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryHandler.cs @@ -1,5 +1,4 @@ using System; -using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using MediatR; @@ -7,20 +6,21 @@ using O2NextGen.CertificateManagement.Domain.Data.Queries; using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate { + public class GetCertificateQueryHandler : IRequestHandler { - private readonly IQueryHandler _queryHandler; + private readonly IQueryHandler _queryHandler; - public GetCertificateQueryHandler(IQueryHandler queryHandler) + public GetCertificateQueryHandler(IQueryHandler queryHandler) { _queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler)); - } - public async Task Handle(GetCertificateQuery request, CancellationToken cancellationToken) + public async Task Handle(GetCertificateQuery request, + CancellationToken cancellationToken) { var certificate = await _queryHandler.HandleAsync( new CertificateQuery(request.Id), @@ -51,14 +51,6 @@ public async Task Handle(GetCertificateQuery request, certificate.LockedDate, certificate.LockInfo, certificate.LanguageInfos); - - //var result = await certificatesService.GetByIdAsync(request.Id, cancellationToken); - - //if (result == null) - // throw new Exception("Object not found"); - - //return new GetCertificateCommandResult(result.Id, result.Name); } } } - diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryResult.cs similarity index 78% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryResult.cs index 369f0d3d..d029a369 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryResult.cs @@ -1,15 +1,15 @@ -using O2NextGen.CertificateManagement.Domain.Entities; +using System.Collections.Generic; +using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate { - public class GetCertificateQueryResult + public sealed class GetCertificateQueryResult { - public GetCertificateQueryResult(long id, string externalId, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, - CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, - ICollection languageInfos) + Category category, bool @lock, long lockedDate, string lockInfo, + ICollection languageInfos) { Id = id; ExternalId = externalId; @@ -46,10 +46,10 @@ public GetCertificateQueryResult(long id, string externalId, long modifiedDate, public string PublishCode { get; } public bool IsVisible { get; } public long CategoryId { get; } - public CategoryDbEntity Category { get; } + public Category Category { get; } public bool Lock { get; } public long LockedDate { get; } public string LockInfo { get; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs new file mode 100644 index 00000000..267a8999 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs @@ -0,0 +1,9 @@ +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates +{ + public class GetCertificatesQuery : IRequest + { + + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs new file mode 100644 index 00000000..bc19e735 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Domain.Mappings; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates +{ + public class GetCertificatesQueryHandler + : IRequestHandler + { + private readonly IQueryHandler> queryHandler; + + public GetCertificatesQueryHandler( + IQueryHandler> queryHandler) + { + this.queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler)); + } + + public async Task Handle(GetCertificatesQuery request, CancellationToken cancellationToken) + { + var certificates = await queryHandler.HandleAsync( + new CertificatesQuery(), + cancellationToken); + + return new GetCertificatesQueryResult( + certificates.MapAsReadOnly(certificate => + new GetCertificatesQueryResult.CertificateViewModel( + certificate.Id, + certificate.ExternalId, + certificate.ModifiedDate, + certificate.AddedDate, + certificate.DeletedDate, + certificate.IsDeleted, + certificate.OwnerAccountId, + certificate.CustomerId, + certificate.ExpiredDate, + certificate.PublishDate, + certificate.CreatorId, + certificate.PublishCode, + certificate.IsVisible, + certificate.CategoryId, + certificate.Category, + certificate.Lock, + certificate.LockedDate, + certificate.LockInfo, + certificate.LanguageInfos))); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryResult.cs similarity index 66% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryResult.cs index 93f91cbc..b284af84 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryResult.cs @@ -1,26 +1,32 @@ -using System.Text.RegularExpressions; +using System.Collections.Generic; using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates { + public class GetCertificatesQueryResult { - public GetCertificatesQueryResult(IReadOnlyCollection certificates) + public GetCertificatesQueryResult(IReadOnlyCollection certificates) { Certificates = certificates; } - public IReadOnlyCollection Certificates { get; } + public IReadOnlyCollection Certificates { get; } - public class Certificate + public class CertificateViewModel { - public Certificate( - long id, string name, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) + public CertificateViewModel( + long id, string externalId, + long modifiedDate, long addedDate, long? deletedDate, + bool? isDeleted, string ownerAccountId, string customerId, + long expiredDate, long publishDate, string creatorId, string publishCode, + bool isVisible, long categoryId, Category category, bool @lock, + long lockedDate, string lockInfo, ICollection languageInfos) { Id = id; - Name = name; + ModifiedDate = modifiedDate; AddedDate = addedDate; DeletedDate = deletedDate; @@ -41,7 +47,6 @@ public Certificate( } public long Id { get; set; } - public string Name { get; set; } public long ModifiedDate { get; } public long AddedDate { get; } public long? DeletedDate { get; } @@ -54,11 +59,11 @@ public Certificate( public string PublishCode { get; } public bool IsVisible { get; } public long CategoryId { get; } - public CategoryDbEntity Category { get; } + public Category Category { get; } public bool Lock { get; } public long LockedDate { get; } public string LockInfo { get; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } } } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs similarity index 76% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs index 269bb763..c1a0f016 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs @@ -1,17 +1,17 @@ -using System; +using System.Collections.Generic; using MediatR; using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.UpdateCertificate { - public class UpdateCertificateDetailsCommand: IRequest + public class UpdateCertificateDetailsCommand : IRequest { public UpdateCertificateDetailsCommand( long id, string externalId, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, - long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, - ICollection languageInfos) + long categoryId, Category category, bool @lock, long lockedDate, string lockInfo, + ICollection languageInfos) { Id = id; ExternalId = externalId; @@ -31,7 +31,7 @@ public UpdateCertificateDetailsCommand( LanguageInfos = languageInfos; } - public UpdateCertificateDetailsCommand(long id, string externalId, bool? modifiedDate, string addedDate, string deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) + public UpdateCertificateDetailsCommand(long id, string externalId, bool? modifiedDate, string addedDate, string deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, Category category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) { Id = id; ExternalId = externalId; @@ -65,16 +65,16 @@ public UpdateCertificateDetailsCommand(long id, string externalId, bool? modifie public string PublishCode { get; } public bool IsVisible { get; } public long CategoryId { get; } - public CategoryDbEntity Category { get; } + public Category Category { get; } public bool Lock { get; } public long LockedDate { get; } public string LockInfo { get; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } public bool? ModifiedDate { get; } public string AddedDate { get; } public string DeletedDate { get; } - public CategoryDbEntity Category1 { get; } - public ICollection LanguageInfos1 { get; } + public Category Category1 { get; } + public ICollection LanguageInfos1 { get; } } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs similarity index 86% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs index 18157ae4..7f3ae141 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs @@ -1,20 +1,21 @@ -using System.Text.RegularExpressions; +using System; +using System.Threading; +using System.Threading.Tasks; using MediatR; using O2NextGen.CertificateManagement.Domain.Data; using O2NextGen.CertificateManagement.Domain.Data.Queries; -using O2NextGen.CertificateManagement.Domain.Entities; -namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate +namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.UpdateCertificate { public class UpdateCertificateDetailsCommandHandler : IRequestHandler { - private readonly IQueryHandler _userGroupQueryHandler; - private readonly IRepository _groupsRepository; + private readonly IQueryHandler _userGroupQueryHandler; + private readonly IRepository _groupsRepository; public UpdateCertificateDetailsCommandHandler( - IQueryHandler userGroupQueryHandler, - IRepository groupsRepository) + IQueryHandler userGroupQueryHandler, + IRepository groupsRepository) { _userGroupQueryHandler = userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler)); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs similarity index 85% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs index aab322bf..b3672e75 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs @@ -1,4 +1,4 @@ - +using System.Collections.Generic; using O2NextGen.CertificateManagement.Domain.Entities; public class UpdateCertificateDetailsCommandResult @@ -9,7 +9,7 @@ public UpdateCertificateDetailsCommandResult(long id, string name) Name = name; } - public UpdateCertificateDetailsCommandResult(long id, string name, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, CategoryDbEntity category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) : this(id, name) + public UpdateCertificateDetailsCommandResult(long id, string name, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId, Category category, bool @lock, long lockedDate, string lockInfo, ICollection languageInfos) : this(id, name) { ModifiedDate = modifiedDate; AddedDate = addedDate; @@ -44,11 +44,11 @@ public UpdateCertificateDetailsCommandResult(long id, string name, long modified public string PublishCode { get; } public bool IsVisible { get; } public long CategoryId { get; } - public CategoryDbEntity Category { get; } + public Category Category { get; } public bool Lock { get; } public long LockedDate { get; } public string LockInfo { get; } - public ICollection LanguageInfos { get; } + public ICollection LanguageInfos { get; } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CategoryMappings.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CategoryMappings.cs index ffeb6087..74b08176 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CategoryMappings.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CategoryMappings.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; -using O2NextGen.CertificateManagement.Business.Models; +using O2NextGen.CertificateManagement.Business.Models; using O2NextGen.CertificateManagement.Data.Entities; +using System.Collections.Generic; namespace O2NextGen.CertificateManagement.Impl.Mappings { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CertificateMappings.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CertificateMappings.cs index 4d32e5a1..9fed54b7 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CertificateMappings.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CertificateMappings.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; using O2NextGen.CertificateManagement.Business.Models; using O2NextGen.CertificateManagement.Data.Entities; +using System.Collections.Generic; namespace O2NextGen.CertificateManagement.Impl.Mappings { @@ -8,12 +8,12 @@ internal static class CertificateMappings { public static Certificate ToService(this CertificateEntity entity) { - return entity != null ? new Certificate() {Id = entity.Id, Name = entity.Name} : null; + return entity != null ? new Certificate() { Id = entity.Id, Name = entity.Name } : null; } public static CertificateEntity ToEntity(this Certificate model) { - return model != null ? new CertificateEntity() {Id = model.Id, Name = model.Name} : null; + return model != null ? new CertificateEntity() { Id = model.Id, Name = model.Name } : null; } public static IReadOnlyCollection diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/CertificatesService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/CertificatesService.cs index 7b8ff99a..0c21552b 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/CertificatesService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/CertificatesService.cs @@ -1,12 +1,12 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using O2NextGen.CertificateManagement.Business.Models; using O2NextGen.CertificateManagement.Business.Services; using O2NextGen.CertificateManagement.Data; using O2NextGen.CertificateManagement.Impl.Mappings; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace O2NextGen.CertificateManagement.Impl.Services { @@ -30,7 +30,7 @@ public CertificatesService(CertificateManagementDbContext context) public async Task> GetAllAsync(CancellationToken ct) { - var certificates = await _context.Certificates.AsNoTracking().OrderBy(_=>_.Id).ToListAsync(); + var certificates = await _context.Certificates.AsNoTracking().OrderBy(_ => _.Id).ToListAsync(); return certificates.ToService(); } @@ -45,8 +45,8 @@ public async Task UpdateAsync(Certificate certificate, Cancellation var updatedCertificateEntity = _context.Certificates.Update(certificate.ToEntity()); await _context.SaveChangesAsync(ct); return updatedCertificateEntity.Entity.ToService(); - } - + } + public async Task AddAsync(Certificate certificate, CancellationToken ct) { var addedCertificateEntity = await _context.Certificates.AddAsync(certificate.ToEntity(), ct); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCategoriesService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCategoriesService.cs index 7747e9a5..386ab833 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCategoriesService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCategoriesService.cs @@ -1,9 +1,9 @@ -using System.Collections.Generic; +using O2NextGen.CertificateManagement.Business.Models; +using O2NextGen.CertificateManagement.Business.Services; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using O2NextGen.CertificateManagement.Business.Models; -using O2NextGen.CertificateManagement.Business.Services; namespace O2NextGen.CertificateManagement.Impl.Services { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCertificatesService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCertificatesService.cs index 4e3df4b5..fb7cb21b 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCertificatesService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCertificatesService.cs @@ -1,9 +1,9 @@ -using System.Collections.Generic; +using O2NextGen.CertificateManagement.Business.Models; +using O2NextGen.CertificateManagement.Business.Services; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using O2NextGen.CertificateManagement.Business.Models; -using O2NextGen.CertificateManagement.Business.Services; namespace O2NextGen.CertificateManagement.Impl.Services { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CGenDbContext.cs similarity index 78% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CGenDbContext.cs index 5a1100d3..1ff461c5 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CGenDbContext.cs @@ -1,21 +1,20 @@ using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; using O2NextGen.CertificateManagement.Domain.Entities; namespace O2NextGen.CertificateManagement.Infrastructure.Data { - public class CertificateManagementDbContext : DbContext + public class CGenDbContext : DbContext { #region Fields - public DbSet Certificates { get; set; } - + public DbSet Certificates { get; set; } + public DbSet Categories { get; set; } #endregion #region Ctors - public CertificateManagementDbContext(DbContextOptions options) + public CGenDbContext(DbContextOptions options) : base(options) { } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs index 4eecd53e..5880296c 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CategoryDbEntityConfiguration.cs @@ -5,9 +5,9 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Data.Configurations { - public class CategoryDbEntityConfiguration : IEntityTypeConfiguration + public class CategoryDbEntityConfiguration : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { builder.ToTable("Category"); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateDbEntityConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateDbEntityConfiguration.cs index 2dc8f8ec..1fef5dec 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateDbEntityConfiguration.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateDbEntityConfiguration.cs @@ -5,9 +5,9 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Data.Configurations { - public class CertificateDbEntityConfiguration : IEntityTypeConfiguration + public class CertificateDbEntityConfiguration : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { builder.ToTable("Certificate"); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs index 72440063..62e2c245 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/LanguageInfoDbEntityConfiguration.cs @@ -4,9 +4,9 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Data.Configurations { - public class LanguageInfoDbEntityConfiguration : IEntityTypeConfiguration + public class LanguageInfoDbEntityConfiguration : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { builder.ToTable("LanguageInfos") .HasOne(e => e.Certificate) diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/EfRepository.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/EfRepository.cs index 878dc7ea..499a4ba7 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/EfRepository.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/EfRepository.cs @@ -1,8 +1,6 @@ -using System; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; -using O2NextGen.CertificateManagement.Data; using O2NextGen.CertificateManagement.Domain.Data; namespace O2NextGen.CertificateManagement.Infrastructure.Data @@ -10,9 +8,9 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Data public class EfRepository : IRepository where T : class { - private readonly CertificateManagementDbContext _dbContext; + private readonly CGenDbContext _dbContext; - public EfRepository(CertificateManagementDbContext dbContext) + public EfRepository(CGenDbContext dbContext) { _dbContext = dbContext; } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs index 1a1c36eb..61e13644 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.Designer.cs @@ -11,7 +11,7 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations { - [DbContext(typeof(CertificateManagementDbContext))] + [DbContext(typeof(CGenDbContext))] [Migration("20221225101744_InitDatabase")] partial class InitDatabase { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs index a7a4c0bc..b9c826db 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20221225101744_InitDatabase.cs @@ -1,7 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable +#nullable disable +using Microsoft.EntityFrameworkCore.Migrations; + namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations { public partial class InitDatabase : Migration diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagementDbContextModelSnapshot.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CGenDbContextModelSnapshot.cs similarity index 95% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagementDbContextModelSnapshot.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CGenDbContextModelSnapshot.cs index 00eacb29..5d7ca843 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagementDbContextModelSnapshot.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CGenDbContextModelSnapshot.cs @@ -1,17 +1,13 @@ // -using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using O2NextGen.CertificateManagement.Infrastructure.Data; #nullable disable namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations { - [DbContext(typeof(CertificateManagementDbContext))] - partial class CertificateManagementDbContextModelSnapshot : ModelSnapshot + [DbContext(typeof(CGenDbContext))] + partial class CGenDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj index d9adbbdc..4f43ce1d 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj @@ -5,18 +5,20 @@ enable disable - - - - - + + + + + + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject new file mode 100644 index 00000000..44cdd50f --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + True + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoriesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoriesQueryHandler.cs new file mode 100644 index 00000000..5b2c2ef5 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoriesQueryHandler.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Infrastructure.Data; + +namespace O2NextGen.CertificateManagement.Infrastructure.Queries +{ + public class CategoriesQueryHandler : IQueryHandler> + { + private readonly CGenDbContext context; + + public CategoriesQueryHandler(CGenDbContext context) + { + this.context = context; + } + public async Task> HandleAsync(CategoriesQuery query, CancellationToken ct) + => (await context + .Categories + .ToListAsync(ct)) + .AsReadOnly(); + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoryQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoryQueryHandler.cs new file mode 100644 index 00000000..4bfa8ee7 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CategoryQueryHandler.cs @@ -0,0 +1,26 @@ +using System.Threading; +using System.Threading.Tasks; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Infrastructure.Data; + +namespace O2NextGen.CertificateManagement.Infrastructure.Queries +{ + public class CategoryQueryHandler : IQueryHandler + { + private readonly CGenDbContext context; + + public CategoryQueryHandler(CGenDbContext context) + { + this.context = context; + } + public async Task HandleAsync(CategoryQuery query, CancellationToken ct) + { + var result = await context.Set().FindAsync(new object[] { query.Id }, ct); + return result; + } + + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs index f3d7e336..31e2804c 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs @@ -1,27 +1,26 @@ -using System; +using System.Threading; +using System.Threading.Tasks; using O2NextGen.CertificateManagement.Domain.Data; -using System.Text.RegularExpressions; using O2NextGen.CertificateManagement.Domain.Data.Queries; using O2NextGen.CertificateManagement.Domain.Entities; using O2NextGen.CertificateManagement.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; namespace O2NextGen.CertificateManagement.Infrastructure.Queries { - public class CertificateQueryHandler : IQueryHandler + public class CertificateQueryHandler : IQueryHandler { - private readonly CertificateManagementDbContext context; + private readonly CGenDbContext context; - public CertificateQueryHandler(CertificateManagementDbContext context) + public CertificateQueryHandler(CGenDbContext context) { this.context = context; } - public async Task HandleAsync(CertificateQuery query, CancellationToken ct) + public async Task HandleAsync(CertificateQuery query, CancellationToken ct) { - var result = await context.Set().FindAsync(new object[] { query.Id }, ct); + var result = await context.Set().FindAsync(new object[] { query.Id }, ct); return result; } - + } } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs index 066e39a0..1c9c8a1e 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; using O2NextGen.CertificateManagement.Domain.Data; using O2NextGen.CertificateManagement.Domain.Data.Queries; using O2NextGen.CertificateManagement.Domain.Entities; @@ -6,15 +9,15 @@ namespace O2NextGen.CertificateManagement.Infrastructure.Queries { - public class CertificatesQueryHandler : IQueryHandler> + public class CertificatesQueryHandler : IQueryHandler> { - private readonly CertificateManagementDbContext context; + private readonly CGenDbContext context; - public CertificatesQueryHandler(CertificateManagementDbContext context) + public CertificatesQueryHandler(CGenDbContext context) { this.context = context; } - public async Task> HandleAsync(CertificatesQuery query, CancellationToken ct) + public async Task> HandleAsync(CertificatesQuery query, CancellationToken ct) => (await context .Certificates .ToListAsync(ct)) diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerHostedService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerHostedService.cs index 2b4251fb..7219b28e 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerHostedService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerHostedService.cs @@ -10,6 +10,7 @@ public class DatabaseInitializerHostedService : IHostedService where TDbContext : DbContext { private readonly IServiceScopeFactory _scopeFactory; + private readonly DatabaseInitializerSettings _settings; public DatabaseInitializerHostedService(IServiceScopeFactory scopeFactory, DatabaseInitializerSettings settings) diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.v3.ncrunchproject new file mode 100644 index 00000000..44cdd50f --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + True + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryServiceTests.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryServiceTests.cs index 07327f4a..a54b8d0a 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryServiceTests.cs +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryServiceTests.cs @@ -1,5 +1,4 @@ -using System; -namespace IntegrationTests.O2NextGen.CertificateManagement.Api +namespace IntegrationTests.O2NextGen.CertificateManagement.Api { public class CategoryServiceTests : CategoryScenarioBase { diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs index 3fb1291d..a48e257d 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs @@ -1,10 +1,9 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; -using O2NextGen.CertificateManagement.Api; namespace IntegrationTests.O2NextGen.CertificateManagement.Api { - public class TestsStartup : Startup + public class TestsStartup //: Startup { public TestsStartup(IConfiguration config, IWebHostEnvironment env) : base(config,env) diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateControllerTests.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateControllerTests.cs index 061bfc1f..4496bff2 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateControllerTests.cs +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateControllerTests.cs @@ -1,12 +1,31 @@ -namespace IntegrationTests.O2NextGen.CertificateManagement.Application -{ - public class CertificateControllerTests - { - [Fact] - public void CertificateController_GetByIdAsync_Test() - { - - } - - } +using System; + +namespace IntegrationTests.O2NextGen.CertificateManagement.Application +{ + public class CertificateControllerTests + { + [Fact] + public void CertificateController_GetByIdAsync_Test() + { + throw new NotImplementedException(); + } + + [Fact] + public void CertificateController_GetAllAsync_Test() + { + throw new NotImplementedException(); + } + + [Fact] + public void CertificateController_UpdateAsync_Test() + { + throw new NotImplementedException(); + } + + [Fact] + public void CertificateController_AddAsync_Test() + { + throw new NotImplementedException(); + } + } } \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj index 1b839551..667c8936 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj @@ -8,6 +8,10 @@ false + + + + @@ -23,6 +27,7 @@ + diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/TestsStartup.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/TestsStartup.cs index 398ebeb9..b41608fb 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/TestsStartup.cs +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/TestsStartup.cs @@ -1,13 +1,14 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; +using O2NextGen.CertificateManagement.Api; namespace IntegrationTests.O2NextGen.CertificateManagement.Application { - public class TestsStartup : Startup + public class TestsStartup //: Startup { - public TestsStartup(IConfiguration config, IWebHostEnvironment env) - : base(config, env) - { - } + // public TestsStartup(IConfiguration config, IWebHostEnvironment env) + // : base(config, env) + //{ + //} } } \ No newline at end of file diff --git a/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Api/Tests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Api/Tests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Api/Tests.O2NextGen.CertificateManagement.Api.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Impl/Tests.O2NextGen.CertificateManagement.Impl.v3.ncrunchproject b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Impl/Tests.O2NextGen.CertificateManagement.Impl.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Impl/Tests.O2NextGen.CertificateManagement.Impl.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Data/Queries/QueryHandlerTests.cs b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Data/Queries/QueryHandlerTests.cs new file mode 100644 index 00000000..37497c6b --- /dev/null +++ b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Data/Queries/QueryHandlerTests.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Infrastructure.Data; + +namespace Tests.O2NextGen.CertificateManagement.Infrastructure.Data.Queries +{ + public class QueryHandlerTests + { + private static readonly Type QueryType = typeof(IQuery<>); + private static readonly Type QueryHandlerType = typeof(IQueryHandler<,>); + + [Fact] + public void AllDomainQueriesHaveMatchingInfrastructureHandlerTest() + { + var existingQueries = GetAllQueries(); + var existingQueryHandlers = GetAllQueryHandlers(); + + Assert.All( + existingQueries, + query => existingQueryHandlers.Single(handler => handler.GenericTypeArguments[0] == query)); + } + + private static IEnumerable GetAllQueries() + { + return QueryType.Assembly + .GetTypes() + .Where(t => t.IsClass && t.GetInterfaces().SingleOrDefault(IsQueryInterface) != null); + + static bool IsQueryInterface(Type @interface) + => @interface.IsGenericType && @interface.GetGenericTypeDefinition() == QueryType; + } + + private static IEnumerable GetAllQueryHandlers() + { + var infrastructureAssembly = typeof(CGenDbContext).Assembly; + + return infrastructureAssembly + .GetTypes() + .Where(t => t.IsClass && t.GetInterfaces().SingleOrDefault(IsQueryHandlerInterface) != null) + .Select(t => t.GetInterfaces().Single(IsQueryHandlerInterface)); + + static bool IsQueryHandlerInterface(Type @interface) + => @interface.IsGenericType && @interface.GetGenericTypeDefinition() == QueryHandlerType; + } + } +} diff --git a/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.csproj b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.csproj new file mode 100644 index 00000000..14244ff1 --- /dev/null +++ b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.csproj @@ -0,0 +1,29 @@ + + + + net6.0 + enable + enable + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + diff --git a/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject new file mode 100644 index 00000000..5d07ca51 --- /dev/null +++ b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Tests.O2NextGen.CertificateManagement.Infrastructure.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Usings.cs b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Usings.cs new file mode 100644 index 00000000..8c927eb7 --- /dev/null +++ b/src/Services/c-gen/Tests/Tests.O2NextGen.CertificateManagement.Infrastructure/Usings.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/src/Services/c-gen/global.json b/src/Services/c-gen/global.json new file mode 100644 index 00000000..f443bd42 --- /dev/null +++ b/src/Services/c-gen/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "6.0", + "rollForward": "latestMajor", + "allowPrerelease": true + } +} \ No newline at end of file From af852bd58994e0ffa5230acab3fee89634a991c1 Mon Sep 17 00:00:00 2001 From: Denis Prokharchyk Date: Sat, 7 Jan 2023 22:20:11 +0300 Subject: [PATCH 5/5] feat(issue-504): add O2NextGen.Sdk.NetCore.Extensions nuget package --- .../O2NextGen.Sdk.NetCore.Extensions.csproj | 9 +++++++ .../O2NextGen.Sdk.NetCore.Extensions.sln | 25 +++++++++++++++++++ .../UnixDateExtensions.cs | 11 ++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.csproj create mode 100644 src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.sln create mode 100644 src/SDKs/O2NextGen.Sdk.NetCore.Extensions/UnixDateExtensions.cs diff --git a/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.csproj b/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.csproj new file mode 100644 index 00000000..bafd05b1 --- /dev/null +++ b/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.sln b/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.sln new file mode 100644 index 00000000..32b79a81 --- /dev/null +++ b/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/O2NextGen.Sdk.NetCore.Extensions.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 25.0.1704.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.Sdk.NetCore.Extensions", "O2NextGen.Sdk.NetCore.Extensions.csproj", "{73C6B6D2-413C-444C-A8D8-9C51A45669B2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {73C6B6D2-413C-444C-A8D8-9C51A45669B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73C6B6D2-413C-444C-A8D8-9C51A45669B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73C6B6D2-413C-444C-A8D8-9C51A45669B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73C6B6D2-413C-444C-A8D8-9C51A45669B2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {28AD8BAB-FD1C-46E6-9F11-6F4DA2FCC91E} + EndGlobalSection +EndGlobal diff --git a/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/UnixDateExtensions.cs b/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/UnixDateExtensions.cs new file mode 100644 index 00000000..3a28b3e5 --- /dev/null +++ b/src/SDKs/O2NextGen.Sdk.NetCore.Extensions/UnixDateExtensions.cs @@ -0,0 +1,11 @@ +using System; +namespace O2NextGen.Sdk.NetCore.Extensions +{ + public class UnixDateExtensions + { + public UnixDateExtensions() + { + } + } +} +