Skip to content

Commit

Permalink
Preview 1 (#49)
Browse files Browse the repository at this point in the history
* remove duplicated items by bad merge

* add security tier

* change pass move token controller, change tokencontroller to authcontroller

* Corrige Bug al gueardar seeds

* Backend CheckLists

* Backend Signatures, Report COnfiguration repository, queires checklist, domain events

* Uploads service & Storage helper class, paths on settings

* solve typo in Shared proyect reference

* Fix Bug Querying CheckLists

* Ignore some local files

* Optional items in  query

* update dev branch  (#21)

* Pipelines Build & Deploy test (#20)

* remove duplicated items by bad merge

* add security tier

* change pass move token controller, change tokencontroller to authcontroller

* Corrige Bug al gueardar seeds

* Backend CheckLists

* Backend Signatures, Report COnfiguration repository, queires checklist, domain events

* Uploads service & Storage helper class, paths on settings

* solve typo in Shared proyect reference

* Fix Bug Querying CheckLists

* Ignore some local files

* Optional items in  query

* update pipeline

f

* fix publish route

* Update dotnet-core.yml

* build path

* Add test url to readme

* add demo credentials

* Solves Signature add and update bug

* simplify api routes

* Quering and DTO mappin for signatures

* Backend Reports Configurations

* Backend Reports Config

* preparing project to deploy

* updates composition api package version

* change to npm

* disable husky

* binds to 0.0.0.0

* Update dotnet-core.yml

* delete web.config

* dispatch pipelines

* solves vuetify failling in Production Stage

* upload pending file

* review indexjs

* updates dev branch from master (#40)

* pending file (#37)

* remove duplicated items by bad merge

* add security tier

* change pass move token controller, change tokencontroller to authcontroller

* Corrige Bug al gueardar seeds

* Backend CheckLists

* Backend Signatures, Report COnfiguration repository, queires checklist, domain events

* Uploads service & Storage helper class, paths on settings

* solve typo in Shared proyect reference

* Fix Bug Querying CheckLists

* Ignore some local files

* Optional items in  query

* update dev branch  (#21)

* Pipelines Build & Deploy test (#20)

* remove duplicated items by bad merge

* add security tier

* change pass move token controller, change tokencontroller to authcontroller

* Corrige Bug al gueardar seeds

* Backend CheckLists

* Backend Signatures, Report COnfiguration repository, queires checklist, domain events

* Uploads service & Storage helper class, paths on settings

* solve typo in Shared proyect reference

* Fix Bug Querying CheckLists

* Ignore some local files

* Optional items in  query

* update pipeline

f

* fix publish route

* Update dotnet-core.yml

* build path

* Add test url to readme

* add demo credentials

* Solves Signature add and update bug

* simplify api routes

* Quering and DTO mappin for signatures

* Backend Reports Configurations

* Backend Reports Config

* preparing project to deploy

* updates composition api package version

* change to npm

* disable husky

* binds to 0.0.0.0

* Update dotnet-core.yml

* delete web.config

* dispatch pipelines

* solves vuetify failling in Production Stage

* upload pending file

* fix index js

* Update package.json

* bugs review

* Rename Reports Feature

* Data Model Adjustmnets for adding support to reports aggregate

* Configure Test Seed, add editorconfig, fix queries bugs que null o 0 in totals

* adjustments call with jesus

* update gitignore, configure containers

* Creating new REports based on selected configuration, add new fields to report entity

* New Project structure, adds login

* Maquetado app macro and menus

* Pages titles

* Grids Checklist & reports Configs, stores, creates types, Authentication flow complete

* remove title

* startup poge must reports

* Create pending types

* Deletes duplicated type

* resolve some warnings

* Backend Adjustments

* New Grids: Signatures, reports, Create new Reports, all grids now can filter, remove, modales, adds messageDialogs

* organize login view, adds logo in toolbar

* organize code

* Include items in checks query

* mostrar items de checks

* mostrar error al inciar sesion

* Solver some bugs creating reports, add advanced filter to checkl;ists and signatures, adds idea for a dashbord with charts and some sorta valuable info

* missing packages and delete reports

* delete signatures

* Configura Forms Validations

* AddEdit Signatures

* update nuxt version, organize pages folder, change mode to spa

* cahnge redirection to options

* add edit Checklist & itmes back and UI

* componentes for reports editing

* reports checks tab

* dynamic signatures in report, some stayles changes
  • Loading branch information
ivaneliasoo authored Jun 25, 2020
1 parent 3891345 commit 3413d3e
Show file tree
Hide file tree
Showing 70 changed files with 3,741 additions and 943 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public async Task<IActionResult> DeleteCheckList(int id)
[ProducesDefaultResponseType]
public async Task<IActionResult> DeleteCheckListItem(int id, int idItem)
{
if (await _mediator.Send(new DeleteCheckListItem(id, idItem)).ConfigureAwait(false))
if (await _mediator.Send(new DeleteCheckListItemCommand(id, idItem)).ConfigureAwait(false))
return Ok();

return BadRequest();
Expand Down Expand Up @@ -207,9 +207,9 @@ public async Task<IActionResult> GetCheckListById(int id)
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesDefaultResponseType]
public IActionResult GetCheckList(string filter)
public IActionResult GetCheckList(string filter, int? reportConfigurationId, int? reportId, bool? inConfigurationOnly = null)
{
var checkList = _checkListsQueries.GetByFilter(filter);
var checkList = _checkListsQueries.GetByFilter(filter, inConfigurationOnly, reportConfigurationId, reportId);

if (checkList is null)
return NotFound();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace Inspections.API.Features.Checklists.Commands
{
public class DeleteCheckListItem : IRequest<bool>
public class DeleteCheckListItemCommand : IRequest<bool>
{
public int IdCheckList { get; set; }
public int IdCheckListItem { get; set; }
public DeleteCheckListItem(int idCheckList, int idCheckListItem)
public DeleteCheckListItemCommand(int idCheckList, int idCheckListItem)
{
IdCheckList = idCheckList;
IdCheckListItem = idCheckListItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public async Task<bool> Handle(AddCheckListCommand request, CancellationToken ca
CheckListMappingHelper.MapParams(request.TextParams),
request.Annotation,
false);

checkList.AddCheckItems(CheckListMappingHelper.MapItems(request.Items));

var result = await _checkListsRepository.AddAsync(checkList).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Ardalis.GuardClauses;
using Inspections.API.Features.Checklists.Commands;
using Inspections.API.Features.Checklists.Mapping;
using Inspections.Core.Domain.CheckListAggregate;
using Inspections.Core.Interfaces;
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Inspections.API.Features.Checklists.Handlers
{
public class DeleteCheckListCommandHandler : IRequestHandler<DeleteCheckListCommand, bool>
{
private readonly ICheckListsRepository _checkListsRepository;

public DeleteCheckListCommandHandler(ICheckListsRepository checkListsRepository)
{
_checkListsRepository = checkListsRepository ?? throw new ArgumentNullException(nameof(checkListsRepository));
}

public async Task<bool> Handle(DeleteCheckListCommand request, CancellationToken cancellationToken)
{
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Inspections.API.Features.Checklists.Commands;
using Inspections.API.Features.Checklists.Mapping;
using Inspections.API.Features.Checklists.Models;
using Inspections.Core.Domain.CheckListAggregate;
using Inspections.Core.Interfaces;
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Inspections.API.Features.Checklists.Handlers
{
public class DeleteCheckListItemCommandHandler : IRequestHandler<DeleteCheckListItemCommand, bool>
{
private readonly ICheckListsRepository _checkListsRepository;

public DeleteCheckListItemCommandHandler(ICheckListsRepository checkListsRepository)
{
_checkListsRepository = checkListsRepository ?? throw new ArgumentNullException(nameof(checkListsRepository));
}

public async Task<bool> Handle(DeleteCheckListItemCommand request, CancellationToken cancellationToken)
{
var item = await _checkListsRepository.GetItemByIdAsync(request!.IdCheckListItem).ConfigureAwait(false);
if (item is null)
return false;

var checklist = await _checkListsRepository.GetByIdAsync(request.IdCheckList).ConfigureAwait(false);
checklist.RemoveCheckItems(item);
await _checkListsRepository.UpdateAsync(checklist).ConfigureAwait(false);

return true;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Ardalis.GuardClauses;
using Inspections.API.Features.Checklists.Commands;
using Inspections.Core.Domain.CheckListAggregate;
using Inspections.Core.Interfaces;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Inspections.API.Features.Checklists.Handlers
{
public class DeleteCheckListParamCommandHandler : IRequestHandler<DeleteCheckListParamCommand, bool>
{
private readonly ICheckListsRepository _checkListsRepository;

public DeleteCheckListParamCommandHandler(ICheckListsRepository checkListsRepository)
{
_checkListsRepository = checkListsRepository ?? throw new ArgumentNullException(nameof(checkListsRepository));
}

public async Task<bool> Handle(DeleteCheckListParamCommand request, CancellationToken cancellationToken)
{
Guard.Against.Null(request, nameof(request));

return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Ardalis.GuardClauses;
using Inspections.API.Features.Checklists.Commands;
using Inspections.API.Features.Checklists.Mapping;
using Inspections.Core.Domain.CheckListAggregate;
using Inspections.Core.Interfaces;
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Inspections.API.Features.Checklists.Handlers
{
public class UpdateCheckListCommandHandler : IRequestHandler<UpdateCheckListCommand, bool>
{
private readonly ICheckListsRepository _checkListsRepository;

public UpdateCheckListCommandHandler(ICheckListsRepository checkListsRepository)
{
_checkListsRepository = checkListsRepository ?? throw new ArgumentNullException(nameof(checkListsRepository));
}

public async Task<bool> Handle(UpdateCheckListCommand request, CancellationToken cancellationToken)
{
Guard.Against.Null(request, nameof(request));

var checkList = await _checkListsRepository.GetByIdAsync(request.IdCheckList).ConfigureAwait(false);
checkList.Edit(request.Text, request.Annotation);
await _checkListsRepository.UpdateAsync(checkList).ConfigureAwait(false);

return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Inspections.API.Features.Checklists.Commands;
using Inspections.API.Features.Checklists.Mapping;
using Inspections.API.Features.Checklists.Models;
using Inspections.Core.Domain.CheckListAggregate;
using Inspections.Core.Interfaces;
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Inspections.API.Features.Checklists.Handlers
{
public class UpdateCheckListItemCommandHandler : IRequestHandler<UpdateCheckListItemCommand, bool>
{
private readonly ICheckListsRepository _checkListsRepository;

public UpdateCheckListItemCommandHandler(ICheckListsRepository checkListsRepository)
{
_checkListsRepository = checkListsRepository ?? throw new ArgumentNullException(nameof(checkListsRepository));
}

public async Task<bool> Handle(UpdateCheckListItemCommand request, CancellationToken cancellationToken)
{
var checkList = await _checkListsRepository.GetByIdAsync(request.CheckListId).ConfigureAwait(false);
var item = await _checkListsRepository.GetItemByIdAsync(request.Id).ConfigureAwait(false);

checkList.RemoveCheckItems(item);
item.Checked = request.Checked;
item.Remarks = request.Remarks;
item.Required = request.Required;
item.Text = request.Text;
checkList.AddCheckItems(item);

await _checkListsRepository.UpdateAsync(checkList).ConfigureAwait(false);

return true;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Ardalis.GuardClauses;
using Inspections.API.Features.Checklists.Commands;
using Inspections.Core.Domain.CheckListAggregate;
using Inspections.Core.Interfaces;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Inspections.API.Features.Checklists.Handlers
{
public class UpdateCheckListParamCommandHandler : IRequestHandler<UpdateCheckListParamCommand, bool>
{
private readonly ICheckListsRepository _checkListsRepository;

public UpdateCheckListParamCommandHandler(ICheckListsRepository checkListsRepository)
{
_checkListsRepository = checkListsRepository ?? throw new ArgumentNullException(nameof(checkListsRepository));
}

public async Task<bool> Handle(UpdateCheckListParamCommand request, CancellationToken cancellationToken)
{
return true;
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public CreateInspectionHandler(IReportsRepository reportsRepository, IReportConf

public async Task<bool> Handle(CreateReportCommand request, CancellationToken cancellationToken)
{
// must be one configuratio per type
var cfg = await _reportConfigurationsRepository.GetByIdAsync(1).ConfigureAwait(false);
var cfg = await _reportConfigurationsRepository.GetByIdAsync(request.ConfigurationId).ConfigureAwait(false);

IReportsBuilder _reportsBuilder = new ReportsBuilder(cfg);
var newReport = _reportsBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Inspections.API.Features.Inspections.Commands;
using Inspections.Core.Interfaces;
using MediatR;

namespace Inspections.API.Features.Reports.Handlers
{
public class DeleteReportCommandHandler : IRequestHandler<DeleteReportCommand, bool>
{
private readonly IReportsRepository _reportsRepository;

public DeleteReportCommandHandler(IReportsRepository reportsRepository, ISignaturesRepository signaturesRepository, ICheckListsRepository checkListsRepository)
{
this._reportsRepository = reportsRepository ?? throw new ArgumentNullException(nameof(reportsRepository));
}
public async Task<bool> Handle(DeleteReportCommand request, CancellationToken cancellationToken)
{
var report = await _reportsRepository.GetByIdAsync(request.Id).ConfigureAwait(false);

if (!report.IsClosed)
{
await _reportsRepository.DeleteAsync(report).ConfigureAwait(false);
return true;
}

return false;

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,31 @@ public async Task<IActionResult> Post([FromBody] CreateReportCommand createData)
[HttpGet]
public async Task<IActionResult> GetAll(string filter)
{
var result = await _reportsRepository.GetAll(filter);
var result = await _reportsRepository.GetAll(filter).ConfigureAwait(false);
if (result is null)
return NoContent();

return Ok(result);
}

[HttpGet("{id:int}")]
public async Task<IActionResult> GetReport(int id)
{
var result = await _reportsRepository.GetByIdAsync(id).ConfigureAwait(false);
if (result is null)
return NoContent();

return Ok(result);
}

[HttpDelete("{id:int}")]
public async Task<IActionResult> DeleteReport(int id)
{
var result = await _mediator.Send(new DeleteReportCommand(id)).ConfigureAwait(false);
if (!result)
return BadRequest();

return NoContent();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public AddSignatureCommand(string title,
string designation,
string remarks,
DateTimeOffset date,
bool principal)
bool principal,
int reportId,
int reportConfigurationId)
{
Title = title;
Annotation = annotation;
Expand All @@ -26,6 +28,8 @@ public AddSignatureCommand(string title,
Remarks = remarks;
Date = date;
Principal = principal;
ReportId = reportId;
ReportConfigurationId = reportConfigurationId;
}

private AddSignatureCommand() { }
Expand All @@ -38,5 +42,8 @@ private AddSignatureCommand() { }
public string Remarks { get; set; }
public DateTimeOffset Date { get; set; }
public bool Principal { get; set; }
public bool IsConfiguration { get; set; }
public int? ReportId{ get; set; }
public int? ReportConfigurationId { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public async Task<bool> Handle(AddSignatureCommand request, CancellationToken ca
Date = request.Date,
Principal = request.Principal,
Responsable = new Responsable() { Name= request.ResponsableName, Type= request.ResponsableType },
IsConfiguration = false
IsConfiguration = request.ReportConfigurationId>0,
ReportConfigurationId = request.ReportConfigurationId == 0 ? default:request.ReportConfigurationId,
ReportId = request.ReportId == 0 ? default : request.ReportId
};

var result = await _signaturesRepository.AddAsync(newSignature).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class SignatureDTO
public string Remarks { get; set; }
public DateTimeOffset Date { get; set; }
public bool Principal { get; set; }
public int? ReportId { get; set; }
public int? ReportConfigurationId { get; set; }

public SignatureDTO(Signature signature)
{
Expand All @@ -35,6 +37,8 @@ public SignatureDTO(Signature signature)
ResponsableType = signature.Responsable.Type;
ResponsableName = signature.Responsable.Name;
}
ReportConfigurationId = signature.ReportConfigurationId;
ReportId = signature.ReportId;
}
}
}
Loading

0 comments on commit 3413d3e

Please sign in to comment.