Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Add Admin page to the Vue3 application #110

Merged
merged 23 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2e81637
working commit
KyleMcMaster Mar 3, 2022
893b1dc
Update package.json
KyleMcMaster Mar 3, 2022
a0d5589
Add admin component
KyleMcMaster Mar 7, 2022
2b1e3cb
Add some sample unit tests
KyleMcMaster Mar 8, 2022
e9f3e89
Update EmployeePayrollCreateCommandTests.cs
KyleMcMaster Mar 8, 2022
0ac9527
Merge branch 'master' into feat/unit-tests
KyleMcMaster Mar 8, 2022
6b04afc
Add Admin page to vue3 app
KyleMcMaster Mar 19, 2022
a0724c8
Remove .vscode files
KyleMcMaster Mar 19, 2022
f82e123
Update README.md
KyleMcMaster Mar 19, 2022
251caed
Merge branch 'main' into feat/header
KyleMcMaster Mar 20, 2022
fb04b0e
Merge pull request #107 from KyleMcMaster/feat/unit-tests
KyleMcMaster Mar 21, 2022
bad0beb
Update workspace and tasks
KyleMcMaster Mar 25, 2022
781260d
build(deps): bump minimist from 1.2.5 to 1.2.6 in /client
dependabot[bot] Mar 31, 2022
7cb7fbe
Merge pull request #111 from KyleMcMaster/dependabot/npm_and_yarn/cli…
KyleMcMaster Mar 31, 2022
2deaed4
Update README.md
KyleMcMaster Apr 6, 2022
c3674d9
Update README.md
KyleMcMaster Apr 6, 2022
9a03793
Add cors setting, add card to admin vue
KyleMcMaster Apr 11, 2022
47e222b
Merge branch 'feat/header' of https://github.com/KyleMcMaster/payroll…
KyleMcMaster Apr 11, 2022
33c1a98
Merge remote-tracking branch 'origin/master' into feat/header
KyleMcMaster Apr 11, 2022
aece414
Renane test and skip!
KyleMcMaster Apr 11, 2022
ad8d7c7
Small fixes
KyleMcMaster Apr 11, 2022
7782cc9
Rename build steps
KyleMcMaster Apr 11, 2022
38993a7
Rename build steps
KyleMcMaster Apr 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ indent_size = 4
indent_style = space
tab_width = 4

# IDE0005: Remove unnecessary imports
dotnet_diagnostic.IDE0005.severity = warning

#### .NET Coding Conventions ####

# Organize usings
Expand Down Expand Up @@ -201,4 +204,4 @@ dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

# File Scoped Namespaces
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_namespace_declarations = file_scoped:warning
8 changes: 4 additions & 4 deletions .github/workflows/policy-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:

jobs:
build-and-test-angular:
name: Build and Deploy
name: Angular - Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -32,7 +32,7 @@ jobs:
# npm run test --if-present

build-and-test-vue:
name: Build and Deploy
name: Vue - Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -46,5 +46,5 @@ jobs:
cd vue-client
npm install
npm run build --if-present
npm run test:unit --if-present
npm run test:e2e:ci --if-present
# npm run test:unit --if-present
# npm run test:e2e:ci --if-present
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

Sample HRIS application where a list of employees and their payroll information would be available in report format.

<p>
<a href="https://github.com/KyleMcMaster/payroll-processor/graphs/contributors" alt="Contributors">
<img src="https://img.shields.io/github/contributors/KyleMcMaster/payroll-processor" /></a>

<a href="https://github.com/KyleMcMaster/payroll-processor/stargazers" alt="Stars">
<img src="https://img.shields.io/github/stars/KyleMcMaster/payroll-processor" /></a>

<a href="https://github.com/KyleMcMaster/payroll-processor/issues" alt="Issues">
<img src="https://img.shields.io/github/issues/KyleMcMaster/payroll-processor" /></a>

<a href="https://github.com/KyleMcMaster/payroll-processor/blob/master/LICENSE" alt="License">
<img src="https://img.shields.io/github/license/KyleMcMaster/payroll-processor" /></a>
</p>

