Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2f3ebd1
Removed Template Weather
jmayer913 Sep 23, 2024
baeadc9
Added PrimeReact
jmayer913 Sep 23, 2024
40a61a7
Added layout & home page
jmayer913 Oct 1, 2024
f2d94a9
Moved components; added flight schedule component
jmayer913 Oct 2, 2024
4d735ef
Switched to router for navigation; renaming
jmayer913 Oct 3, 2024
73d6f88
Added airline page & airline objects
jmayer913 Oct 4, 2024
b5ebfcc
Fixed the proxy to work with api calls
jmayer913 Oct 4, 2024
737d6e0
Added a workflow
jmayer913 Oct 4, 2024
707c785
Added functionality to the airline data table
jmayer913 Oct 9, 2024
00c89f9
Added airline deletion
jmayer913 Oct 9, 2024
13971bb
Added Airline Add/Edit Dialog
jmayer913 Oct 17, 2024
2687955
Added uniqueness checks for airlines
jmayer913 Oct 18, 2024
68f9f7d
Started airline server side unit tests
jmayer913 Oct 18, 2024
d0056df
Finished airline unit tests
jmayer913 Oct 22, 2024
2a572bd
Added error dialog and handling
jmayer913 Oct 22, 2024
6d9bf5b
Refactored the menu open/close
jmayer913 Oct 22, 2024
7eca6af
Added gate & airline server side objects
jmayer913 Nov 5, 2024
dd0ccfc
Updated Packages
jmayer913 Nov 14, 2024
fe34044
Added unit tests for the gates
jmayer913 Nov 14, 2024
dc15a29
Added flight unit tests
jmayer913 Nov 22, 2024
afb518a
Added flight unit test
jmayer913 Nov 24, 2024
c043d56
Added cascade delete when an airline is deleted
jmayer913 Dec 11, 2024
9f8b041
Updated Packages
jmayer913 Dec 11, 2024
024d39d
Added sort destinations; simplified gates
jmayer913 Dec 12, 2024
b78f695
Added Sort Destination Unit Tests
jmayer913 Dec 13, 2024
fbfcb57
Added more unit tests
jmayer913 Dec 13, 2024
a14efa8
Updated Packages
jmayer913 Dec 24, 2024
b7d5447
Add data annotations unit tests for airlines
jmayer913 Dec 30, 2024
f80f762
Added data annotation unit tests for flights
jmayer913 Dec 30, 2024
6db30e3
Added flight page
jmayer913 Dec 30, 2024
fcac7d0
Switched to an error context to reduce states
jmayer913 Dec 30, 2024
a603fe3
Added delete dialog for flights
jmayer913 Dec 30, 2024
0294fb8
Added flight add/edit dialog
jmayer913 Jan 2, 2025
3ae6d20
Created an airline data layer
jmayer913 Jan 2, 2025
4d8a074
Moved ErrorDialog to App
jmayer913 Jan 2, 2025
ab4a8af
Created flight data layer
jmayer913 Jan 2, 2025
08cc7c3
Simplified server side validation handling
jmayer913 Jan 2, 2025
bf8dfeb
Removed test code
jmayer913 Jan 2, 2025
d533329
Updated the comments
jmayer913 Jan 2, 2025
0bc5cf1
Removed data table selection options; not needed
jmayer913 Jan 3, 2025
5b622ce
Generate different destinations for example data
jmayer913 Jan 3, 2025
fb82c21
Updated a package
jmayer913 Jan 3, 2025
847d90d
Added text to the home page
jmayer913 Jan 11, 2025
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
29 changes: 29 additions & 0 deletions .github/workflows/mainworkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: MainWorkflow

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --verbosity normal
59 changes: 59 additions & 0 deletions JMayer.Example.ASPReact.Server/Airlines/Airline.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using JMayer.Data.Data;
using System.ComponentModel.DataAnnotations;

namespace JMayer.Example.ASPReact.Server.Airlines;

/// <summary>
/// The class represents an airline and its codes.
/// </summary>
public class Airline : UserEditableDataObject
{
/// <summary>
/// The property gets/sets the IATA code assigned by the IATA organization.
/// </summary>
[Required]
[RegularExpression("^[A-Z0-9]{2}$", ErrorMessage = "The IATA must be 2 alphanumeric characters; letters must be capitalized.")]
public string IATA { get;set; } = string.Empty;

/// <summary>
/// The property gets/sets the ICAO code assigned by the International Aviation Organization.
/// </summary>
[RegularExpression("^[A-Z]{3}$", ErrorMessage = "The ICAO must be 3 capital letters.")]
public string ICAO { get; set; } = string.Empty;

/// <summary>
/// The property gets/sets the number code assigned by the IATA organization.
/// </summary>
[Required]
[RegularExpression("^\\d{3}$", ErrorMessage = "The number code must be 3 digits.")]
public string NumberCode { get; set; } = ZeroNumberCode;

/// <summary>
/// The constant for the zero number code.
/// </summary>
public const string ZeroNumberCode = "000";

/// <summary>
/// The default constructor.
/// </summary>
public Airline() { }

/// <summary>
/// The copy constructor.
/// </summary>
/// <param name="copy">The copy.</param>
public Airline(Airline copy) => MapProperties(copy);

/// <inheritdoc/>
public override void MapProperties(DataObject dataObject)
{
base.MapProperties(dataObject);

if (dataObject is Airline airline)
{
IATA = airline.IATA;
ICAO = airline.ICAO;
NumberCode = airline.NumberCode;
}
}
}
15 changes: 15 additions & 0 deletions JMayer.Example.ASPReact.Server/Airlines/AirlineController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using JMayer.Web.Mvc.Controller;
using Microsoft.AspNetCore.Mvc;

