Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
493705e
commit b579b8f
Showing
32 changed files
with
687 additions
and
177 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
backend/prisma/migrations/20221201220540_config_and_admin_functionalities/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `firstName` on the `User` table. All the data in the column will be lost. | ||
- You are about to drop the column `lastName` on the `User` table. All the data in the column will be lost. | ||
- Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- CreateTable | ||
CREATE TABLE "Config" ( | ||
"updatedAt" DATETIME NOT NULL, | ||
"key" TEXT NOT NULL PRIMARY KEY, | ||
"type" TEXT NOT NULL, | ||
"value" TEXT NOT NULL, | ||
"description" TEXT NOT NULL, | ||
"secret" BOOLEAN NOT NULL DEFAULT true, | ||
"locked" BOOLEAN NOT NULL DEFAULT false | ||
); | ||
|
||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_User" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
"username" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"password" TEXT NOT NULL, | ||
"isAdmin" BOOLEAN NOT NULL DEFAULT false | ||
); | ||
INSERT INTO "new_User" ("createdAt", "email", "id", "password", "updatedAt") SELECT "createdAt", "email", "id", "password", "updatedAt" FROM "User"; | ||
DROP TABLE "User"; | ||
ALTER TABLE "new_User" RENAME TO "User"; | ||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
import { PickType } from "@nestjs/swagger"; | ||
import { Expose } from "class-transformer"; | ||
import { IsEmail, Length, Matches } from "class-validator"; | ||
import { UserDTO } from "src/user/dto/user.dto"; | ||
|
||
export class AuthRegisterDTO extends UserDTO {} | ||
export class AuthRegisterDTO extends PickType(UserDTO, ["password"] as const) { | ||
@Expose() | ||
@Matches("^[a-zA-Z0-9_.]*$", undefined, { | ||
message: "Username can only contain letters, numbers, dots and underscores", | ||
}) | ||
@Length(3, 32) | ||
username: string; | ||
|
||
@Expose() | ||
@IsEmail() | ||
email: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.