Add more services; Version 0.3.3

This commit is contained in:
Aslan 2025-12-29 02:02:56 +01:00
parent 50348cc494
commit ddcc591d12
26 changed files with 887 additions and 38 deletions

View file

@ -0,0 +1,11 @@
-- DropForeignKey
ALTER TABLE "Channel" DROP CONSTRAINT "Channel_communityId_fkey";
-- DropForeignKey
ALTER TABLE "Role" DROP CONSTRAINT "Role_communityId_fkey";
-- AddForeignKey
ALTER TABLE "Channel" ADD CONSTRAINT "Channel_communityId_fkey" FOREIGN KEY ("communityId") REFERENCES "Community"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Role" ADD CONSTRAINT "Role_communityId_fkey" FOREIGN KEY ("communityId") REFERENCES "Community"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -0,0 +1,17 @@
-- DropForeignKey
ALTER TABLE "Invite" DROP CONSTRAINT "Invite_communityId_fkey";
-- DropForeignKey
ALTER TABLE "Invite" DROP CONSTRAINT "Invite_creatorId_fkey";
-- DropForeignKey
ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey";
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Invite" ADD CONSTRAINT "Invite_communityId_fkey" FOREIGN KEY ("communityId") REFERENCES "Community"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Invite" ADD CONSTRAINT "Invite_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -24,7 +24,7 @@ model Community {
model Channel {
id String @id @unique @default(uuid())
name String
community Community @relation(fields: [communityId], references: [id])
community Community @relation(fields: [communityId], references: [id], onDelete: Cascade)
communityId String
creationDate DateTime @default(now())
}
@ -32,7 +32,7 @@ model Channel {
model Role {
id String @id @unique @default(uuid())
name String
community Community @relation(fields: [communityId], references: [id])
community Community @relation(fields: [communityId], references: [id], onDelete: Cascade)
communityId String
users User[] @relation(name: "UsersRolesToUsers")
permissions String[]
@ -57,7 +57,7 @@ model User {
model Session {
id String @id @unique @default(uuid())
owner User @relation(fields: [userId], references: [id])
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
token String
creationDate DateTime @default(now())
@ -65,9 +65,9 @@ model Session {
model Invite {
id String @id @unique @default(uuid())
Community Community @relation(fields: [communityId], references: [id])
Community Community @relation(fields: [communityId], references: [id], onDelete: Cascade)
communityId String
User User @relation(fields: [creatorId], references: [id])
User User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
creatorId String
totalInvites Int @default(0)
remainingInvites Int @default(0)