Skip to content

Commit 141e2f5

Browse files
committed
chore: remove postinstall script
1 parent 2996485 commit 141e2f5

File tree

12 files changed

+108
-14
lines changed

12 files changed

+108
-14
lines changed

apps/rpc/src/modules/event/event-repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { DBHandle, Prisma, findFeaturedEvents } from "@dotkomonline/db"
1+
import { type DBHandle, type Prisma, sql } from "@dotkomonline/db"
22
import {
33
type AttendanceId,
44
type BaseEvent,
@@ -329,7 +329,7 @@ export function getEventRepository(): EventRepository {
329329
//
330330
// Past events are not featured. We would rather have no featured events than "stale" events.
331331

332-
const events = await handle.$queryRawTyped(findFeaturedEvents(offset, limit))
332+
const events = await handle.$queryRawTyped(sql.findFeaturedEvents(offset, limit))
333333

334334
return parseOrReport(BaseEventSchema.array(), events)
335335
},

apps/rpc/src/modules/event/event-router.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,12 @@ export type FindFeaturedEventsInput = inferProcedureInput<typeof findFeaturedEve
301301
export type FindFeaturedEventsOutput = inferProcedureOutput<typeof findFeaturedEventsProcedure>
302302
const findFeaturedEventsProcedure = procedure
303303
.input(
304-
z.object({
305-
offset: z.number().min(0).default(0),
306-
limit: z.number().min(1).max(100).default(10),
307-
})
304+
z
305+
.object({
306+
offset: z.number().min(0).default(0),
307+
limit: z.number().min(1).max(100).default(10),
308+
})
309+
.default({ offset: 0, limit: 1 })
308310
)
309311
.output(z.object({ event: BaseEventSchema, attendance: AttendanceSchema.nullable() }).array())
310312
.use(withDatabaseTransaction())
@@ -353,4 +355,5 @@ export const eventRouter = t.router({
353355
isOrganizer: isOrganizerProcedure,
354356
findManyDeregisterReasonsWithEvent: findManyDeregisterReasonsWithEventProcedure,
355357
createFileUpload: createFileUploadProcedure,
358+
findFeaturedEvents: findFeaturedEventsProcedure,
356359
})

packages/db/generated/prisma/enums.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ export type EventStatus = (typeof EventStatus)[keyof typeof EventStatus]
8787

8888

8989
export const EventType = {
90-
SOCIAL: 'SOCIAL',
91-
ACADEMIC: 'ACADEMIC',
92-
COMPANY: 'COMPANY',
9390
GENERAL_ASSEMBLY: 'GENERAL_ASSEMBLY',
91+
COMPANY: 'COMPANY',
92+
ACADEMIC: 'ACADEMIC',
93+
SOCIAL: 'SOCIAL',
9494
INTERNAL: 'INTERNAL',
9595
OTHER: 'OTHER',
9696
WELCOME: 'WELCOME'

packages/db/generated/prisma/internal/class.ts

Lines changed: 13 additions & 2 deletions
Large diffs are not rendered by default.

packages/db/generated/prisma/internal/prismaNamespace.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,6 +2974,10 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
29742974
args: [query: string, ...values: any[]],
29752975
result: any
29762976
}
2977+
$queryRawTyped: {
2978+
args: runtime.UnknownTypedSql,
2979+
result: JsonObject
2980+
}
29772981
}
29782982
}
29792983
}

