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:
Cameron Blackwood
2024-06-27 10:52:00 +01:00
committed by GitHub
parent 197549c8fc
commit d0de9af8eb
2 changed files with 7 additions and 7 deletions

View File

@@ -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)

View File

@@ -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 });