Skip to content

Commit ce6ac49

Browse files
authored
Merge pull request #6 from jmayer913/v9.0.1/VersionBranch
V9.0.1/version branch
2 parents 79f39f7 + a94b8ca commit ce6ac49

7 files changed

Lines changed: 99 additions & 53 deletions

File tree

JMayer.Example.ASPReact.Server/JMayer.Example.ASPReact.Server.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
<SpaRoot>..\jmayer.example.aspreact.client</SpaRoot>
88
<SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand>
99
<SpaProxyServerUrl>https://localhost:5173</SpaProxyServerUrl>
10-
<Version>9.0.0</Version>
10+
<Version>9.0.1</Version>
1111
<Authors>jmayer913</Authors>
1212
<Company>jmayer913</Company>
1313
<RepositoryUrl>https://github.com/jmayer913/JMayer-Example-ASPReact</RepositoryUrl>
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="JMayer.Web.Mvc" Version="9.0.0" />
17+
<PackageReference Include="JMayer.Web.Mvc" Version="9.0.2" />
1818
<PackageReference Include="Microsoft.AspNetCore.SpaProxy">
19-
<Version>9.0.11</Version>
19+
<Version>9.0.12</Version>
2020
</PackageReference>
2121
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.0" />
2222
</ItemGroup>

README.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,30 @@ find a flight in the flight schedule to determine what sort destination the bag
55

66
On startup, the example project pregenerates a few airlines, gates and sort destinations and then, a flight schedule is pregenerated; a flight every 10 minutes between 4AM and 10PM. The example has two pages, airlines and flight schedule.
77

8-
## Airline
8+
## Airlines Page
9+
910
The airlines page allows the user to add/edit/delete airlines.
1011

11-
<img width="1919" alt="image" src="https://github.com/user-attachments/assets/ef3c14f2-02a2-478b-aab8-9ec72e8824e1" />
12+
<img width="1919" height="590" alt="image" src="https://github.com/user-attachments/assets/10863f13-529e-4c2a-aa07-c05cb587803f" />
13+
14+
### Add / Edit
15+
16+
On the airlines page, the user can create a new airline or edit an existing airline.
17+
18+
* Name - The friendly name for the airline; required and must be unique.
19+
* Description - A description about the airline; optional.
20+
* IATA - The code assigned by the International Air Transport Association to the airline; required and must be two letters or a letter and a number.
21+
* ICAO - The code assigned by the International Civil Aviation Organization to the airline; required, must be 3 letters and must be unique.
22+
* Number Code - The number code assigned by the International Air Transport Association to the airline; required, must be 3 digits and must be unique unless 000 (unassigned).
23+
* Sort Destination - The default sort destination for the airline; required.
24+
25+
<img width="401" height="553" alt="image" src="https://github.com/user-attachments/assets/f25e4ee8-f610-425f-a88f-f7422c7dae31" />
26+
27+
<img width="398" height="549" alt="image" src="https://github.com/user-attachments/assets/ebe27af6-34f3-4b20-ac5c-040d5bbb7bb2" />
1228

13-
<img width="425" alt="image" src="https://github.com/user-attachments/assets/a7e93abf-cb9d-458a-824d-fc496cbcb775" />
29+
### Delete
1430

15-
<img width="407" alt="image" src="https://github.com/user-attachments/assets/108c4aa0-0d33-4c35-ba09-99442a745c58" />
31+
On the airlines page, the user can delete an airline. The user will be required to confirm the deletion or cancel. On confirmation, the airline and its associated flights will be deleted.
1632

1733
<img width="413" alt="image" src="https://github.com/user-attachments/assets/de48d6ec-4046-44fa-850c-298005312601" />
1834

@@ -21,14 +37,32 @@ The flight schedule page allows the user to add/edit/delete flights in the sched
2137

2238
<img width="1906" alt="image" src="https://github.com/user-attachments/assets/91b40650-d124-451c-8515-8837d9e1e107" />
2339

40+
### Add / Edit
41+
42+
On the flight schedule page, the user can create a new flight or edit an existing flight.
43+
44+
* Gate - The gate the flight will be docked at for departure; required.
45+
* Airline - The airline which owns the plane; required.
46+
* Flight Number - The number assigned to the flight; required and must be 4 digits or 4 digits and a letter.
47+
* Destination - The next destination for the flight; required and must be 3 letters.
48+
* Depart Time - The schedule time the plane will depart from the gate; required.
49+
* Sort Destination - The sort destination bags will be sorted too for the flight; required.
50+
51+
If the flight's airline, flight number and destination match another flight, the add or edit will be rejected by the server.
52+
2453
<img width="404" alt="image" src="https://github.com/user-attachments/assets/cd3dbf00-6797-4f05-b683-7fe5b8e49294" />
2554

2655
<img width="401" alt="image" src="https://github.com/user-attachments/assets/9953df72-ecef-45fb-9821-95964a7e45ba" />
2756

28-
<img width="399" alt="image" src="https://github.com/user-attachments/assets/cd04326b-4f16-4b9a-90e8-1f2a7a86b020" />
57+
### Delete
2958

59+
On the flight schedule page, the user can delete a flight. The user will be required to confirm the deletion or cancel. On confirmation, the flight will be deleted.
3060

61+
<img width="399" alt="image" src="https://github.com/user-attachments/assets/cd04326b-4f16-4b9a-90e8-1f2a7a86b020" />
3162

63+
## Edit Conflict
3264