![Twitter Follow](https://img.shields.io/twitter/follow/kylemcmaster?style=social)
![Twitter Follow](https://img.shields.io/twitter/follow/seangwright?style=social)

## Build status

### Api and Functions
Expand All @@ -24,25 +41,16 @@ Areas of interest:
- Functional Programming
- Automated Tests
- Basics of Angular, TypeScript, Rxjs, and Bootstrap
- Synergy that exists between Azure Functions and .Net Core Web Apis
- Synergy that exists between Azure Functions and .NET Core Web APIs
- Event Sourcing and CQRS
- Having fun!

## Roadmap

### MVP

#### Employees

- [x] Create
- [x] Read
- [x] Update
- [x] Delete (disable)

#### Payrolls

- [x] Create
- [x] Read
- [x] Employee and Payroll CRUD functionality representing a simple workflow for the domain
- [x] Administration screen for seeding data

### Future Enhancements

Expand Down Expand Up @@ -74,6 +82,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

## Project Structure

api/ - .NET API and Azure Functions backend

client/ - Main view of the application built with Angular and Boostrap

vue-client/ - Alternate view of the Admin page built with Vue3 and Tailwind CSS

## References

[Akita-Demo](https://github.com/seangwright/akita-demo)
Expand Down Expand Up @@ -140,7 +156,7 @@ The application will start and listen for requests on [http://localhost:5000](ht

The application will listen for requests on [http://localhost:7071](http://localhost:7071).

### Client
### Angular Client

- Copy

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using AutoFixture.Idioms;
using FluentAssertions;
using PayrollProcessor.Core.Domain.Features.Employees;
using PayrollProcessor.Tests.Fixtures;
using Xunit;

namespace PayrollProcessor.Core.Domain.Tests.Features.Employees;

public class EmployeePayrollCreateCommandTests
{
[Fact]
public void ConstructorGuardsAgainstInvalidParameters()
{
var assertion = new GuardClauseAssertion(new DomainFixture());

assertion.Verify(typeof(EmployeePayrollCreateCommand).GetConstructors());
}

[Theory, AutoDomainData]
public void ConstructorAssignsPropertiesFromParameters(Guid newPayrollId, Employee employee, EmployeePayrollNew employeePayroll)
{
var sut = new EmployeePayrollCreateCommand(employee, newPayrollId, employeePayroll);

sut.Employee.Should().Be(employee);
sut.NewPayrollId.Should().Be(newPayrollId);
sut.NewPayroll.Should().Be(employeePayroll);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AutoFixture;
using FluentAssertions;
using PayrollProcessor.Data.Persistence.Features.Employees;
using Xunit;

namespace PayrollProcessor.Data.Persistence.Tests.Features.Employees;

public class EmployeeRecordMapTests
{
private readonly EmployeeRecord employeeRecord;
private readonly IEnumerable<EmployeePayrollRecord> employeePayrolls;

public EmployeeRecordMapTests()
{
var fixture = new Fixture();

employeeRecord = fixture.Create<EmployeeRecord>();

employeePayrolls = fixture
.Build<EmployeePayrollRecord>()
.With(epr => epr.PartitionKey, employeeRecord.Id.ToString())
.With(epr => epr.PartitionKey, Guid.NewGuid().ToString())
.CreateMany();
}

[Fact]
public void ToEmployeeMapsValues()
{
var employee = EmployeeRecord.Map.ToEmployee(employeeRecord);

employee.Id.Should().Be(employeeRecord.Id);
employee.Department.Should().Be(employeeRecord.Department);
employee.Email.Should().Be(employeeRecord.Email);
employee.EmploymentStartedOn.Should().Be(employeeRecord.EmploymentStartedOn);
employee.FirstName.Should().Be(employeeRecord.FirstName);
employee.LastName.Should().Be(employeeRecord.LastName);
employee.Phone.Should().Be(employeeRecord.Phone);
employee.Status.Should().Be(employeeRecord.Status);
employee.Title.Should().Be(employeeRecord.Title);
}

[Fact]
public void ToEmployeeDetailsMapsValues()
{
var employee = EmployeeRecord.Map.ToEmployeeDetails(employeeRecord, employeePayrolls);

employee.Id.Should().Be(employeeRecord.Id);
employee.Department.Should().Be(employeeRecord.Department);
employee.Email.Should().Be(employeeRecord.Email);
employee.EmploymentStartedOn.Should().Be(employeeRecord.EmploymentStartedOn);
employee.FirstName.Should().Be(employeeRecord.FirstName);
employee.LastName.Should().Be(employeeRecord.LastName);
employee.Phone.Should().Be(employeeRecord.Phone);
employee.Status.Should().Be(employeeRecord.Status);
employee.Title.Should().Be(employeeRecord.Title);

employee.Payrolls.Should().HaveCount(employeePayrolls.Count());

var employeePayroll = employee.Payrolls.First();
employeePayroll.Id.Should().Be(employeePayrolls.First().Id);
employeePayroll.CheckDate.Should().Be(employeePayrolls.First().CheckDate);
employeePayroll.EmployeeId.Should().Be(Guid.Parse(employeePayrolls.First().PartitionKey));
employeePayroll.GrossPayroll.Should().Be(employeePayrolls.First().GrossPayroll);
employeePayroll.PayrollPeriod.Should().Be(employeePayrolls.First().PayrollPeriod);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="NSubstitute" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand All @@ -22,10 +23,7 @@

<ItemGroup>
<ProjectReference Include="..\PayrollProcessor.Data.Persistence\PayrollProcessor.Data.Persistence.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Features\Employees\" />
<ProjectReference Include="..\PayrollProcessor.Tests\PayrollProcessor.Tests.csproj" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion api/PayrollProcessor.Web.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

JsonConvert.DefaultSettings = () => DefaultJsonSerializerSettings.JsonSerializerSettings;

string clientDomains = builder.Configuration["CORS:client:domains"];
builder.Services.AddCors(options =>
options.AddPolicy("CorsPolicy",
cpb => cpb
.WithOrigins(builder.Configuration["CORS:client:domain"])
.WithOrigins(clientDomains.Split(';'))
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials()));
Expand Down
2 changes: 1 addition & 1 deletion api/PayrollProcessor.Web.Api/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"AllowedHosts": "*",
"CORS": {
"client:domain": "http://localhost:4201"
"client:domains": "http://localhost:4201;http://localhost:3000"
},
"CosmosDb": {
"DatabaseName": "PayrollProcessor",
Expand Down
2 changes: 1 addition & 1 deletion api/PayrollProcessor.Web.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"AllowedHosts": "*",
"CORS": {
"client:domain": "http://localhost:4201"
"client:domains": "http://localhost:4201;http://localhost:3000"
},
"CosmosDb": {
"DatabaseName": "PayrollProcessor",
Expand Down
2 changes: 1 addition & 1 deletion api/PayrollProcessor.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
VisualStudioVersion = 17.1.32210.238
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PayrollProcessor.Web.Api", "PayrollProcessor.Web.Api\PayrollProcessor.Web.Api.csproj", "{C433B9C9-EC9D-43EA-A50A-7CBC33862073}"
EndProject
Expand Down
12 changes: 6 additions & 6 deletions client/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"command": "npm",
"args": ["install"],
"problemMatcher": [],
"label": "Client: Install",
"detail": "Instal npm project packages for Angular client"
"label": "Angular: Install Packages",
"detail": "Install npm project packages for Angular client"
},
{
"type": "npm",
"script": "start",
"dependsOn": ["Client: Install"],
"dependsOn": ["Angular: Install Packages"],
"problemMatcher": [],
"label": "Client: Serve",
"label": "Angular: Serve",
"detail": "Serves the Angular client on http://localhost:4201"
},
{
"type": "npm",
"script": "build",
"dependsOn": ["Client: Install"],
"dependsOn": ["Angular: Install Packages"],
"problemMatcher": [],
"label": "Client: Build",
"label": "Angular: Build",
"detail": "Builds the Angular client for production"
}
]
Expand Down
26 changes: 13 additions & 13 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@angular/platform-browser": "13.2.1",
"@angular/platform-browser-dynamic": "13.2.4",
"@angular/router": "13.2.4",
"@datorama/akita": "7.0.1",
"@datorama/akita": "7.1.1",
"@fortawesome/angular-fontawesome": "0.10.1",
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-solid-svg-icons": "5.15.4",
Expand Down
Loading