refactor: v2 API remove defaultScheduleId when creating a managed user (#14205)
* refactor: v2 api remove defaultScheduleId from create user input * refactor: ensure user from test is deleted * fix: oauth-client-users test and allow deleting oauth users
This commit is contained in:
1 parent
75c3c596c2
commit
dd3dd32a3e
5 files changed
+14
-13
No files matched your search
@@ -59,7 +59,7 @@ describe("Event types Endpoints", () => {
|
||||
let teamRepositoryFixture: TeamRepositoryFixture;
|
||||
let eventTypesRepositoryFixture: EventTypesRepositoryFixture;
|
||||
|
||||
const userEmail = "test-e2e@api.com";
|
||||
const userEmail = "event-types-test-e2e@api.com";
|
||||
let eventType: EventType;
|
||||
let user: User;
|
||||
|
||||
@@ -153,7 +153,11 @@ describe("Event types Endpoints", () => {
|
||||
await oauthClientRepositoryFixture.delete(oAuthClient.id);
|
||||
await teamRepositoryFixture.delete(organization.id);
|
||||
await eventTypesRepositoryFixture.delete(eventType.id);
|
||||
|
||||
try {
|
||||
await userRepositoryFixture.delete(user.id);
|
||||
} catch (e) {
|
||||
// User might have been deleted by the test
|
||||
}
|
||||
await app.close();
|
||||
});
|
||||
});
|
||||
|
||||
+7
-2
@@ -169,7 +169,8 @@ describe("OAuth Client Users Endpoints", () => {
|
||||
async function userHasDefaultEventTypes(userId: number) {
|
||||
const defaultEventTypes = await eventTypesRepositoryFixture.getAllUserEventTypes(userId);
|
||||
|
||||
expect(defaultEventTypes?.length).toEqual(2);
|
||||
// note(Lauris): to determine count see default event types created in EventTypesService.createUserDefaultEventTypes
|
||||
expect(defaultEventTypes?.length).toEqual(4);
|
||||
expect(
|
||||
defaultEventTypes?.find((eventType) => eventType.length === DEFAULT_EVENT_TYPES.thirtyMinutes.length)
|
||||
).toBeTruthy();
|
||||
@@ -221,7 +222,11 @@ describe("OAuth Client Users Endpoints", () => {
|
||||
afterAll(async () => {
|
||||
await oauthClientRepositoryFixture.delete(oAuthClient.id);
|
||||
await teamRepositoryFixture.delete(organization.id);
|
||||
|
||||
try {
|
||||
await userRepositoryFixture.delete(postResponseData.user.id);
|
||||
} catch (e) {
|
||||
// User might have been deleted by the test
|
||||
}
|
||||
await app.close();
|
||||
});
|
||||
});
|
||||
|
||||
-4
@@ -155,10 +155,6 @@ export class OAuthClientUsersController {
|
||||
throw new NotFoundException(`User with ${userId} does not exist`);
|
||||
}
|
||||
|
||||
if (existingUser.username) {
|
||||
throw new BadRequestException("Cannot delete a non manually-managed user");
|
||||
}
|
||||
|
||||
const user = await this.userRepository.delete(userId);
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let app: INestApplication;
|
||||
const userEmail = "test-e2e@api.com";
|
||||
const userEmail = "oauth-clients-test-e2e@api.com";
|
||||
|
||||
beforeAll(async () => {
|
||||
const moduleRef = await withNextAuth(
|
||||
|
||||
@@ -15,10 +15,6 @@ export class CreateUserInput {
|
||||
@Validate(IsTimeFormat)
|
||||
timeFormat?: number;
|
||||
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
defaultScheduleId?: number;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Validate(IsWeekStart)
|
||||
|
||||
Reference in new issue
Block a user