Update db schema + add hasher func
This commit is contained in:
@@ -56,7 +56,6 @@ model Category {
|
|||||||
name String
|
name String
|
||||||
position Int
|
position Int
|
||||||
Channel Channel[]
|
Channel Channel[]
|
||||||
Message Message[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model Channel {
|
model Channel {
|
||||||
@@ -71,12 +70,10 @@ model Channel {
|
|||||||
|
|
||||||
model Message {
|
model Message {
|
||||||
id String @id @default(uuid(7))
|
id String @id @default(uuid(7))
|
||||||
Channel Channel? @relation(fields: [channelId], references: [id])
|
Channel Channel @relation(fields: [channelId], references: [id])
|
||||||
channelId String?
|
channelId String
|
||||||
Category Category? @relation(fields: [categoryId], references: [id])
|
User User @relation(fields: [userId], references: [id])
|
||||||
categoryId String?
|
userId String
|
||||||
User User? @relation(fields: [userId], references: [id])
|
|
||||||
userId String?
|
|
||||||
deleted Boolean
|
deleted Boolean
|
||||||
text String
|
text String
|
||||||
replies Reply[] @relation("MessageToReply")
|
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),
|
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>
|
export type CreateUserInput = z.infer<typeof createUserSchema>
|
||||||
Reference in New Issue
Block a user