Moved register and login to user folder. Setup basic login, register and JWT
This commit is contained in:
16
prisma/migrations/20241006032550_initial2/migration.sql
Normal file
16
prisma/migrations/20241006032550_initial2/migration.sql
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[username]` on the table `User` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `password` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "password" TEXT NOT NULL,
|
||||
ADD COLUMN "username" TEXT NOT NULL,
|
||||
ALTER COLUMN "latitude" DROP NOT NULL,
|
||||
ALTER COLUMN "longitude" DROP NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
|
||||
@ -0,0 +1,5 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "UserRole" AS ENUM ('PRIVATE', 'BUSINESS');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "role" "UserRole" NOT NULL DEFAULT 'PRIVATE';
|
||||
@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[email]` on the table `User` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||||
@ -1,9 +1,3 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
@ -14,7 +8,7 @@ datasource db {
|
||||
}
|
||||
|
||||
model Vehicle {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
brand String
|
||||
model String
|
||||
variant String?
|
||||
@ -29,36 +23,29 @@ model Vehicle {
|
||||
description String
|
||||
service String
|
||||
inspectedAt DateTime?
|
||||
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
auctions Auction[] // Relation to Auction
|
||||
equipment Equipment[] @relation("VehicleEquipment")
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
auctions Auction[]
|
||||
equipment Equipment[] @relation("VehicleEquipment")
|
||||
}
|
||||
|
||||
model Equipment {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
|
||||
vehicles Vehicle[] @relation("VehicleEquipment")
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
vehicles Vehicle[] @relation("VehicleEquipment")
|
||||
}
|
||||
|
||||
model Auction {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
vehicleId Int
|
||||
userId Int
|
||||
|
||||
askingPrice Float
|
||||
description String?
|
||||
|
||||
vehicle Vehicle @relation(fields: [vehicleId], references: [id])
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
bids Bid[] // Relation to Bid
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
vehicle Vehicle @relation(fields: [vehicleId], references: [id])
|
||||
bids Bid[]
|
||||
}
|
||||
|
||||
model User {
|
||||
@ -66,26 +53,30 @@ model User {
|
||||
name String
|
||||
company String?
|
||||
address String
|
||||
latitude String
|
||||
longitude String
|
||||
latitude String?
|
||||
longitude String?
|
||||
phone String
|
||||
privatePhone String?
|
||||
email String
|
||||
email String @unique
|
||||
cvr String?
|
||||
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
auctions Auction[] // Relation to Auction
|
||||
password String
|
||||
username String @unique
|
||||
role UserRole @default(PRIVATE)
|
||||
auctions Auction[]
|
||||
}
|
||||
|
||||
model Bid {
|
||||
id Int @id @default(autoincrement())
|
||||
auctionId Int
|
||||
bid Float
|
||||
|
||||
auction Auction @relation(fields: [auctionId], references: [id])
|
||||
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
id Int @id @default(autoincrement())
|
||||
auctionId Int
|
||||
bid Float
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
auction Auction @relation(fields: [auctionId], references: [id])
|
||||
}
|
||||
|
||||
enum UserRole {
|
||||
PRIVATE
|
||||
BUSINESS
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user