This repository has been archived by the owner on May 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Switch database to postgres * Fix port * Run prettier * up * Make username not null
- Loading branch information
1 parent
863bdeb
commit fe48574
Showing
7 changed files
with
52 additions
and
15 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" SERIAL NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"username" TEXT, | ||
"password" TEXT NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); |
8 changes: 8 additions & 0 deletions
8
prisma/migrations/20231122124813_usernamenotnull/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,8 @@ | ||
/* | ||
Warnings: | ||
- Made the column `username` on table `User` required. This step will fail if there are existing NULL values in that column. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "username" SET NOT NULL; |
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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "mysql" | ||
provider = "postgresql" |
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,8 +1,35 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
import * as dotenv from 'dotenv'; | ||
import { ValidationPipe } from '@nestjs/common'; | ||
|
||
dotenv.config(); | ||
|
||
const { PORT = 5000 } = process.env; | ||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
await app.listen(3000); | ||
app.useGlobalPipes( | ||
new ValidationPipe({ | ||
whitelist: true, | ||
transform: true, | ||
transformOptions: { enableImplicitConversion: true }, | ||
}), | ||
); | ||
app.enableCors({ | ||
origin: true, | ||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], | ||
allowedHeaders: [ | ||
'Authorization', | ||
'X-Requested-With', | ||
'Content-Type', | ||
'Access-Control-Allow-Origin', | ||
'Access-Control-Allow-Credentials', | ||
'Origin', | ||
], | ||
}); | ||
await app.listen(PORT, () => { | ||
console.log(`Server is listening on port ${PORT}...`); | ||
}); | ||
} | ||
|
||
bootstrap(); |