Skip to content

Commit

Permalink
change: API: rename Key to AppKey (#844)
Browse files Browse the repository at this point in the history
Co-authored-by: kjetilhau <[email protected]>
  • Loading branch information
kjetilhau and kjetilhau authored Oct 31, 2024
1 parent ba66263 commit d814023
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/pr-844-2153430938.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

---
"fusion-project-portal": minor
---
Renames Key to AppKey in ApiPortallApp and ApiPortalOnboardedApp models
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ApiAddContextAppToPortalRequestValidator()
RuleFor(x => x.AppKey)
.NotEmpty()
.NotContainScriptTag()
.WithMessage("App Key required");
.WithMessage("AppKey required");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ApiAddGlobalAppToPortalRequestValidator()
RuleFor(x => x.AppKey)
.NotEmpty()
.NotContainScriptTag()
.WithMessage("App Key required");
.WithMessage("AppKey required");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public ApiPortalApp()
}
public ApiPortalApp(PortalAppDto portalAppDto)
{
Key = portalAppDto.OnboardedApp.AppKey;
AppKey = portalAppDto.OnboardedApp.AppKey;
ContextTypes = portalAppDto.OnboardedApp.ContextTypes.Select(x => new ApiContextType(x)).ToList();
AppManifest = portalAppDto.OnboardedApp.AppInformation != null ? new ApiFusionApp(portalAppDto.OnboardedApp.AppInformation) : null;
}

public string Key { get; set; }
public string AppKey { get; set; }
public IList<ApiContextType> ContextTypes { get; set; }
public ApiFusionApp? AppManifest { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public ApiPortalOnboardedApp()

public ApiPortalOnboardedApp(PortalOnboardedAppDto portalOnboardedAppDto)
{
Key = portalOnboardedAppDto.OnboardedApp.AppKey;
AppKey = portalOnboardedAppDto.OnboardedApp.AppKey;
ContextTypes = portalOnboardedAppDto.OnboardedApp.ContextTypes.Select(x => x.ContextTypeKey).ToList();
ContextIds = portalOnboardedAppDto.ContextIds;
IsActive = portalOnboardedAppDto.IsActive;
Expand All @@ -19,7 +19,7 @@ public ApiPortalOnboardedApp(PortalOnboardedAppDto portalOnboardedAppDto)
AppManifest = portalOnboardedAppDto.OnboardedApp.AppInformation != null ? new ApiFusionApp(portalOnboardedAppDto.OnboardedApp.AppInformation) : null;
}

public string Key { get; set; }
public string AppKey { get; set; }
public IList<string> ContextTypes { get; set; }
public IList<Guid> ContextIds { get; set; }
public bool IsActive { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void AssertPortalAppValues(ApiPortalApp? portalAll)
Assert.Fail();
}

Assert.IsNotNull(portalAll.Key);
Assert.IsNotNull(portalAll.AppKey);
}

public static void AssertOnboardedAppValues(ApiOnboardedApp? onboardedApp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,13 @@ public async Task Delete_PortalApp_AsAdministrator_ShouldReturnOk()
var appToDelete = apps.First();

// Act
var response = await DeletePortalApp(portalToTest.Id, appToDelete.Key, UserType.Administrator);
var response = await DeletePortalApp(portalToTest.Id, appToDelete.AppKey, UserType.Administrator);

// Assert
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);

// Verify the app is actually deleted
var deletedApp = await AssertGetPortalApp(portalToTest.Id, appToDelete.Key, UserType.Authenticated, HttpStatusCode.NotFound);
var deletedApp = await AssertGetPortalApp(portalToTest.Id, appToDelete.AppKey, UserType.Authenticated, HttpStatusCode.NotFound);
Assert.IsNull(deletedApp);
}

Expand All @@ -526,7 +526,7 @@ public async Task Delete_PortalApp_AsAuthenticatedUser_ShouldReturnForbidden()
var appToDelete = apps.First();

// Act
var response = await DeletePortalApp(portalToTest.Id, appToDelete.Key, UserType.Authenticated);
var response = await DeletePortalApp(portalToTest.Id, appToDelete.AppKey, UserType.Authenticated);

// Assert
Assert.AreEqual(HttpStatusCode.Forbidden, response.StatusCode);
Expand All @@ -548,7 +548,7 @@ public async Task Delete_PortalApp_AsAnonymousUser_ShouldReturnUnauthorized()
var appToDelete = apps.First();

// Act
var response = await DeletePortalApp(portalToTest.Id, appToDelete.Key, UserType.Anonymous);
var response = await DeletePortalApp(portalToTest.Id, appToDelete.AppKey, UserType.Anonymous);

// Assert
Assert.AreEqual(HttpStatusCode.Unauthorized, response.StatusCode);
Expand Down

0 comments on commit d814023

Please sign in to comment.