Update db schema + add hasher func

This commit is contained in:
Kevin Puig
2025-09-27 14:53:15 -04:00
parent 072bd7f0d7
commit 0818d9828a
3 changed files with 11 additions and 7 deletions

View File

@@ -56,7 +56,6 @@ model Category {
name String
position Int
Channel Channel[]
Message Message[]
}
model Channel {
@@ -71,12 +70,10 @@ model Channel {
model Message {
id String @id @default(uuid(7))
Channel Channel? @relation(fields: [channelId], references: [id])
channelId String?
Category Category? @relation(fields: [categoryId], references: [id])
categoryId String?
User User? @relation(fields: [userId], references: [id])
userId String?
Channel Channel @relation(fields: [channelId], references: [id])
channelId String
User User @relation(fields: [userId], references: [id])
userId String
deleted Boolean
text String
replies Reply[] @relation("MessageToReply")

View File

@@ -0,0 +1,5 @@
import * as crypto from 'crypto';
export default function shaHash(data:string, salt:string) : string {
return crypto.createHmac('sha256', salt).update(data).digest('hex');
}

View File

@@ -18,4 +18,6 @@ export const createUserSchema = z.object({
admin: z.boolean().default(false),
})
export type QueryUserByIdInput = z.infer<typeof queryUserByIdSchema>
export type QueryAllUsersByInstanceIdInput = z.infer<typeof queryAllUsersByInstanceId>
export type CreateUserInput = z.infer<typeof createUserSchema>