Virtus
Virtus
Explore posts from servers
PPrisma
Created by Virtus on 7/5/2024 in #help-and-questions
ID needed in delete()?
Using deleteMany as a hacky bypass is not going to work either, because I also have an upsert query that will have the exact same problem
await this.DiscordMembers.upsert({
create: {
guild_id: guildId,
id: member.user.id,
nick: member.nick ?? null,
avatar: member.avatar ?? null,
joined_at: member.joined_at ?? null,
premium_since: member.premium_since ?? null,
deaf: member.deaf ?? null,
mute: member.mute ?? null,
flags: member.flags ?? null,
pending: member.pending ?? null,
communication_disabled_until: member.communication_disabled_until ?? null,
// @ts-ignore - We can't really depend on this property ever being populated
permissions: member?.permissions ? BigInt(member.permissions) : null,
},
update: {
nick: member.nick ?? null,
avatar: member.avatar ?? null,
joined_at: member.joined_at ?? null,
premium_since: member.premium_since ?? null,
deaf: member.deaf ?? null,
mute: member.mute ?? null,
flags: member.flags ?? null,
pending: member.pending ?? null,
communication_disabled_until: member.communication_disabled_until ?? null,
// @ts-ignore - We can't really depend on this property ever being populated
permissions: member?.permissions ? BigInt(member.permissions) : null,
},
where: {
guild_id: guildId,
id: member.user.id,
}
});
await this.DiscordMembers.upsert({
create: {
guild_id: guildId,
id: member.user.id,
nick: member.nick ?? null,
avatar: member.avatar ?? null,
joined_at: member.joined_at ?? null,
premium_since: member.premium_since ?? null,
deaf: member.deaf ?? null,
mute: member.mute ?? null,
flags: member.flags ?? null,
pending: member.pending ?? null,
communication_disabled_until: member.communication_disabled_until ?? null,
// @ts-ignore - We can't really depend on this property ever being populated
permissions: member?.permissions ? BigInt(member.permissions) : null,
},
update: {
nick: member.nick ?? null,
avatar: member.avatar ?? null,
joined_at: member.joined_at ?? null,
premium_since: member.premium_since ?? null,
deaf: member.deaf ?? null,
mute: member.mute ?? null,
flags: member.flags ?? null,
pending: member.pending ?? null,
communication_disabled_until: member.communication_disabled_until ?? null,
// @ts-ignore - We can't really depend on this property ever being populated
permissions: member?.permissions ? BigInt(member.permissions) : null,
},
where: {
guild_id: guildId,
id: member.user.id,
}
});
4 replies