-
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.
Merge pull request #66 from DFE-Digital/feature/192452-note-of-visit
Feature/192452 note of visit
- Loading branch information
Showing
18 changed files
with
698 additions
and
22 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ellence.Application/SupportProject/Commands/UpdateSupportProject/SetNoteOfVisitDetails.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,37 @@ | ||
using Dfe.RegionalImprovementForStandardsAndExcellence.Domain.Interfaces.Repositories; | ||
using Dfe.RegionalImprovementForStandardsAndExcellence.Domain.ValueObjects; | ||
using Dfe.RegionalImprovementForStandardsAndExcellence.Utils; | ||
using MediatR; | ||
|
||
namespace Dfe.RegionalImprovementForStandardsAndExcellence.Application.SupportProject.Commands.UpdateSupportProject; | ||
|
||
public class SetNoteOfVisitDetails | ||
{ | ||
public record SetNoteOfVisitDetailsCommand(SupportProjectId SupportProjectId, | ||
bool? giveTheAdviserTheNoteOfVisitTemplate, | ||
bool? askTheAdviserToSendYouTheirNotes, | ||
DateTime? dateNoteOfVisitSavedInSharePoint) : IRequest<bool>; | ||
|
||
public class SetNoteOfVisitDetailsCommandHandler(ISupportProjectRepository supportProjectRepository, IDateTimeProvider _dateTimeProvider) | ||
: IRequestHandler<SetNoteOfVisitDetailsCommand, bool> | ||
{ | ||
public async Task<bool> Handle(SetNoteOfVisitDetailsCommand request, CancellationToken cancellationToken) | ||
{ | ||
|
||
var supportProject = await supportProjectRepository.FindAsync(x => x.Id == request.SupportProjectId, cancellationToken); | ||
|
||
if (supportProject is null) | ||
{ | ||
return false; | ||
} | ||
|
||
supportProject.SetNoteOfVisitDetails(request.giveTheAdviserTheNoteOfVisitTemplate, | ||
request.askTheAdviserToSendYouTheirNotes, | ||
request.dateNoteOfVisitSavedInSharePoint); | ||
|
||
await supportProjectRepository.UpdateAsync(supportProject); | ||
|
||
return true; | ||
} | ||
} | ||
} |
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
226 changes: 226 additions & 0 deletions
226
...Excellence.Infrastructure/Migrations/20250122165249_set-note-of-visit-details.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
85 changes: 85 additions & 0 deletions
85
...ndardsAndExcellence.Infrastructure/Migrations/20250122165249_set-note-of-visit-details.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,85 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class setnoteofvisitdetails : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AddColumn<bool>( | ||
name: "AskTheAdviserToSendYouTheirNotes", | ||
schema: "RISE", | ||
table: "SupportProject", | ||
type: "bit", | ||
nullable: true) | ||
.Annotation("SqlServer:IsTemporal", true) | ||
.Annotation("SqlServer:TemporalHistoryTableName", "SupportProjectHistory") | ||
.Annotation("SqlServer:TemporalHistoryTableSchema", "RISE") | ||
.Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd") | ||
.Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart"); | ||
|
||
migrationBuilder.AddColumn<DateTime>( | ||
name: "DateNoteOfVisitSavedInSharePoint", | ||
schema: "RISE", | ||
table: "SupportProject", | ||
type: "datetime2", | ||
nullable: true) | ||
.Annotation("SqlServer:IsTemporal", true) | ||
.Annotation("SqlServer:TemporalHistoryTableName", "SupportProjectHistory") | ||
.Annotation("SqlServer:TemporalHistoryTableSchema", "RISE") | ||
.Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd") | ||
.Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart"); | ||
|
||
migrationBuilder.AddColumn<bool>( | ||
name: "GiveTheAdviserTheNoteOfVisitTemplate", | ||
schema: "RISE", | ||
table: "SupportProject", | ||
type: "bit", | ||
nullable: true) | ||
.Annotation("SqlServer:IsTemporal", true) | ||
.Annotation("SqlServer:TemporalHistoryTableName", "SupportProjectHistory") | ||
.Annotation("SqlServer:TemporalHistoryTableSchema", "RISE") | ||
.Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd") | ||
.Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropColumn( | ||
name: "AskTheAdviserToSendYouTheirNotes", | ||
schema: "RISE", | ||
table: "SupportProject") | ||
.Annotation("SqlServer:IsTemporal", true) | ||
.Annotation("SqlServer:TemporalHistoryTableName", "SupportProjectHistory") | ||
.Annotation("SqlServer:TemporalHistoryTableSchema", "RISE") | ||
.Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd") | ||
.Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "DateNoteOfVisitSavedInSharePoint", | ||
schema: "RISE", | ||
table: "SupportProject") | ||
.Annotation("SqlServer:IsTemporal", true) | ||
.Annotation("SqlServer:TemporalHistoryTableName", "SupportProjectHistory") | ||
.Annotation("SqlServer:TemporalHistoryTableSchema", "RISE") | ||
.Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd") | ||
.Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "GiveTheAdviserTheNoteOfVisitTemplate", | ||
schema: "RISE", | ||
table: "SupportProject") | ||
.Annotation("SqlServer:IsTemporal", true) | ||
.Annotation("SqlServer:TemporalHistoryTableName", "SupportProjectHistory") | ||
.Annotation("SqlServer:TemporalHistoryTableSchema", "RISE") | ||
.Annotation("SqlServer:TemporalPeriodEndColumnName", "PeriodEnd") | ||
.Annotation("SqlServer:TemporalPeriodStartColumnName", "PeriodStart"); | ||
} | ||
} | ||
} |
Oops, something went wrong.