-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor: use domain types instead of prisma
- Loading branch information
Showing
95 changed files
with
1,087 additions
and
777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
export type { EventType, EventUpdateFn } from "./event.js"; | ||
export { Event, EventTypeEnum } from "./event.js"; | ||
export { Event, EventTypeEnum, AlreadySignedUpError } from "./event.js"; | ||
|
||
export type { SlotType } from "./slot.js"; | ||
export { Slot } from "./slot.js"; | ||
|
||
export type { SignUpAvailability } from "./sign-ups.js"; | ||
export { signUpAvailability } from "./sign-ups.js"; | ||
export type { | ||
SignUpAvailability, | ||
EventParticipationStatusType, | ||
} from "./sign-ups.js"; | ||
export { | ||
signUpAvailability, | ||
EventParticipationStatus, | ||
EventSignUp, | ||
} from "./sign-ups.js"; | ||
|
||
export type { CategoryType } from "./category.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Listing { | ||
id: string; | ||
name: string; | ||
description: string; | ||
closesAt: Date; | ||
applicationUrl: string; | ||
organizationId: string; | ||
|
||
constructor( | ||
params: Omit<Listing, "description" | "applicationUrl"> & | ||
Partial<Pick<Listing, "description" | "applicationUrl">>, | ||
) { | ||
this.id = params.id; | ||
this.name = params.name; | ||
this.description = params.description ?? ""; | ||
this.closesAt = params.closesAt; | ||
this.applicationUrl = params.applicationUrl ?? ""; | ||
this.organizationId = params.organizationId; | ||
} | ||
} | ||
|
||
export { Listing }; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,54 @@ | ||
export const Role = { | ||
const OrganizationRole = { | ||
ADMIN: "ADMIN", | ||
MEMBER: "MEMBER", | ||
} as const; | ||
type OrganizationRoleType = | ||
(typeof OrganizationRole)[keyof typeof OrganizationRole]; | ||
|
||
export type Role = (typeof Role)[keyof typeof Role]; | ||
const FeaturePermission = { | ||
ARCHIVE_VIEW_DOCUMENTS: "ARCHIVE_VIEW_DOCUMENTS", | ||
ARCHIVE_WRITE_DOCUMENTS: "ARCHIVE_WRITE_DOCUMENTS", | ||
EVENT_WRITE_SIGN_UPS: "EVENT_WRITE_SIGN_UPS", | ||
CABIN_ADMIN: "CABIN_ADMIN", | ||
} as const; | ||
|
||
type FeaturePermissionType = | ||
(typeof FeaturePermission)[keyof typeof FeaturePermission]; | ||
|
||
class Organization { | ||
id: string; | ||
name: string; | ||
description: string; | ||
logoFileId?: string | null; | ||
featurePermissions: FeaturePermissionType[]; | ||
|
||
constructor(params: Organization) { | ||
this.id = params.id; | ||
this.name = params.name; | ||
this.description = params.description; | ||
this.logoFileId = params.logoFileId; | ||
this.featurePermissions = params.featurePermissions; | ||
} | ||
} | ||
|
||
class OrganizationMember { | ||
id: string; | ||
userId: string; | ||
organizationId: string; | ||
role: OrganizationRoleType; | ||
|
||
constructor(params: OrganizationMember) { | ||
this.id = params.id; | ||
this.userId = params.userId; | ||
this.organizationId = params.organizationId; | ||
this.role = params.role; | ||
} | ||
} | ||
|
||
export { | ||
OrganizationRole, | ||
FeaturePermission, | ||
Organization, | ||
OrganizationMember, | ||
}; | ||
export type { OrganizationRoleType, FeaturePermissionType }; |
Oops, something went wrong.