Skip to content

Commit

Permalink
added accounting module, refactored commands and queries
Browse files Browse the repository at this point in the history
  • Loading branch information
suxrobGM committed Oct 19, 2023
1 parent e4b6c1d commit a523154
Show file tree
Hide file tree
Showing 86 changed files with 650 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private Task SearchAsync()

private async Task LoadPage(PageEventArgs e, string searchInput = "")
{
var pagedData = await CallApiAsync(api => api.GetTenantsAsync(new SearchableRequest(searchInput, e.Page)));
var pagedData = await CallApiAsync(api => api.GetTenantsAsync(new SearchableQuery(searchInput, e.Page)));

if (pagedData != null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Logistics.Client/Abstractions/IEmployeeApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Logistics.Client.Abstractions;
public interface IEmployeeApi
{
Task<ResponseResult<EmployeeDto>> GetEmployeeAsync(string userId);
Task<PagedResponseResult<EmployeeDto>> GetEmployeesAsync(SearchableRequest request);
Task<PagedResponseResult<EmployeeDto>> GetEmployeesAsync(SearchableQuery query);
Task<ResponseResult> CreateEmployeeAsync(CreateEmployee employee);
Task<ResponseResult> UpdateEmployeeAsync(UpdateEmployee employee);
Task<ResponseResult> DeleteEmployeeAsync(string userId);
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Logistics.Client/Abstractions/ITenantApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Logistics.Client.Abstractions;
public interface ITenantApi
{
Task<ResponseResult<TenantDto>> GetTenantAsync(string identifier);
Task<PagedResponseResult<TenantDto>> GetTenantsAsync(SearchableRequest request);
Task<PagedResponseResult<TenantDto>> GetTenantsAsync(SearchableQuery query);
Task<ResponseResult> CreateTenantAsync(CreateTenant tenant);
Task<ResponseResult> UpdateTenantAsync(UpdateTenant tenant);
Task<ResponseResult> DeleteTenantAsync(string id);
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Logistics.Client/Abstractions/ITruckApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Logistics.Client.Abstractions;
public interface ITruckApi
{
Task<ResponseResult<TruckDto>> GetTruckAsync(GetTruckQuery query);
Task<PagedResponseResult<TruckDto>> GetTrucksAsync(SearchableRequest request, bool includeLoads = false);
Task<PagedResponseResult<TruckDto>> GetTrucksAsync(SearchableQuery query, bool includeLoads = false);
Task<ResponseResult> CreateTruckAsync(CreateTruck truck);
Task<ResponseResult> UpdateTruckAsync(UpdateTruck truck);
Task<ResponseResult> DeleteTruckAsync(string id);
Expand Down
12 changes: 6 additions & 6 deletions src/Client/Logistics.Client/Implementations/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ public Task<ResponseResult<TruckDto>> GetTruckAsync(GetTruckQuery query)
return MakeGetRequestAsync<ResponseResult<TruckDto>>($"trucks/{id}", query.ToDictionary());
}

public Task<PagedResponseResult<TruckDto>> GetTrucksAsync(SearchableRequest request, bool includeLoads = false)
public Task<PagedResponseResult<TruckDto>> GetTrucksAsync(SearchableQuery query, bool includeLoads = false)
{
var queryDict = request.ToDictionary();
var queryDict = query.ToDictionary();
queryDict.Add("includeLoads", includeLoads.ToString());
return MakeGetRequestAsync<PagedResponseResult<TruckDto>>("trucks", queryDict);
}
Expand Down Expand Up @@ -221,9 +221,9 @@ public Task<ResponseResult<EmployeeDto>> GetEmployeeAsync(string userId)
return MakeGetRequestAsync<ResponseResult<EmployeeDto>>($"employees/{userId}");
}

public Task<PagedResponseResult<EmployeeDto>> GetEmployeesAsync(SearchableRequest request)
public Task<PagedResponseResult<EmployeeDto>> GetEmployeesAsync(SearchableQuery query)
{
return MakeGetRequestAsync<PagedResponseResult<EmployeeDto>>("employees", request.ToDictionary());
return MakeGetRequestAsync<PagedResponseResult<EmployeeDto>>("employees", query.ToDictionary());
}

public Task<ResponseResult> CreateEmployeeAsync(CreateEmployee employee)
Expand Down Expand Up @@ -251,9 +251,9 @@ public Task<ResponseResult<TenantDto>> GetTenantAsync(string identifier)
return MakeGetRequestAsync<ResponseResult<TenantDto>>($"tenants/{identifier}");
}

public Task<PagedResponseResult<TenantDto>> GetTenantsAsync(SearchableRequest request)
public Task<PagedResponseResult<TenantDto>> GetTenantsAsync(SearchableQuery query)
{
return MakeGetRequestAsync<PagedResponseResult<TenantDto>>("tenants", request.ToDictionary());
return MakeGetRequestAsync<PagedResponseResult<TenantDto>>("tenants", query.ToDictionary());
}

public Task<ResponseResult> CreateTenantAsync(CreateTenant tenant)
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Logistics.Client/Models/GetLoadsQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Logistics.Client.Models;

public class GetLoadsQuery : SearchableRequest
public class GetLoadsQuery : SearchableQuery
{
public string? TruckId { get; set; }
public bool? FilterActiveLoads { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {Routes} from '@angular/router';
import {Permissions} from '@core/enums';
import {AuthGuard} from '@core/guards';


export const ACCOUNTING_ROUTES: Routes = [
// {
// path: '',
// component: ListLoadComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: '',
// permission: Permissions.Loads.View,
// },
// },
// {
// path: 'add',
// component: AddLoadComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: 'Add',
// permission: Permissions.Loads.Create,
// },
// },
// {
// path: 'edit/:id',
// component: EditLoadComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: 'Edit',
// permission: Permissions.Loads.Edit,
// },
// },
];
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>invoices works!</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {Component} from '@angular/core';
import {CommonModule} from '@angular/common';

@Component({
selector: 'app-list-invoices',
standalone: true,
templateUrl: './list-invoices.component.html',
styleUrls: ['./list-invoices.component.scss'],
imports: [
CommonModule,
],
})
export class ListInvoicesComponent {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<div class="d-flex align-items-center">
<h1>List Loads</h1>
<button pButton pRipple
class="p-button-lg p-button-rounded p-button-text text-black ms-2"
icon="bi bi-plus-square-fill"
pTooltip="Add a new load"
routerLink="/loads/add">
</button>
</div>
<hr class="w-100">

<p-card>
<div class="row">
<div class="col-12">
<p-table [value]="loads" responsiveLayout="scroll" [lazy]="true"
[paginator]="true" [showCurrentPageReport]="true"
(onLazyLoad)="load($event)" [rows]="10" [(first)]="first"
[totalRecords]="totalRecords" [loading]="isLoading"
[rowsPerPageOptions]="[10,25,50]">
<ng-template pTemplate="caption">
<div class="d-flex">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="text" placeholder="Search" (input)="search($event)" />
</span>
</div>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="refId">
ID
<p-sortIcon field="refId"></p-sortIcon>
</th>
<th pSortableColumn="name">
Name
<p-sortIcon field="name"></p-sortIcon>
</th>
<th pSortableColumn="originAddress">
Origin
<p-sortIcon field="originAddress"></p-sortIcon>
</th>
<th pSortableColumn="destinationAddress">
Destination
<p-sortIcon field="destinationAddress"></p-sortIcon>
</th>
<th pSortableColumn="dispatchedDate">
Dispatched
<p-sortIcon field="dispatchedDate"></p-sortIcon>
</th>
<th pSortableColumn="pickUpDate">
Pick Up
<p-sortIcon field="pickUpDate"></p-sortIcon>
</th>
<th pSortableColumn="deliveryDate">
Delivery
<p-sortIcon field="deliveryDate"></p-sortIcon>
</th>
<th pSortableColumn="status">
Status
<p-sortIcon field="status"></p-sortIcon>
</th>
<th pSortableColumn="distance">
Distance (mi)
<p-sortIcon field="distance"></p-sortIcon>
</th>
<th pSortableColumn="deliveryCost">
Cost
<p-sortIcon field="deliveryCost"></p-sortIcon>
</th>
<th>
Truck
</th>
<th>
Dispatcher
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-load>
<tr>
<td>
<a [routerLink]="['/loads/edit', load.id]">
{{load.refId}}
</a>
</td>
<td [pTooltip]="load.name" [showDelay]="500" tooltipPosition="bottom">
{{load.name}}
</td>
<td [pTooltip]="load.originAddress" [showDelay]="500" tooltipPosition="bottom">
{{load.originAddress}}
</td>
<td [pTooltip]="load.destinationAddress" [showDelay]="500" tooltipPosition="bottom">
{{load.destinationAddress}}
</td>
<td>{{load.dispatchedDate | date:'mediumDate'}}</td>
<td>{{load.pickUpDate | date:'mediumDate'}}</td>
<td>{{load.deliveryDate | date:'mediumDate'}}</td>
<td>{{getLoadStatusName(load.status)}}</td>
<td>{{load.distance | distanceUnit:'mi'}}</td>
<td>{{load.deliveryCost | currency}}</td>
<td>
<a [routerLink]="['/truck/details', load.assignedTruckId]">
{{load.assignedTruckNumber}}
</a>
</td>
<td>{{load.assignedDispatcherName}}</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
</p-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Component} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule} from '@angular/router';
import {CardModule} from 'primeng/card';
import {TableModule} from 'primeng/table';
import {TooltipModule} from 'primeng/tooltip';


@Component({
selector: 'app-list-payments',
standalone: true,
templateUrl: './list-payments.component.html',
styleUrls: ['./list-payments.component.scss'],
imports: [
CommonModule,
CardModule,
TableModule,
TooltipModule,
RouterModule,
],
})
export class ListPaymentsComponent {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>list-payroll works!</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {Component} from '@angular/core';
import {CommonModule} from '@angular/common';

@Component({
selector: 'app-list-payroll',
standalone: true,
templateUrl: './list-payroll.component.html',
styleUrls: ['./list-payroll.component.scss'],
imports: [
CommonModule,
],
})
export class ListPayrollComponent {

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class ValidationSummaryComponent implements OnInit {
public formErrors$ = this.formErrorsSubject.asObservable();

@Input({required: true}) form!: FormGroup;


ngOnInit(): void {
this.form.valueChanges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
using Logistics.Application.Common;
using Logistics.Domain.Constraints;
using Logistics.Shared;
using MediatR;

namespace Logistics.Application.Admin.Commands;

public class CreateTenantCommand : Request<ResponseResult>
public class CreateTenantCommand : IRequest<ResponseResult>
{
[Required, StringLength(TenantConsts.NameLength)]
public string? Name { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Logistics.Application.Common;
using Logistics.Shared;
using MediatR;

namespace Logistics.Application.Admin.Commands;

public class DeleteTenantCommand : Request<ResponseResult>
public class DeleteTenantCommand : IRequest<ResponseResult>
{
public string? Id { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Logistics.Application.Common;
using Logistics.Shared;
using MediatR;

namespace Logistics.Application.Admin.Commands;

public class RemoveRoleFromUserCommand : Request<ResponseResult>
public class RemoveRoleFromUserCommand : IRequest<ResponseResult>
{
public string? UserId { get; set; }
public string? Role { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Logistics.Application.Common;
using Logistics.Shared;
using MediatR;

namespace Logistics.Application.Admin.Commands;

public class UpdateTenantCommand : Request<ResponseResult>
public class UpdateTenantCommand : IRequest<ResponseResult>
{
public string? Id { get; set; }
public string? Name { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Logistics.Application.Common;
using Logistics.Shared;
using MediatR;

namespace Logistics.Application.Admin.Commands;

public class UpdateUserCommand : Request<ResponseResult>
public class UpdateUserCommand : IRequest<ResponseResult>
{
public string? Id { get; set; }
public string? FirstName { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Logistics.Application.Common;
using Logistics.Shared;
using Logistics.Shared.Models;
using MediatR;

namespace Logistics.Application.Admin.Queries;

public class GetAppRolesQuery : SearchableQuery<AppRoleDto>
public class GetAppRolesQuery : SearchableQuery, IRequest<PagedResponseResult<AppRoleDto>>
{
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Logistics.Application.Common;
using Logistics.Shared.Models;
using Logistics.Shared;
using MediatR;

namespace Logistics.Application.Admin.Queries;

public sealed class GetTenantQuery : Request<ResponseResult<TenantDto>>
public sealed class GetTenantQuery : IRequest<ResponseResult<TenantDto>>
{
public string? Id { get; set; }
public string? Name { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Text.Json.Serialization;
using Logistics.Application.Common;
using Logistics.Shared;
using Logistics.Shared.Models;
using MediatR;

namespace Logistics.Application.Admin.Queries;

public sealed class GetTenantsQuery : SearchableQuery<TenantDto>
public sealed class GetTenantsQuery : SearchableQuery, IRequest<PagedResponseResult<TenantDto>>
{
[JsonIgnore]
public bool IncludeConnectionStrings { get; set; }
Expand Down
Loading

0 comments on commit a523154

Please sign in to comment.