65+
When two users are editing an airline or flight at the same time, whoever submits first will win; the other user will be told to try again.
3366

67+
<img width="400" height="188" alt="image" src="https://github.com/user-attachments/assets/f5c7e697-7ba7-4177-bd40-4be5d3a03a95" />
3468

TestProject/TestProject.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
<IsPackable>false</IsPackable>
99
<IsTestProject>true</IsTestProject>
10-
<Version>9.0.0</Version>
10+
<Version>9.0.1</Version>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
1414
<PackageReference Include="coverlet.collector" Version="6.0.4">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
18-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.11" />
18+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.12" />
1919
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2020
<PackageReference Include="xunit" Version="2.9.3" />
2121
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">

jmayer.example.aspreact.client/package-lock.json

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jmayer.example.aspreact.client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jmayer.example.aspreact.client",
33
"private": true,
4-
"version": "9.0.0",
4+
"version": "9.0.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

jmayer.example.aspreact.client/src/datalayers/AirlineDataLayer.jsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export function useAirlineDataLayer() {
2323
const [updateAirlineSuccess, setUpdateAirlineSuccess] = useState(false);
2424
const [updateAirlineValidationProblemDetails, setUpdateAirlineValidationProblemDetails] = useState(null);
2525

26+
//Constants for the status codes returned by the server.
27+
const BadRequestCode = 400;
28+
const NotFoundCode = 404;
29+
const ConflictCode = 409;
30+
const InternalServerError = 500;
31+
2632
//The function adds an airline to the server.
2733
//@param {object} airline The airline to add.
2834
const addAirline = (airline) => {
@@ -39,10 +45,10 @@ export function useAirlineDataLayer() {
3945
if (response.ok) {
4046
setAddAirlineSuccess(true);
4147
}
42-
else if (response.status === 400) {
48+
else if (response.status === BadRequestCode) {
4349
response.json().then(validationProblemDetails => setAddAirlineValidationProblemDetails(validationProblemDetails));
4450
}
45-
else if (response.status === 500) {
51+
else if (response.status === InternalServerError) {
4652
response.json().then(problemDetails => showError(problemDetails.detail));
4753
}
4854
else {
@@ -73,7 +79,7 @@ export function useAirlineDataLayer() {
7379
if (response.ok) {
7480
setDeleteAirlineSuccess(true);
7581
}
76-
else if (response.status === 500) {
82+
else if (response.status === NotFoundCode || response.status === InternalServerError) {
7783
response.json().then(problemDetails => showError(problemDetails.detail));
7884
}
7985
else {
@@ -107,10 +113,10 @@ export function useAirlineDataLayer() {
107113
if (response.ok) {
108114
setUpdateAirlineSuccess(true);
109115
}
110-
else if (response.status === 400) {
116+
else if (response.status === BadRequestCode) {
111117
response.json().then(validationProblemDetails => setUpdateAirlineValidationProblemDetails(validationProblemDetails));
112118
}
113-
else if (response.status == 409 || response.status === 500) {
119+
else if (response.status === NotFoundCode || response.status == ConflictCode || response.status === InternalServerError) {
114120
response.json().then(problemDetails => showError(problemDetails.detail));
115121
}
116122
else {

jmayer.example.aspreact.client/src/datalayers/FlightDataLayer.jsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ export function useFlightDataLayer() {
2727
const [updateFlightSuccess, setUpdateFlightSuccess] = useState(false);
2828
const [updateFlightValidationProblemDetails, setUpdateFlightValidationProblemDetails] = useState(null);
2929

30+
//Constants for the status codes returned by the server.
31+
const BadRequestCode = 400;
32+
const NotFoundCode = 404;
33+
const ConflictCode = 409;
34+
const InternalServerError = 500;
35+
3036
//The function adds a flight to the server.
3137
//@param {object} flight The flight to add.
3238
const addFlight = (flight) => {
@@ -45,10 +51,10 @@ export function useFlightDataLayer() {
4551
if (response.ok) {
4652
setAddFlightSuccess(true);
4753
}
48-
else if (response.status === 400) {
54+
else if (response.status === BadRequestCode) {
4955
response.json().then(validationProblemDetails => setAddFlightValidationProblemDetails(validationProblemDetails));
5056
}
51-
else if (response.status === 500) {
57+
else if (response.status === InternalServerError) {
5258
response.json().then(problemDetails => showError(problemDetails.detail));
5359
}
5460
else {
@@ -79,7 +85,7 @@ export function useFlightDataLayer() {
7985
if (response.ok) {
8086
setDeleteFlightSuccess(true);
8187
}
82-
else if (response.status === 500) {
88+
else if (response.status === NotFoundCode || response.status === InternalServerError) {
8389
response.json().then(problemDetails => showError(problemDetails.detail));
8490
}
8591
else {
@@ -125,10 +131,10 @@ export function useFlightDataLayer() {
125131
if (response.ok) {
126132
setUpdateFlightSuccess(true);
127133
}
128-
else if (response.status === 400) {
134+
else if (response.status === BadRequestCode) {
129135
response.json().then(validationProblemDetails => setUpdateFlightValidationProblemDetails(validationProblemDetails));
130136
}
131-
else if (response.status == 409 || response.status === 500) {
137+
else if (response.status === NotFoundCode || response.status == ConflictCode || response.status === InternalServerError) {
132138
response.json().then(problemDetails => showError(problemDetails.detail));
133139
}
134140
else {

0 commit comments

Comments
 (0)