fix: replace bookingTimeStatus with bookingTimeStatusDenormalized (#21028)

* test: Add unit tests for buildBaseWhereCondition function

Co-Authored-By: [email protected] <[email protected]>

* refactor: Export buildBaseWhereCondition function instead of copying it

Co-Authored-By: [email protected] <[email protected]>

* refactor: Remove implementation detail checks from tests

Co-Authored-By: [email protected] <[email protected]>

* test: Fix tests to match actual function behavior

Co-Authored-By: [email protected] <[email protected]>

* test: Fix test issues with buildBaseWhereCondition

Co-Authored-By: [email protected] <[email protected]>

* test: Update tests to match actual function behavior

Co-Authored-By: [email protected] <[email protected]>

* fix: Address security issues in buildBaseWhereCondition function

Co-Authored-By: [email protected] <[email protected]>

* refactor: Simplify buildBaseWhereCondition function

Co-Authored-By: [email protected] <[email protected]>

* refactor: Simplify code and remove isEmptyResponse property

Co-Authored-By: [email protected] <[email protected]>

* refactor: Use array of conditions approach for buildBaseWhereCondition

Co-Authored-By: [email protected] <[email protected]>

* refactor: Make buildBaseWhereCondition implementation consistent and update tests

Co-Authored-By: [email protected] <[email protected]>

* fix: Fix incorrect usage of buildBaseWhereCondition function

Co-Authored-By: [email protected] <[email protected]>

* chore: Revert yarn.lock changes

Co-Authored-By: [email protected] <[email protected]>

* fix: Comment out non-existent Sentry API method to fix type error

Co-Authored-By: [email protected] <[email protected]>

* Revert "fix: Comment out non-existent Sentry API method to fix type error"

This reverts commit 44c21a7396a518c63047b33967cd8af7e6e4f268.

* remove unnecessary if-statement

* fix: replace bookingTimeStatus with bookingTimeStatusDenormalized

* change column

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-05-21 16:10:43 +00:00
1 parent f84c8239e7
commit 41a6035a12
3 files changed
+31 -31

No files matched your search

@@ -95,7 +95,7 @@ async function postHandler(request: NextRequest) {
const userIdsFromTeams = team.members.map((u) => u.userId);
// Booking Events
const whereConditional: Prisma.BookingTimeStatusWhereInput = {
const whereConditional: Prisma.BookingTimeStatusDenormalizedWhereInput = {
OR: [
{
teamId: team.id,
@@ -122,7 +122,7 @@ async function postHandler(request: NextRequest) {
EventData["Cancelled"] = countGroupedByStatus["cancelled"];
// Most Booked Event Type
const bookingWhere: Prisma.BookingTimeStatusWhereInput = {
const bookingWhere: Prisma.BookingTimeStatusDenormalizedWhereInput = {
createdAt: {
gte: dayjs(firstDateOfMonth).startOf("day").toDate(),
lte: dayjs(new Date()).endOf("day").toDate(),
@@ -141,7 +141,7 @@ async function postHandler(request: NextRequest) {
],
};
const bookingsFromSelected = await prisma.bookingTimeStatus.groupBy({
const bookingsFromSelected = await prisma.bookingTimeStatusDenormalized.groupBy({
by: ["eventTypeId"],
where: bookingWhere,
_count: {
@@ -234,7 +234,7 @@ async function postHandler(request: NextRequest) {
});
// Most booked members
const bookingsFromTeam = await prisma.bookingTimeStatus.groupBy({
const bookingsFromTeam = await prisma.bookingTimeStatusDenormalized.groupBy({
by: ["userId"],
where: bookingWhere,
_count: {