Skip to content

Commit

Permalink
feat(app): Add new column on table Message
Browse files Browse the repository at this point in the history
  • Loading branch information
nizarfadlan committed Apr 3, 2024
1 parent 97d0431 commit 080544e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ model Message {
urlText Boolean?
userReceipt Json?
verifiedBizName String? @db.VarChar(128)
eventResponses Json?
pinInChat Json?
@@unique([sessionId, remoteJid, id], map: "unique_message_key_per_session_id")
@@index([sessionId])
Expand Down
8 changes: 8 additions & 0 deletions src/store/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ export function transformPrisma<T extends Record<string, any>>(
obj[key] = Buffer.from(val);
} else if (typeof val === "number" || val instanceof Long) {
obj[key] = toNumber(val);
} else if (
key.includes("Timestamp") && typeof val === "object" && val !== null
) {
obj[key] = new Long(
obj[key].low,
obj[key].high,
obj[key].unsigned
).toString(16);
} else if (removeNullable && (typeof val === "undefined" || val === null)) {
delete obj[key];
}
Expand Down

0 comments on commit 080544e

Please sign in to comment.