packages/db/generated/prisma/models/Attendance.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,9 @@ export type $AttendancePayload<ExtArgs extends runtime.Types.Extensions.Internal
818818
selections: runtime.JsonValue
819819
createdAt: Date
820820
updatedAt: Date
821+
/**
822+
* Price in NOK (100 = 100 NOK)
823+
*/
821824
attendancePrice: number | null
822825
}, ExtArgs["result"]["attendance"]>
823826
composites: {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
export { type $DbEnums } from "./sql/$DbEnums"
7+
8+
export * from "./sql/findFeaturedEvents"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
export interface $DbEnums {
7+
membership_type: "BACHELOR_STUDENT" | "MASTER_STUDENT" | "PHD_STUDENT" | "KNIGHT" | "SOCIAL_MEMBER" | "OTHER"
8+
membership_specialization: "ARTIFICIAL_INTELLIGENCE" | "DATABASE_AND_SEARCH" | "INTERACTION_DESIGN" | "SOFTWARE_ENGINEERING" | "UNKNOWN"
9+
group_type: "COMMITTEE" | "NODE_COMMITTEE" | "ASSOCIATED" | "INTEREST_GROUP"
10+
group_member_visibility: "ALL_MEMBERS" | "WITH_ROLES" | "LEADER" | "NONE"
11+
GroupRecruitmentMethod: "NONE" | "SPRING_APPLICATION" | "AUTUMN_APPLICATION" | "GENERAL_ASSEMBLY" | "NOMINATION" | "OTHER"
12+
group_role_type: "LEADER" | "PUNISHER" | "TREASURER" | "COSMETIC" | "DEPUTY_LEADER" | "TRUSTEE" | "EMAIL_ONLY"
13+
event_status: "DRAFT" | "PUBLIC" | "DELETED"
14+
event_type: "GENERAL_ASSEMBLY" | "COMPANY" | "ACADEMIC" | "SOCIAL" | "INTERNAL" | "OTHER" | "WELCOME"
15+
MarkType: "MANUAL" | "LATE_ATTENDANCE" | "MISSED_ATTENDANCE" | "MISSING_FEEDBACK" | "MISSING_PAYMENT"
16+
employment_type: "PARTTIME" | "FULLTIME" | "SUMMER_INTERNSHIP" | "OTHER"
17+
task_type: "RESERVE_ATTENDEE" | "CHARGE_ATTENDEE" | "MERGE_ATTENDANCE_POOLS" | "VERIFY_PAYMENT" | "VERIFY_FEEDBACK_ANSWERED" | "SEND_FEEDBACK_FORM_EMAILS" | "VERIFY_ATTENDEE_ATTENDED"
18+
task_status: "PENDING" | "RUNNING" | "COMPLETED" | "FAILED" | "CANCELED"
19+
feedback_question_type: "TEXT" | "LONGTEXT" | "RATING" | "CHECKBOX" | "SELECT" | "MULTISELECT"
20+
deregister_reason_type: "SCHOOL" | "WORK" | "ECONOMY" | "TIME" | "SICK" | "NO_FAMILIAR_FACES" | "OTHER"
21+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
3+
/* eslint-disable */
4+
// biome-ignore-all lint: generated file
5+
// @ts-nocheck
6+
import * as $runtime from "@prisma/client/runtime/client"
7+
import { type $DbEnums } from "./$DbEnums"
8+
9+
/**
10+
* @param offset
11+
* @param limit
12+
*/
13+
export const findFeaturedEvents = $runtime.makeTypedQueryFactory("\n\n\n\nWITH\ncapacities AS (\nSELECT\n\"attendanceId\",\nSUM(\"capacity\") AS sum\nFROM \"attendance_pool\"\nGROUP BY \"attendanceId\"\n),\n\nattendees AS (\nSELECT\n\"attendanceId\",\nCOUNT(*) AS count\nFROM \"attendee\"\nGROUP BY \"attendanceId\"\n)\n\nSELECT\n\"event\".*,\nCOALESCE(capacities.sum, 0) AS \"totalCapacity\",\nCOALESCE(attendees.count, 0) AS \"attendeeCount\",\n\nCASE \"event\".\"type\"\nWHEN 'GENERAL_ASSEMBLY' THEN 1\nWHEN 'COMPANY' THEN 2\nWHEN 'ACADEMIC' THEN 2\nELSE 3\nEND AS \"typeRank\",\n\nCASE\nWHEN \"event\".\"attendanceId\" IS NOT NULL\nAND NOW() BETWEEN attendance.\"registerStart\" AND attendance.\"registerEnd\"\nAND COALESCE(capacities.sum, 0) > 0\nAND COALESCE(attendees.count, 0) < COALESCE(capacities.sum, 0)\nTHEN 1\n\nWHEN \"event\".\"attendanceId\" IS NOT NULL\nAND NOW() < attendance.\"registerStart\"\nTHEN 2\n\nWHEN \"event\".\"attendanceId\" IS NULL\nOR COALESCE(capacities.sum, 0) = 0\nTHEN 3\n\nWHEN \"event\".\"attendanceId\" IS NOT NULL\nAND COALESCE(capacities.sum, 0) > 0\nAND COALESCE(attendees.count, 0) >= COALESCE(capacities.sum, 0)\nTHEN 4\n\nELSE 4\nEND AS \"registrationBucket\"\n\nFROM \"event\"\nLEFT JOIN \"attendance\"\nON \"attendance\".\"id\" = \"event\".\"attendanceId\"\nLEFT JOIN capacities\nON capacities.\"attendanceId\" = \"event\".\"attendanceId\"\nLEFT JOIN attendees\nON attendees.\"attendanceId\" = \"event\".\"attendanceId\"\n\nWHERE\n\"event\".\"status\" = 'PUBLIC'\nAND \"event\".\"start\" > NOW()\n\nORDER BY\n\"typeRank\" ASC,\n\"registrationBucket\" ASC,\n\"event\".\"start\" ASC\n\nOFFSET $1\nLIMIT $2;") as (offset: number, limit: number) => $runtime.TypedSql<findFeaturedEvents.Parameters, findFeaturedEvents.Result>
14+
15+
export namespace findFeaturedEvents {
16+
export type Parameters = [offset: number, limit: number]
17+
export type Result = {
18+
id: string
19+
title: string
20+
start: Date
21+
end: Date
22+
status: $DbEnums["event_status"]
23+
description: string
24+
shortDescription: string | null
25+
imageUrl: string | null
26+
locationTitle: string | null
27+
locationAddress: string | null
28+
locationLink: string | null
29+
attendanceId: string | null
30+
type: $DbEnums["event_type"]
31+
createdAt: Date
32+
updatedAt: Date
33+
metadataImportId: number | null
34+
parentId: string | null
35+
markForMissedAttendance: boolean
36+
totalCapacity: bigint | null
37+
attendeeCount: bigint | null
38+
typeRank: number | null
39+
registrationBucket: number | null
40+
}
41+
}

packages/db/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"prisma": "prisma",
2525
"migrate": "prisma migrate dev",
2626
"generate": "prisma generate",
27-
"postinstall": "prisma generate",
2827
"apply-fixtures": "tsx src/fixtures.ts"
2928
},
3029
"dependencies": {

0 commit comments

Comments
 (0)