-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amend API responses for TRS alerts data model
- Loading branch information
Showing
43 changed files
with
628 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
TeachingRecordSystem/src/TeachingRecordSystem.Api/GlobalUsings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
global using AutoMapper; | ||
global using PostgresModels = TeachingRecordSystem.Core.DataStore.Postgres.Models; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...tem.Api/V3/Core/SharedModels/AlertInfo.cs → ...dSystem.Api/V3/Core/SharedModels/Alert.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
namespace TeachingRecordSystem.Api.V3.Core.SharedModels; | ||
|
||
public record AlertInfo | ||
public record Alert | ||
{ | ||
public required Guid AlertId { get; init; } | ||
public required AlertType AlertType { get; init; } | ||
public required string DqtSanctionCode { get; init; } | ||
public required DateOnly? StartDate { get; init; } | ||
public required DateOnly? EndDate { get; init; } | ||
} |
7 changes: 7 additions & 0 deletions
7
TeachingRecordSystem/src/TeachingRecordSystem.Api/V3/Core/SharedModels/AlertCategory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace TeachingRecordSystem.Api.V3.Core.SharedModels; | ||
|
||
public record AlertCategory | ||
{ | ||
public required Guid AlertCategoryId { get; init; } | ||
public required string Name { get; init; } | ||
} |
8 changes: 5 additions & 3 deletions
8
TeachingRecordSystem/src/TeachingRecordSystem.Api/V3/Core/SharedModels/AlertType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
namespace TeachingRecordSystem.Api.V3.Core.SharedModels; | ||
|
||
public enum AlertType | ||
public record AlertType | ||
{ | ||
Prohibition, | ||
// Only exposing Prohibitions for now | ||
public required Guid AlertTypeId { get; init; } | ||
public required AlertCategory AlertCategory { get; init; } | ||
public required string Name { get; init; } | ||
public required string DqtSanctionCode { get; init; } | ||
} |
16 changes: 15 additions & 1 deletion
16
TeachingRecordSystem/src/TeachingRecordSystem.Api/V3/V20240101/ApiModels/AlertInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
using TeachingRecordSystem.Api.V3.Core.SharedModels; | ||
|
||
namespace TeachingRecordSystem.Api.V3.V20240101.ApiModels; | ||
|
||
[AutoMap(typeof(Core.SharedModels.AlertInfo))] | ||
[AutoMap(typeof(Alert), TypeConverter = typeof(AlertInfoTypeConverter))] | ||
public record AlertInfo | ||
{ | ||
public required AlertType AlertType { get; init; } | ||
public required string DqtSanctionCode { get; init; } | ||
public required DateOnly? StartDate { get; init; } | ||
public required DateOnly? EndDate { get; init; } | ||
} | ||
|
||
public class AlertInfoTypeConverter : ITypeConverter<Alert, AlertInfo> | ||
{ | ||
public AlertInfo Convert(Alert source, AlertInfo destination, ResolutionContext context) => | ||
new() | ||
{ | ||
AlertType = AlertType.Prohibition, | ||
DqtSanctionCode = source.AlertType.DqtSanctionCode, | ||
StartDate = source.StartDate, | ||
EndDate = source.EndDate, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.