Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/192452 note of visit #66

Merged
merged 5 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public record SupportProjectDto(int id,
DateTime? SavedAssessmentTemplateInSharePointDate,
bool? HasTalkToAdvisor,
bool? HasCompleteAssessmentTemplate,
bool? GiveTheAdviserTheNoteOfVisitTemplate,
bool? AskTheAdviserToSendYouTheirNotes,
DateTime? DateNoteOfVisitSavedInSharePoint,
IEnumerable<SupportProjectNote> notes
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class SupportProject : BaseAggregateRoot, IEntity<SupportProjectId>
{
private SupportProject() { }

Check warning on line 8 in src/Dfe.RegionalImprovementForStandardsAndExcellence.Domain/Entities/SupportProject/SupportProject.cs

View workflow job for this annotation

GitHub Actions / Build, Test and Analyse

Non-nullable property 'Id' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 8 in src/Dfe.RegionalImprovementForStandardsAndExcellence.Domain/Entities/SupportProject/SupportProject.cs

View workflow job for this annotation

GitHub Actions / Build, Test and Analyse

Non-nullable property 'SchoolName' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 8 in src/Dfe.RegionalImprovementForStandardsAndExcellence.Domain/Entities/SupportProject/SupportProject.cs

View workflow job for this annotation

GitHub Actions / Build, Test and Analyse

Non-nullable property 'SchoolUrn' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 8 in src/Dfe.RegionalImprovementForStandardsAndExcellence.Domain/Entities/SupportProject/SupportProject.cs

View workflow job for this annotation

GitHub Actions / Build, Test and Analyse

Non-nullable property 'Region' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 8 in src/Dfe.RegionalImprovementForStandardsAndExcellence.Domain/Entities/SupportProject/SupportProject.cs

View workflow job for this annotation

GitHub Actions / Build, Test and Analyse

Non-nullable property 'CreatedBy' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 8 in src/Dfe.RegionalImprovementForStandardsAndExcellence.Domain/Entities/SupportProject/SupportProject.cs

View workflow job for this annotation

GitHub Actions / Build, Test and Analyse

Non-nullable property 'LocalAuthority' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public SupportProject(
SupportProjectId id,
string schoolName,
Expand Down Expand Up @@ -80,7 +80,7 @@
public bool? HasShareEmailTemplateWithAdvisor { get; private set; }

public bool? RemindAdvisorToCopyRiseTeamWhenSentEmail { get; private set; }

public DateTime? AdviserVisitDate { get; private set; }

public DateTime? SavedAssessmentTemplateInSharePointDate { get; private set; }
Expand All @@ -89,7 +89,10 @@

public bool? HasCompleteAssessmentTemplate { get; private set; }

public bool ShowError { get; set; }

public bool? GiveTheAdviserTheNoteOfVisitTemplate { get; private set; }
public bool? AskTheAdviserToSendYouTheirNotes { get; private set; }
public DateTime? DateNoteOfVisitSavedInSharePoint { get; private set; }

#endregion

Expand Down Expand Up @@ -176,5 +179,14 @@
HasCompleteAssessmentTemplate = hasCompleteAssessmentTemplate;
}

public void SetNoteOfVisitDetails(bool? giveTheAdviserTheNoteOfVisitTemplate,
bool? askTheAdviserToSendYouTheirNotes,
DateTime? dateNoteOfVisitSavedInSharePoint)
{
GiveTheAdviserTheNoteOfVisitTemplate = giveTheAdviserTheNoteOfVisitTemplate;
AskTheAdviserToSendYouTheirNotes = askTheAdviserToSendYouTheirNotes;
DateNoteOfVisitSavedInSharePoint = dateNoteOfVisitSavedInSharePoint;
}

#endregion
}

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

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");
}
}
}
Loading
Loading