namespace JMayer.Example.ASPReact.Server.Airlines;

/// <summary>
/// The class manages HTTP requests for CRUD operations associated with an airline in a database.
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class AirlineController : UserEditableController<Airline, IAirlineDataLayer>
{
/// <inheritdoc/>
public AirlineController(IAirlineDataLayer dataLayer, ILogger<AirlineController> logger) : base(dataLayer, logger) { }
}
31 changes: 31 additions & 0 deletions JMayer.Example.ASPReact.Server/Airlines/AirlineDataLayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using JMayer.Data.Database.DataLayer.MemoryStorage;
using System.ComponentModel.DataAnnotations;

namespace JMayer.Example.ASPReact.Server.Airlines;

/// <summary>
/// The class manages CRUD interactions with the database for an airline.
/// </summary>
public class AirlineDataLayer : UserEditableDataLayer<Airline>, IAirlineDataLayer
{
/// <inheritdoc/>
/// <remarks>
/// Overriden to check the ICAO is unique and the number code is unique (expect for 000).
/// </remarks>
public override async Task<List<ValidationResult>> ValidateAsync(Airline dataObject, CancellationToken cancellationToken = default)
{
List<ValidationResult> validationResults = await base.ValidateAsync(dataObject, cancellationToken);

if (dataObject.ICAO != null && await ExistAsync(obj => obj.Integer64ID != dataObject.Integer64ID && obj.ICAO == dataObject.ICAO, cancellationToken) == true)
{
validationResults.Add(new ValidationResult("The ICAO must be unique.", [nameof(Airline.ICAO)]));
}

if (dataObject.NumberCode != Airline.ZeroNumberCode && await ExistAsync(obj => obj.Integer64ID != dataObject.Integer64ID && obj.NumberCode == dataObject.NumberCode, cancellationToken) == true)
{
validationResults.Add(new ValidationResult("The number code must be unique unless the code is 000.", [nameof(Airline.NumberCode)]));
}

return validationResults;
}
}
63 changes: 63 additions & 0 deletions JMayer.Example.ASPReact.Server/Airlines/AirlineEqualityComparer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System.Diagnostics.CodeAnalysis;

namespace JMayer.Example.ASPReact.Server.Airlines;

/// <summary>
/// The class manages comparing two Airline objects.
/// </summary>
public class AirlineEqualityComparer : IEqualityComparer<Airline>
{
/// <summary>
/// Excludes the CreatedOn property from the equals check.
/// </summary>
private readonly bool _excludeCreatedOn;

/// <summary>
/// Excludes the ID property from the equals check.
/// </summary>
private readonly bool _excludeID;

/// <summary>
/// Excludes the LastEditedOn property from the equals check.
/// </summary>
private readonly bool _excludeLastEditedOn;

/// <summary>
/// The default constructor.
/// </summary>
public AirlineEqualityComparer() { }

/// <summary>
/// The property constructor.
/// </summary>
/// <param name="excludeCreatedOn">Excludes the CreatedOn property from the equals check.</param>
/// <param name="excludeID">Excludes the ID property from the equals check.</param>
/// <param name="excludeLastEditedOn">Excludes the LastEditedOn property from the equals check.</param>
public AirlineEqualityComparer(bool excludeCreatedOn, bool excludeID, bool excludeLastEditedOn)
{
_excludeCreatedOn = excludeCreatedOn;
_excludeID = excludeID;
_excludeLastEditedOn = excludeLastEditedOn;
}

/// <inheritdoc/>
public bool Equals(Airline? x, Airline? y)
{
if (x == null || y == null)
{
return false;
}

return (_excludeCreatedOn || x.CreatedOn == y.CreatedOn)
&& x.Description == y.Description
&& x.IATA == y.IATA
&& x.ICAO == y.ICAO
&& (_excludeID || x.Integer64ID == y.Integer64ID)
&& (_excludeLastEditedOn || x.LastEditedBy == y.LastEditedBy)
&& x.Name == y.Name
&& x.NumberCode == y.NumberCode;
}

/// <inheritdoc/>
public int GetHashCode([DisallowNull] Airline obj) => obj.GetHashCode();
}
10 changes: 10 additions & 0 deletions JMayer.Example.ASPReact.Server/Airlines/IAirlineDataLayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using JMayer.Data.Database.DataLayer;

namespace JMayer.Example.ASPReact.Server.Airlines;

/// <summary>
/// The interface for interacting with an airline collection in a database using CRUD operations.
/// </summary>
public interface IAirlineDataLayer : IUserEditableDataLayer<Airline>
{
}

This file was deleted.

Loading