feat: global booking limits for teams (#16614)
* add booking booking to team settings * add update mutation * add missing export * fix dirty state * first version of global team limits in getUserAvailability * add test setup * create seperate test file for global limits * add tests for all units * move limitManager and booking limit functions outside of getUserAvailability * add migration * clean up code * move yearly booking count to booking repository * code clean up * don't count rescheduling booking * add test for getSchedule * fix type error * fix type error * fix type error * fix from and end date for fetching bookings * reuse functions * allow null for bookingLimits * remove bookings from managed event type * fix type error * code clean up * small fixes form clean up * fix type issue * same fixes in teams/_post * fix existing tz issue * tests for fix * adds missingn await * imrove description * remove spreading * fix reschedule issue with booking limits * fix reschedule error with booking durations * remove useeffect * undo commit * add bookingLimits to UpdateOrgTeamDto * fix unit tests * Prepare view for app router migration * throw error if not in ascending order * fix disabled update button --------- Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
28 files changed
+1539
-299
No files matched your search
@@ -10,6 +10,7 @@ export const schemaTeamBaseBodyParams = Team.omit({ id: true, createdAt: true })
|
||||
isPlatform: true,
|
||||
smsLockState: true,
|
||||
smsLockReviewedByAdmin: true,
|
||||
bookingLimits: true,
|
||||
});
|
||||
|
||||
const schemaTeamRequiredParams = z.object({
|
||||
|
||||
@@ -123,9 +123,11 @@ export async function patchHandler(req: NextApiRequest) {
|
||||
// TODO: Perhaps there is a better fix for this?
|
||||
const cloneData: typeof data & {
|
||||
metadata: NonNullable<typeof data.metadata> | undefined;
|
||||
bookingLimits: NonNullable<typeof data.bookingLimits> | undefined;
|
||||
} = {
|
||||
...data,
|
||||
smsLockReviewedByAdmin: false,
|
||||
bookingLimits: data.bookingLimits === null ? {} : data.bookingLimits,
|
||||
metadata: data.metadata === null ? {} : data.metadata || undefined,
|
||||
};
|
||||
const team = await prisma.team.update({ where: { id: teamId }, data: cloneData });
|
||||
|
||||
@@ -123,9 +123,11 @@ async function postHandler(req: NextApiRequest) {
|
||||
// TODO: Perhaps there is a better fix for this?
|
||||
const cloneData: typeof data & {
|
||||
metadata: NonNullable<typeof data.metadata> | undefined;
|
||||
bookingLimits: NonNullable<typeof data.bookingLimits> | undefined;
|
||||
} = {
|
||||
...data,
|
||||
smsLockReviewedByAdmin: false,
|
||||
bookingLimits: data.bookingLimits === null ? {} : data.bookingLimits || undefined,
|
||||
metadata: data.metadata === null ? {} : data.metadata || undefined,
|
||||
};
|
||||
|
||||
|
||||
@@ -72,4 +72,8 @@ export class UpdateOrgTeamDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
readonly weekStart?: string = "Sunday";
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
readonly bookingLimits?: string;
|
||||
}
|
||||
Reference in new issue
Block a user