Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-coding committed Aug 22, 2024
1 parent da0e9d7 commit 15df8b1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ export class SelfRegisterUserInput extends BaseUserInput {
RegistrationTokenInput.check(input);
return input;
}
}
}
4 changes: 2 additions & 2 deletions backend/src/api-login/auth/dto/create-auth-client.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export class CreateAuthClientInput extends UpdateAuthClientInput {

/**
* Checks whether the input is a valid `CreateAuthClientInput`
*
*
* Needed:
* - Must be valid {@link UpdateAuthClientInput}
* - Must have a non empty name
*
*
* @param input The input object to check
* @returns The original input object
*/
Expand Down
5 changes: 1 addition & 4 deletions backend/src/api-login/auth/dto/update-auth-client.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ export class UpdateAuthClientInput {
}
for (const scope of input.validScopes) {
if (scope !== TokenScope.BACKEND) {
throw new HttpException(
`Only ${TokenScope.BACKEND} is a valid scopes`,
HttpStatus.BAD_REQUEST,
);
throw new HttpException(`Only ${TokenScope.BACKEND} is a valid scopes`, HttpStatus.BAD_REQUEST);
}
}
if (input.clientCredentialFlowUser != undefined) {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/api-oauth/dto/oauth-token-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export class OAuthTokenResponseDto {
expires_in: number;
refresh_token?: string;
scope: string;
}
}
1 change: 0 additions & 1 deletion backend/src/api-oauth/oauth-token.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { OAuthTokenResponseDto } from "./dto/oauth-token-response.dto";
@Controller()
@ApiTags(OpenApiTag.OAUTH_API)
export class OAuthTokenController {

@Post("token")
@ApiOperation({ summary: "Token OAuth Endpoint" })
@ApiOkResponse({ type: OAuthTokenResponseDto })
Expand Down
19 changes: 13 additions & 6 deletions backend/src/database-migrations/1721847625737-migration.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class Migration1721847625737 implements MigrationInterface {
name = 'Migration1721847625737'
name = "Migration1721847625737";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "active_login" DROP CONSTRAINT "FK_e6358a5261dc7e791810e04394c"`);
await queryRunner.query(`ALTER TABLE "active_login" DROP COLUMN "createdByClientId"`);
await queryRunner.query(`ALTER TABLE "active_login" RENAME COLUMN "usedStrategyInstnceId" TO "usedStrategyInstanceId"`);
await queryRunner.query(
`ALTER TABLE "active_login" RENAME COLUMN "usedStrategyInstnceId" TO "usedStrategyInstanceId"`,
);
await queryRunner.query(`ALTER TABLE "strategy_instance" ALTER COLUMN "name" SET NOT NULL`);
await queryRunner.query(`ALTER TABLE "auth_client" ALTER COLUMN "name" SET NOT NULL`);
await queryRunner.query(`ALTER TABLE "auth_client" ADD "validScopes" json NOT NULL DEFAULT '[]'`);
await queryRunner.query(`ALTER TABLE "auth_client" ALTER COLUMN "validScopes" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "auth_client" ADD COLUMN "clientCredentialFlowUserId" uuid NULL`);
await queryRunner.query(`ALTER TABLE "auth_client" ADD CONSTRAINT "FK_42cc6dd6f24948b39263c943b2a" FOREIGN KEY ("clientCredentialFlowUserId") REFERENCES "login_user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(
`ALTER TABLE "auth_client" ADD CONSTRAINT "FK_42cc6dd6f24948b39263c943b2a" FOREIGN KEY ("clientCredentialFlowUserId") REFERENCES "login_user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
Expand All @@ -22,8 +26,11 @@ export class Migration1721847625737 implements MigrationInterface {
await queryRunner.query(`ALTER TABLE "auth_client" ALTER COLUMN "name" DROP NOT NULL`);
await queryRunner.query(`ALTER TABLE "strategy_instance" ALTER COLUMN "name" DROP NOT NULL`);
await queryRunner.query(`ALTER TABLE "active_login" ADD "createdByClientId" uuid`);
await queryRunner.query(`ALTER TABLE "active_login" RENAME COLUMN "usedStrategyInstanceId" TO "usedStrategyInstnceId"`);
await queryRunner.query(`ALTER TABLE "active_login" ADD CONSTRAINT "FK_e6358a5261dc7e791810e04394c" FOREIGN KEY ("createdByClientId") REFERENCES "auth_client"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(
`ALTER TABLE "active_login" RENAME COLUMN "usedStrategyInstanceId" TO "usedStrategyInstnceId"`,
);
await queryRunner.query(
`ALTER TABLE "active_login" ADD CONSTRAINT "FK_e6358a5261dc7e791810e04394c" FOREIGN KEY ("createdByClientId") REFERENCES "auth_client"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
);
}

}

0 comments on commit 15df8b1

Please sign in to comment.