mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
Encryption/schema fixes
This commit is contained in:
parent
3e3ac50f08
commit
3aa9a9b2c6
@ -53,13 +53,13 @@ model ArchivedUser {
|
|||||||
bot Boolean @default(false)
|
bot Boolean @default(false)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
discriminator String @db.Char(4)
|
discriminator String @db.Char(4)
|
||||||
displayName String
|
displayName String @db.VarChar(512)
|
||||||
role ArchivedRole @relation(fields: [ticketId, roleId], references: [ticketId, roleId], onDelete: Cascade)
|
role ArchivedRole @relation(fields: [ticketId, roleId], references: [ticketId, roleId], onDelete: Cascade)
|
||||||
roleId String @db.VarChar(19)
|
roleId String @db.VarChar(19)
|
||||||
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
||||||
ticketId String @db.VarChar(19)
|
ticketId String @db.VarChar(19)
|
||||||
userId String @db.VarChar(19)
|
userId String @db.VarChar(19)
|
||||||
username String
|
username String @db.VarChar(512)
|
||||||
|
|
||||||
@@id([ticketId, userId])
|
@@id([ticketId, userId])
|
||||||
@@unique([ticketId, userId])
|
@@unique([ticketId, userId])
|
||||||
@ -70,7 +70,7 @@ model Category {
|
|||||||
channelName String @default("ticket-{num}")
|
channelName String @default("ticket-{num}")
|
||||||
claiming Boolean @default(false)
|
claiming Boolean @default(false)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
description String
|
description String @db.VarChar(512)
|
||||||
discordCategory String @db.VarChar(19)
|
discordCategory String @db.VarChar(19)
|
||||||
emoji String
|
emoji String
|
||||||
enableFeedback Boolean @default(false)
|
enableFeedback Boolean @default(false)
|
||||||
@ -79,7 +79,7 @@ model Category {
|
|||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
image String?
|
image String?
|
||||||
memberLimit Int @default(1)
|
memberLimit Int @default(1)
|
||||||
name String
|
name String @db.VarChar(512)
|
||||||
openingMessage String @db.Text
|
openingMessage String @db.Text
|
||||||
pingRoles Json @default("[]")
|
pingRoles Json @default("[]")
|
||||||
questions Question[]
|
questions Question[]
|
||||||
@ -137,7 +137,7 @@ model Question {
|
|||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
category Category? @relation(fields: [categoryId], references: [id])
|
category Category? @relation(fields: [categoryId], references: [id])
|
||||||
categoryId Int?
|
categoryId Int?
|
||||||
label String
|
label String @db.VarChar(512)
|
||||||
maxLength Int? @default(4000)
|
maxLength Int? @default(4000)
|
||||||
minLength Int? @default(0)
|
minLength Int? @default(0)
|
||||||
order Int
|
order Int
|
||||||
@ -164,13 +164,13 @@ model QuestionAnswer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Tag {
|
model Tag {
|
||||||
content String
|
content String @db.Text()
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
||||||
guildId String @db.VarChar(19)
|
guildId String @db.VarChar(19)
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String
|
name String @db.VarChar(512)
|
||||||
regex String?
|
regex String? @db.VarChar(512)
|
||||||
|
|
||||||
@@unique([guildId, name])
|
@@unique([guildId, name])
|
||||||
@@map("tags")
|
@@map("tags")
|
||||||
@ -188,7 +188,7 @@ model Ticket {
|
|||||||
closedAt DateTime?
|
closedAt DateTime?
|
||||||
closedBy User @relation(name: "TicketsClosedByUser", fields: [closedById], references: [id])
|
closedBy User @relation(name: "TicketsClosedByUser", fields: [closedById], references: [id])
|
||||||
closedById String @db.VarChar(19)
|
closedById String @db.VarChar(19)
|
||||||
closedReason String?
|
closedReason String? @db.VarChar(512)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
createdBy User @relation(name: "TicketsCreatedByUser", fields: [createdById], references: [id])
|
createdBy User @relation(name: "TicketsCreatedByUser", fields: [createdById], references: [id])
|
||||||
createdById String @db.VarChar(19)
|
createdById String @db.VarChar(19)
|
||||||
@ -210,7 +210,7 @@ model Ticket {
|
|||||||
referencesMessageId String @db.VarChar(19)
|
referencesMessageId String @db.VarChar(19)
|
||||||
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
|
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
|
||||||
referencesTicketId String? @db.VarChar(19)
|
referencesTicketId String? @db.VarChar(19)
|
||||||
topic String?
|
topic String? @db.VarChar(512)
|
||||||
questionAnswers QuestionAnswer[]
|
questionAnswers QuestionAnswer[]
|
||||||
|
|
||||||
@@unique([guildId, number])
|
@@unique([guildId, number])
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
command:
|
command:
|
||||||
log:
|
log:
|
||||||
admin:
|
admin:
|
||||||
|
changes: 'Changes'
|
||||||
description:
|
description:
|
||||||
joined: '{user} {verb} {targetType}'
|
joined: '{user} {verb} {targetType}'
|
||||||
target:
|
target:
|
||||||
category: 'a category'
|
category: 'a category'
|
||||||
settings: 'the settings'
|
settings: 'the settings'
|
||||||
differences: 'Differences'
|
|
||||||
title:
|
title:
|
||||||
joined: '{targetType} {verb}'
|
joined: '{targetType} {verb}'
|
||||||
target:
|
target:
|
||||||
|
@ -22,7 +22,7 @@ const shouldDecrypt = ['findUnique', 'findFirst', 'findMany'];
|
|||||||
module.exports = async (params, next) => {
|
module.exports = async (params, next) => {
|
||||||
if (params.args.data && shouldEncrypt.includes(params.action)) {
|
if (params.args.data && shouldEncrypt.includes(params.action)) {
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
if (field in params.args.data) {
|
if (field in params.args.data && params.args.data[field] !== null && params.args.data[field] !== undefined) {
|
||||||
params.args.data[field] = cryptr.encrypt(params.args.data[field]);
|
params.args.data[field] = cryptr.encrypt(params.args.data[field]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ module.exports = async (params, next) => {
|
|||||||
|
|
||||||
if (result && shouldDecrypt.includes(params.action)) {
|
if (result && shouldDecrypt.includes(params.action)) {
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
if (field in result) {
|
if (field in result && result[field] !== null && result[field] !== undefined) {
|
||||||
result[field] = cryptr.decrypt(params.result[field]);
|
result[field] = cryptr.decrypt(params.result[field]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user