Update db schema + add hasher func
This commit is contained in:
@@ -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")
|
||||
|
||||
5
concord-server/src/helper/hashing.ts
Normal file
5
concord-server/src/helper/hashing.ts
Normal 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');
|
||||
}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user