Skip to content

Commit

Permalink
feat: introduced irl gathering v2 changes
Browse files Browse the repository at this point in the history
  - added location based events
  - added guest visit multiple events
  • Loading branch information
navneethkrish committed Oct 9, 2024
1 parent 13147c7 commit 0d18615
Show file tree
Hide file tree
Showing 17 changed files with 1,308 additions and 298 deletions.
380 changes: 362 additions & 18 deletions .forestadmin-schema.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Warnings:
- You are about to drop the column `location` on the `PLEvent` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "PLEvent" DROP COLUMN "location",
ADD COLUMN "locationUid" TEXT;

-- AlterTable
ALTER TABLE "PLEventGuest" ADD COLUMN "isHost" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "isSpeaker" BOOLEAN NOT NULL DEFAULT false;

-- CreateTable
CREATE TABLE "PLEventLocation" (
"id" SERIAL NOT NULL,
"uid" TEXT NOT NULL,
"location" TEXT NOT NULL,
"timezone" TEXT NOT NULL,
"latitude" TEXT,
"longitude" TEXT,
"flag" TEXT,
"icon" TEXT,
"resources" JSONB[],
"additionalInfo" JSONB,
"priority" INTEGER,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "PLEventLocation_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "PLEventLocation_uid_key" ON "PLEventLocation"("uid");

-- AddForeignKey
ALTER TABLE "PLEvent" ADD CONSTRAINT "PLEvent_locationUid_fkey" FOREIGN KEY ("locationUid") REFERENCES "PLEventLocation"("uid") ON DELETE SET NULL ON UPDATE CASCADE;
24 changes: 22 additions & 2 deletions apps/web-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,23 @@ model Project {
relatedQuestions DiscoveryQuestion[] @relation("ProjectRelatedDiscoveryQuestions")
}

model PLEventLocation {
id Int @id @default(autoincrement())
uid String @unique @default(cuid())
location String
timezone String
latitude String?
longitude String?
flag String?
icon String?
resources Json[]
additionalInfo Json?
priority Int?
events PLEvent[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model PLEvent {
id Int @id @default(autoincrement())
uid String @unique @default(cuid())
Expand All @@ -357,7 +374,6 @@ model PLEvent {
shortDescription String?
websiteURL String?
isFeatured Boolean? @default(false)
location String
slugURL String @unique
resources Json[]
priority Int?
Expand All @@ -366,8 +382,10 @@ model PLEvent {
endDate DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
eventGuests PLEventGuest[]
relatedQuestions DiscoveryQuestion[] @relation("PLEventRelatedDiscoveryQuestions")
locationUid String?
location PLEventLocation? @relation(fields: [locationUid], references: [uid])
eventGuests PLEventGuest[]
}

model PLEventGuest {
Expand All @@ -386,6 +404,8 @@ model PLEventGuest {
event PLEvent @relation(fields: [eventUid], references: [uid], onDelete: Cascade)
additionalInfo Json?
topics String[]
isHost Boolean @default(false)
isSpeaker Boolean @default(false)
}

model FocusArea {
Expand Down
17 changes: 9 additions & 8 deletions apps/web-api/src/members/members.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ export class MembersService {

findOne(
uid: string,
queryOptions: Omit<Prisma.MemberFindUniqueArgsBase, 'where'> = {}
queryOptions: Omit<Prisma.MemberFindUniqueArgsBase, 'where'> = {},
tx?: Prisma.TransactionClient
) {
return this.prisma.member.findUniqueOrThrow({
return (tx || this.prisma).member.findUniqueOrThrow({
where: { uid },
...queryOptions,
include: {
Expand Down Expand Up @@ -668,9 +669,9 @@ export class MembersService {
return { };
}

async updateTelegramIfChanged(member, telegram) {
if (telegram != '' && member.telegramHandler != telegram) {
member = await this.prisma.member.update({
async updateTelegramIfChanged(member, telegram, tx?:Prisma.TransactionClient) {
if (telegram && telegram != '' && member.telegramHandler != telegram) {
member = await (tx || this.prisma).member.update({
where: { uid: member.uid },
data: {
telegramHandler: telegram
Expand All @@ -680,9 +681,9 @@ export class MembersService {
return member;
}

async updateOfficeHoursIfChanged(member, officeHours) {
if (officeHours != '' && member.officeHours != officeHours) {
member = await this.prisma.member.update({
async updateOfficeHoursIfChanged(member, officeHours, tx?:Prisma.TransactionClient) {
if (officeHours && officeHours != '' && member.officeHours != officeHours) {
member = await (tx || this.prisma).member.update({
where: { uid: member.uid },
data: {
officeHours
Expand Down
Loading

0 comments on commit 0d18615

Please sign in to comment.