mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-11-23 15:58:16 +01:00
Make the user entitiy use a uuid as its identifier (#189)
* Make the user entitiy user a uuid as its identifier * migrate to string types for user id everywhere
This commit is contained in:
committed by
GitHub
parent
197549c8fc
commit
d0de9af8eb
@@ -90,7 +90,7 @@ app OpenSaaS {
|
||||
*/
|
||||
|
||||
entity User {=psl
|
||||
id Int @id @default(autoincrement())
|
||||
id String @id @default(uuid())
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
email String? @unique
|
||||
@@ -118,7 +118,7 @@ entity GptResponse {=psl
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
userId String
|
||||
|
||||
content String
|
||||
psl=}
|
||||
@@ -128,7 +128,7 @@ entity Task {=psl
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
userId String
|
||||
|
||||
description String
|
||||
time String @default("1")
|
||||
@@ -140,7 +140,7 @@ entity File {=psl
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
userId String
|
||||
|
||||
name String
|
||||
type String
|
||||
@@ -155,7 +155,7 @@ entity ContactFormMessage {=psl
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
userId String
|
||||
|
||||
content String
|
||||
isRead Boolean @default(false)
|
||||
|
||||
@@ -286,7 +286,7 @@ export const deleteTask: DeleteTask<Pick<Task, 'id'>, Task> = async ({ id }, con
|
||||
return task;
|
||||
};
|
||||
|
||||
export const updateUserById: UpdateUserById<{ id: number; data: Partial<User> }, User> = async (
|
||||
export const updateUserById: UpdateUserById<{ id: string; data: Partial<User> }, User> = async (
|
||||
{ id, data },
|
||||
context
|
||||
) => {
|
||||
@@ -318,7 +318,7 @@ export const createFile: CreateFile<fileArgs, File> = async ({ fileType, name },
|
||||
throw new HttpError(401);
|
||||
}
|
||||
|
||||
const userInfo = context.user.id.toString();
|
||||
const userInfo = context.user.id;
|
||||
|
||||
const { uploadUrl, key } = await getUploadFileSignedURLFromS3({ fileType, userInfo });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user