Skip to content
Open
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
Expand Up @@ -46,7 +46,6 @@ public void Configure(EntityTypeBuilder<ApplicationUser> builder)
builder.HasIndex(e => e.OneLoginAuthenticationSchemeName).IsUnique().HasDatabaseName(ApplicationUser.OneLoginAuthenticationSchemeNameUniqueIndexName)
.HasFilter("one_login_authentication_scheme_name is not null");
builder.HasIndex(e => e.ClientId).IsUnique().HasDatabaseName(ApplicationUser.ClientIdUniqueIndexName).HasFilter("client_id is not null");
builder.Property(e => e.ShortName).HasMaxLength(ApplicationUser.ShortNameMaxLength);

builder.HasData(new ApplicationUser { UserId = ApplicationUser.NpqApplicationUserGuid, Name = "NPQ", Active = true });
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TeachingRecordSystem.Core.DataStore.Postgres.Migrations
{
/// <inheritdoc />
public partial class RemoveApplicationUserShortName : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "short_name",
table: "users");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "short_name",
table: "users",
type: "character varying(25)",
maxLength: 25,
nullable: true);

migrationBuilder.UpdateData(
table: "users",
keyColumn: "user_id",
keyValue: new Guid("0f18f1ec-a102-4023-843f-1cadef3e6e14"),
column: "short_name",
value: null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20772,11 +20772,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("varchar[]")
.HasColumnName("redirect_uris");

b.Property<string>("ShortName")
.HasMaxLength(25)
.HasColumnType("character varying(25)")
.HasColumnName("short_name");

b.HasIndex("ClientId")
.IsUnique()
.HasDatabaseName("ix_users_client_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class ApplicationUser : UserBase
public const int ClientSecretMaxLength = 200;
public const int ClientSecretMinLength = 16;
public const int OneLoginClientIdMaxLength = 50;
public const int ShortNameMaxLength = 25;
public const string NameUniqueIndexName = "ix_users_application_user_name";
public const string ClientIdUniqueIndexName = "ix_users_client_id";
public const string OneLoginAuthenticationSchemeNameUniqueIndexName = "ix_users_one_login_authentication_scheme_name";
Expand All @@ -55,7 +54,6 @@ public class ApplicationUser : UserBase
public string? OneLoginAuthenticationSchemeName { get; set; }
public string? OneLoginRedirectUriPath { get; set; }
public string? OneLoginPostLogoutRedirectUriPath { get; set; }
public string? ShortName { get; set; }

[MemberNotNull(
nameof(OneLoginClientId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ public enum ApplicationUserUpdatedEventChanges
ClientId = 1 << 8,
ClientSecret = 1 << 9,
RedirectUris = 1 << 10,
PostLogoutRedirectUris = 1 << 11,
ShortName = 1 << 12
PostLogoutRedirectUris = 1 << 11
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public record ApplicationUser
public string? OneLoginAuthenticationSchemeName { get; init; }
public string? OneLoginRedirectUriPath { get; init; }
public string? OneLoginPostLogoutRedirectUriPath { get; init; }
public string? ShortName { get; init; }

public static ApplicationUser FromModel(DataStore.Postgres.Models.ApplicationUser user) => new()
{
Expand All @@ -32,6 +31,5 @@ public record ApplicationUser
OneLoginAuthenticationSchemeName = user.OneLoginAuthenticationSchemeName,
OneLoginRedirectUriPath = user.OneLoginRedirectUriPath,
OneLoginPostLogoutRedirectUriPath = user.OneLoginPostLogoutRedirectUriPath,
ShortName = user.ShortName
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table trs_users drop column short_name

Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<None Remove="Services\DqtReporting\Migrations\0098_RemoveITRForeignKey.sql" />
<None Remove="Services\DqtReporting\Migrations\0099_Users.sql" />
<None Remove="Services\DqtReporting\Migrations\0100_ProcessTimestamps.sql" />
<None Remove="Services\DqtReporting\Migrations\0101_RemoveUserShortName.sql" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -264,6 +265,7 @@
<EmbeddedResource Include="Services\DqtReporting\Migrations\0098_RemoveITRForeignKey.sql" />
<EmbeddedResource Include="Services\DqtReporting\Migrations\0099_Users.sql" />
<EmbeddedResource Include="Services\DqtReporting\Migrations\0100_ProcessTimestamps.sql" />
<EmbeddedResource Include="Services\DqtReporting\Migrations\0101_RemoveUserShortName.sql" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
<govuk-input-label class="govuk-label--m">Name</govuk-input-label>
</govuk-input>

<govuk-input for="ShortName" input-class="govuk-input--width-10">
<govuk-input-label class="govuk-label--m">Short name</govuk-input-label>
</govuk-input>

<govuk-button type="submit">Save</govuk-button>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ public class IndexModel(TrsDbContext dbContext, SupportUiLinkGenerator linkGener
[MaxLength(UserBase.NameMaxLength, ErrorMessage = "Name must be 200 characters or less")]
public string? Name { get; set; }

[BindProperty]
[MaxLength(ApplicationUser.ShortNameMaxLength, ErrorMessage = "Short name must be 25 characters or less")]
public string? ShortName { get; set; }

public void OnGet()
{
}
Expand All @@ -36,8 +32,7 @@ public async Task<IActionResult> OnPostAsync()
{
ApiRoles = [],
Name = Name!,
UserId = Guid.NewGuid(),
ShortName = ShortName
UserId = Guid.NewGuid()
};

dbContext.ApplicationUsers.Add(newUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
<govuk-input-label class="govuk-label--m">Name</govuk-input-label>
</govuk-input>

<govuk-input for="ShortName" input-class="govuk-input--width-10">
<govuk-input-label class="govuk-label--m">Short name</govuk-input-label>
</govuk-input>

<govuk-checkboxes for="ApiRoles">
<govuk-checkboxes-fieldset>
<govuk-checkboxes-fieldset-legend class="govuk-fieldset__legend--m">API roles</govuk-checkboxes-fieldset-legend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ public class IndexModel(TrsDbContext dbContext, SupportUiLinkGenerator linkGener
[MaxLength(UserBase.NameMaxLength, ErrorMessage = "Name must be 200 characters or less")]
public string? Name { get; set; }

[BindProperty]
[MaxLength(ApplicationUser.ShortNameMaxLength, ErrorMessage = "Short name must be 25 characters or less")]
public string? ShortName { get; set; }

public string[]? ApiRoles { get; set; }

[BindNever]
Expand Down Expand Up @@ -90,7 +86,6 @@ public void OnGet()
OneLoginPrivateKeyPem = _user.OneLoginPrivateKeyPem;
OneLoginRedirectUriPath = _user.OneLoginRedirectUriPath;
OneLoginPostLogoutRedirectUriPath = _user.OneLoginPostLogoutRedirectUriPath;
ShortName = _user.ShortName;
}

public async Task<IActionResult> OnPostAsync()
Expand Down Expand Up @@ -164,7 +159,6 @@ key is nameof(ClientId) or nameof(ClientSecret) or nameof(RedirectUris) or nameo

var changes = ApplicationUserUpdatedEventChanges.None |
(Name != _user!.Name ? ApplicationUserUpdatedEventChanges.Name : 0) |
(ShortName != _user!.ShortName ? ApplicationUserUpdatedEventChanges.ShortName : 0) |
(!new HashSet<string>(_user.ApiRoles ?? []).SetEquals(new HashSet<string>(newApiRoles)) ? ApplicationUserUpdatedEventChanges.ApiRoles : 0) |
(IsOidcClient != _user.IsOidcClient ? ApplicationUserUpdatedEventChanges.IsOidcClient : 0);

Expand All @@ -187,7 +181,6 @@ key is nameof(ClientId) or nameof(ClientSecret) or nameof(RedirectUris) or nameo
var oldApplicationUser = EventModels.ApplicationUser.FromModel(_user);

_user.Name = Name!;
_user.ShortName = ShortName;
_user.ApiRoles = newApiRoles;
_user.IsOidcClient = IsOidcClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ public async Task<IActionResult> OnGetAsync()
e.payload as event_payload,
u.name as trs_user_name,
e.payload #>> Array['RaisedBy','DqtUserName'] as dqt_user_name,
a.name as application_user_name,
a.short_name as application_user_short_name
a.name as application_user_name
FROM
events as e
LEFT JOIN
Expand Down Expand Up @@ -206,7 +205,6 @@ private TimelineItem MapTimelineEvent(EventWithUser eventWithUser)
ApplicationUserInfo? applicationUser = eventWithUser.ApplicationUserName == null ? null : new()
{
Name = eventWithUser.ApplicationUserName,
ShortName = eventWithUser.ApplicationUserShortName ?? eventWithUser.ApplicationUserName
};

var timelineEventType = typeof(TimelineEvent<>).MakeGenericType(@event.GetType()!);
Expand All @@ -232,6 +230,5 @@ private record EventWithUser
public required string? TrsUserName { get; init; }
public required string? DqtUserName { get; init; }
public required string? ApplicationUserName { get; init; }
public required string? ApplicationUserShortName { get; init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ else
{
@foreach (var professionalStatus in Model.ProfessionalStatuses)
{
var statusTitle = ProfessionalStatusStatusRegistry.GetTitle(professionalStatus.Status).ToUpper();
var statusColor = professionalStatus.Status switch {
RouteToProfessionalStatusStatus.Holds => "green",
RouteToProfessionalStatusStatus.InTraining => "light-blue",
_ => "red"
};
var cardTitle = $"{professionalStatus.RouteToProfessionalStatusType?.ProfessionalStatusType.GetDisplayName()}";

<govuk-summary-card data-testid="[email protected]">
Expand All @@ -48,9 +42,18 @@ else
<govuk-summary-list-row>
<govuk-summary-list-row-key>Status</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
<govuk-tag class="govuk-tag--@statusColor">
@statusTitle
</govuk-tag>
@{
var statusColor = professionalStatus.Status switch {
RouteToProfessionalStatusStatus.Holds => TagColor.Green,
RouteToProfessionalStatusStatus.InTraining => TagColor.LightBlue,
RouteToProfessionalStatusStatus.Withdrawn => TagColor.Grey,
RouteToProfessionalStatusStatus.Failed => TagColor.Red,
_ => TagColor.Turquoise
};
}
<tag color="@statusColor">
@ProfessionalStatusStatusRegistry.GetTitle(professionalStatus.Status)
</tag>
</govuk-summary-list-row-value>
</govuk-summary-list-row>
@if (QuestionDriverHelper.FieldRequired(professionalStatus.RouteToProfessionalStatusType!.TrainingStartDateRequired, professionalStatus.Status.GetStartDateRequirement()) != FieldRequirement.NotApplicable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<govuk-summary-list-row-value>
@if (applicationUser is not null)
{
<colored-tag>@applicationUser.ShortName</colored-tag>
<tag color="TagColor.Auto">@applicationUser.Name</tag>
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ namespace TeachingRecordSystem.SupportUi.Pages.Persons.PersonDetail.Timeline.Eve
public record ApplicationUserInfo
{
public required string Name { get; init; }
public required string ShortName { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<govuk-summary-list-row-value>
@if (applicationUser is not null)
{
<colored-tag>@applicationUser.ShortName</colored-tag>
<tag color="TagColor.Auto">@applicationUser.Name</tag>
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,13 @@
<govuk-summary-list-row>
<govuk-summary-list-row-key>Status</govuk-summary-list-row-key>
<govuk-summary-list-row-value use-empty-fallback>
@if (Model.IsActive == true)
@if (Model.IsActive == false)
{
<govuk-tag class="govuk-tag--green">
ACTIVE
</govuk-tag>
<tag color="TagColor.Grey">Deactivated</tag>
}

@if (Model.IsActive == false)
else
{
<govuk-tag class="govuk-tag--red">
DEACTIVATED
</govuk-tag>
<tag color="TagColor.Green">Active</tag>
}
</govuk-summary-list-row-value>
</govuk-summary-list-row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</th>
<td class="govuk-table__cell" data-testid="email">@result.EmailAddress</td>
<td class="govuk-table__cell" data-testid="requested-on">@result.CreatedOn.ToString(UiDefaults.DateOnlyDisplayFormat)</td>
<td class="govuk-table__cell" data-testid="source"><colored-tag>@result.Source</colored-tag></td>
<td class="govuk-table__cell" data-testid="source"><tag color="TagColor.Auto">@result.SourceApplicationName</tag></td>
</tr>
}
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public async Task<IActionResult> OnGetAsync()
t.TrnRequestMetadata!.LastName!,
t.TrnRequestMetadata!.EmailAddress,
t.CreatedOn,
t.TrnRequestMetadata.ApplicationUser!.Name,
t.TrnRequestMetadata.ApplicationUser.ShortName))
t.TrnRequestMetadata.ApplicationUser!.Name))
.GetPageAsync(PageNumber, TasksPerPage);

Pagination = PaginationViewModel.Create(
Expand All @@ -60,9 +59,5 @@ public record Result(
string LastName,
string? EmailAddress,
DateTime CreatedOn,
string SourceApplicationName,
string? SourceApplicationShortName)
{
public string Source => !string.IsNullOrEmpty(SourceApplicationShortName) ? SourceApplicationShortName : SourceApplicationName;
}
string SourceApplicationName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<govuk-summary-list-row-value>
@foreach (var tag in tags)
{
<govuk-tag>@tag</govuk-tag>
<tag>@tag</tag>
}
</govuk-summary-list-row-value>
</govuk-summary-list-row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,22 @@

@if (result.Duplicate == true)
{
<span class="govuk-tag--orange govuk-!-static-padding-1">Duplicate</span>
<tag color="TagColor.Orange" class="govuk-!-static-padding-1">Duplicate</tag>
}
</td>
<td class="govuk-table__cell"
data-testid="integration-transaction-record:@result.IntegrationTransactionRecordId:status">
@if (result.Status == IntegrationTransactionRecordStatus.Success)
{
<span class="govuk-tag--green govuk-!-static-padding-1">@result.Status.GetDisplayName()</span>
<tag color="TagColor.Green" class="govuk-!-static-padding-1">@result.Status.GetDisplayName()</tag>
}
else @if (result.Status == IntegrationTransactionRecordStatus.Warning)
{
<span class="govuk-tag--yellow govuk-!-static-padding-1">@result.Status.GetDisplayName()</span>
<tag color="TagColor.Yellow" class="govuk-!-static-padding-1">@result.Status.GetDisplayName()</tag>
}
else @if (result.Status == IntegrationTransactionRecordStatus.Failure)
{
<span class="govuk-tag--red govuk-!-static-padding-1">@result.Status.GetDisplayName()</span>
<tag color="TagColor.Red" class="govuk-!-static-padding-1">@result.Status.GetDisplayName()</tag>
}
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@
data-testid="integration-transaction:@result.IntegrationTransactionId:importstatus">
@if (result.ImportStatus == IntegrationTransactionImportStatus.Success)
{
<span class="govuk-tag--green govuk-!-static-padding-1">@result.ImportStatus.GetDisplayName()</span>
<tag color="TagColor.Green" class="govuk-!-static-padding-1">@result.ImportStatus.GetDisplayName()</tag>
}
else @if (result.ImportStatus == IntegrationTransactionImportStatus.InProgress)
{
<span class="govuk-tag--light-blue govuk-!-static-padding-1">@result.ImportStatus.GetDisplayName()</span>
<tag color="TagColor.Blue" class="govuk-!-static-padding-1">@result.ImportStatus.GetDisplayName()</tag>
}
else
{
<span class="govuk-tag--red govuk-!-static-padding-1">@result.ImportStatus.GetDisplayName()</span>
<tag color="TagColor.Red" class="govuk-!-static-padding-1">@result.ImportStatus.GetDisplayName()</tag>
}
</td>

Expand Down
Loading