Skip to content

Commit

Permalink
Merge branch 'main' into upgrade-dub
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Jan 16, 2025
2 parents d8af178 + 07778d2 commit 651c574
Show file tree
Hide file tree
Showing 241 changed files with 3,376 additions and 1,818 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ E2E_TEST_OIDC_USER_PASSWORD=
# provide a value between 0 and 100 to ensure the percentage of traffic
# redirected from the legacy to the future pages
AB_TEST_BUCKET_PROBABILITY=50
APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED=0
APP_ROUTER_APPS_SLUG_ENABLED=0
APP_ROUTER_APPS_SLUG_SETUP_ENABLED=0
# whether we redirect to the future/apps/categories from /apps/categories or not
APP_ROUTER_APPS_CATEGORIES_ENABLED=0
# whether we redirect to the future/apps/categories/[category] from /apps/categories/[category] or not
APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED=0
APP_ROUTER_APPS_ENABLED=0
APP_ROUTER_TEAM_ENABLED=0
APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED=0
APP_ROUTER_AUTH_LOGIN_ENABLED=0
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/dangerous-git-checkout
- uses: ./.github/actions/yarn-install
- name: Run Linting with Reports
run: yarn lint:report
- name: Run Lint
run: yarn lint
continue-on-error: true

- name: Merge lint reports
run: jq -s '[.[]]|flatten' lint-results/*.json &> lint-results/eslint_report.json

- name: Upload ESLint report
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: lint-results
path: lint-results
6 changes: 6 additions & 0 deletions .yarn/versions/14a3a33b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
undecided:
- "@calcom/app-store-cli"
- "@calcom/platform-constants"
- "@calcom/platform-enums"
- "@calcom/platform-types"
- "@calcom/platform-utils"
8 changes: 8 additions & 0 deletions .yarn/versions/8864696c.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
undecided:
- calcom-monorepo
- "@calcom/app-store-cli"
- "@calcom/platform-constants"
- "@calcom/platform-enums"
- "@calcom/platform-types"
- "@calcom/platform-utils"
- "@calcom/prisma"
Empty file added .yarn/versions/9973477a.yml
Empty file.
7 changes: 7 additions & 0 deletions .yarn/versions/be9e9950.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
undecided:
- "@calcom/app-store-cli"
- "@calcom/platform-constants"
- "@calcom/platform-enums"
- "@calcom/platform-types"
- "@calcom/platform-utils"
- "@calcom/prisma"
3 changes: 3 additions & 0 deletions .yarn/versions/d05ae1e0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
undecided:
- calcom-monorepo
- "@calcom/prisma"
2 changes: 1 addition & 1 deletion apps/api/v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@axiomhq/winston": "^1.2.0",
"@calcom/platform-constants": "*",
"@calcom/platform-enums": "*",
"@calcom/platform-libraries": "npm:@calcom/[email protected].81",
"@calcom/platform-libraries": "npm:@calcom/[email protected].85",
"@calcom/platform-libraries-0.0.2": "npm:@calcom/[email protected]",
"@calcom/platform-types": "*",
"@calcom/platform-utils": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ describe("Bookings Endpoints 2024-08-13", () => {
metadata: {
userId: "100",
},
guests: ["[email protected]"],
};

const beforeCreate = new Date();
Expand Down Expand Up @@ -376,7 +377,9 @@ describe("Bookings Endpoints 2024-08-13", () => {
name: body.attendee.name,
email: body.attendee.email,
...body.bookingFieldsResponses,
guests: body.guests,
});
expect(data.guests).toEqual(body.guests);

// Check createdAt date is between the time of the request and after the request
const createdAtDate = new Date(data.createdAt);
Expand Down
13 changes: 10 additions & 3 deletions apps/api/v2/src/ee/bookings/2024-08-13/services/input.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ export class InputBookingsService_2024_08_13 {
);
const endTime = startTime.plus({ minutes: lengthInMinutes });

const guests = inputBooking.guests;

return {
start: startTime.toISO(),
end: endTime.toISO(),
Expand All @@ -154,19 +156,21 @@ export class InputBookingsService_2024_08_13 {
language: inputBooking.attendee.language || "en",
metadata: inputBooking.metadata || {},
hasHashedBookingLink: false,
guests: inputBooking.guests,
guests,
// note(Lauris): responses with name and email are required by the handleNewBooking
responses: inputBooking.bookingFieldsResponses
? {
...inputBooking.bookingFieldsResponses,
name: inputBooking.attendee.name,
email: inputBooking.attendee.email ?? "",
attendeePhoneNumber: inputBooking.attendee.phoneNumber,
guests,
}
: {
name: inputBooking.attendee.name,
email: inputBooking.attendee.email ?? "",
attendeePhoneNumber: inputBooking.attendee.phoneNumber,
guests,
},
};
}
Expand Down Expand Up @@ -251,6 +255,8 @@ export class InputBookingsService_2024_08_13 {
inputBooking.attendee.timeZone
);

const guests = inputBooking.guests;

for (let i = 0; i < repeatsTimes; i++) {
const endTime = startTime.plus({ minutes: eventType.length });

Expand All @@ -263,15 +269,16 @@ export class InputBookingsService_2024_08_13 {
language: inputBooking.attendee.language || "en",
metadata: inputBooking.metadata || {},
hasHashedBookingLink: false,
guests: inputBooking.guests,
guests,
// note(Lauris): responses with name and email are required by the handleNewBooking
responses: inputBooking.bookingFieldsResponses
? {
...inputBooking.bookingFieldsResponses,
name: inputBooking.attendee.name,
email: inputBooking.attendee.email,
guests,
}
: { name: inputBooking.attendee.name, email: inputBooking.attendee.email },
: { name: inputBooking.attendee.name, email: inputBooking.attendee.email, guests },
schedulingType: eventType.schedulingType,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ describe("Event types Endpoints", () => {
slug: "location",
required: false,
hidden: false,
disableOnPrefill: false,
};

const defaultResponseBookingFieldTitle = {
Expand Down Expand Up @@ -452,9 +451,6 @@ describe("Event types Endpoints", () => {
{ ...defaultResponseBookingFieldName, ...nameBookingField },
{ ...defaultResponseBookingFieldEmail },
{ ...defaultResponseBookingFieldLocation },
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
{
type: "select",
label: "select which language you want to learn",
Expand All @@ -466,7 +462,10 @@ describe("Event types Endpoints", () => {
hidden: false,
isDefault: false,
},
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldNotes },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
];

expect(createdEventType.bookingFields).toEqual(expectedBookingFields);
Expand Down Expand Up @@ -942,9 +941,6 @@ describe("Event types Endpoints", () => {
{ ...defaultResponseBookingFieldName, ...nameBookingField },
{ ...defaultResponseBookingFieldEmail },
{ ...defaultResponseBookingFieldLocation },
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
{
type: "select",
label: "select which language you want to learn",
Expand All @@ -956,7 +952,10 @@ describe("Event types Endpoints", () => {
hidden: false,
isDefault: false,
},
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldNotes, ...notesBookingField },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
];

expect(updatedEventType.bookingFields).toEqual(expectedBookingFields);
Expand Down Expand Up @@ -1163,10 +1162,7 @@ describe("Event types Endpoints", () => {
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
label: "",
placeholder: "",
},
{ isDefault: true, required: true, slug: "title", type: "text", disableOnPrefill: false, hidden: true },
{
Expand All @@ -1185,7 +1181,14 @@ describe("Event types Endpoints", () => {
disableOnPrefill: false,
hidden: false,
},
{ isDefault: true, type: "phone", slug: "attendeePhoneNumber", required: false, hidden: true },
{
disableOnPrefill: false,
isDefault: true,
type: "phone",
slug: "attendeePhoneNumber",
required: false,
hidden: true,
},
{
isDefault: true,
required: false,
Expand Down Expand Up @@ -1610,7 +1613,6 @@ describe("Event types Endpoints", () => {
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
Expand All @@ -1623,24 +1625,24 @@ describe("Event types Endpoints", () => {
},
{
isDefault: true,
type: "multiemail",
slug: "guests",
type: "textarea",
slug: "notes",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "textarea",
slug: "rescheduleReason",
type: "multiemail",
slug: "guests",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "textarea",
slug: "notes",
slug: "rescheduleReason",
required: false,
disableOnPrefill: false,
hidden: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,19 +243,7 @@ export class OutputEventTypesService_2024_06_14 {
}
}

const fields = [...transformBookingFieldsInternalToApi(knownBookingFields), ...unknownBookingFields];

// ensure additional notes are always at the end
return fields.sort((a, b) => {
if (!a?.slug || !b?.slug) return 0;
if (a.slug === "notes" && b.slug !== "notes") {
return 1;
}
if (b.slug === "notes" && a.slug !== "notes") {
return -1;
}
return 0;
});
return [...transformBookingFieldsInternalToApi(knownBookingFields), ...unknownBookingFields];
}

getDefaultBookingFields(isOrgTeamEvent: boolean) {
Expand Down
46 changes: 46 additions & 0 deletions apps/api/v2/src/modules/ooo/inputs/ooo.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ApiProperty, ApiPropertyOptional, PartialType } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsDate, IsInt, IsOptional, IsString, IsEnum, isDate } from "class-validator";

import { SkipTakePagination } from "@calcom/platform-types";

export enum OutOfOfficeReason {
UNSPECIFIED = "unspecified",
VACATION = "vacation",
Expand Down Expand Up @@ -80,3 +82,47 @@ export class CreateOutOfOfficeEntryDto {
}

export class UpdateOutOfOfficeEntryDto extends PartialType(CreateOutOfOfficeEntryDto) {}

export enum SortOrder {
asc = "asc",
desc = "desc",
}
type SortOrderType = keyof typeof SortOrder;

export class GetOutOfOfficeEntryFiltersDTO extends SkipTakePagination {
@IsOptional()
@IsEnum(SortOrder, {
message: 'SortStart must be either "asc" or "desc".',
})
@ApiProperty({
required: false,
description: "Sort results by their start time in ascending or descending order.",
example: "?sortStart=asc OR ?sortStart=desc",
enum: SortOrder,
})
sortStart?: SortOrderType;

@IsOptional()
@IsEnum(SortOrder, {
message: 'SortEnd must be either "asc" or "desc".',
})
@ApiProperty({
required: false,
description: "Sort results by their end time in ascending or descending order.",
example: "?sortEnd=asc OR ?sortEnd=desc",
enum: SortOrder,
})
sortEnd?: SortOrderType;
}

export class GetOrgUsersOutOfOfficeEntryFiltersDTO extends GetOutOfOfficeEntryFiltersDTO {
@IsString()
@IsOptional()
@ApiProperty({
type: String,
required: false,
description: "Filter ooo entries by the user email address. user must be within your organization.",
example: "[email protected]",
})
email?: string;
}
9 changes: 8 additions & 1 deletion apps/api/v2/src/modules/ooo/repositories/ooo.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,19 @@ export class UserOOORepository {
});
}

async getUserOOOPaginated(userId: number, skip: number, take: number) {
async getUserOOOPaginated(
userId: number,
skip: number,
take: number,
sort?: { sortStart?: "asc" | "desc"; sortEnd?: "asc" | "desc" }
) {
return this.dbRead.prisma.outOfOfficeEntry.findMany({
where: { userId },
skip,
take,
include: { reason: true },
...(sort?.sortStart && { orderBy: { start: sort.sortStart } }),
...(sort?.sortEnd && { orderBy: { end: sort.sortEnd } }),
});
}

Expand Down
11 changes: 9 additions & 2 deletions apps/api/v2/src/modules/ooo/services/ooo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {
CreateOutOfOfficeEntryDto,
UpdateOutOfOfficeEntryDto,
OutOfOfficeReason,
GetOutOfOfficeEntryFiltersDTO,
SortOrder,
} from "@/modules/ooo/inputs/ooo.input";
import { UserOOORepository } from "@/modules/ooo/repositories/ooo.repository";
import { UsersRepository } from "@/modules/users/users.repository";
Expand Down Expand Up @@ -128,8 +130,13 @@ export class UserOOOService {
return this.formatOooReason(ooo);
}

async getUserOOOPaginated(userId: number, skip: number, take: number) {
const ooos = await this.oooRepository.getUserOOOPaginated(userId, skip, take);
async getUserOOOPaginated(
userId: number,
skip: number,
take: number,
sort?: { sortStart?: "asc" | "desc"; sortEnd?: "asc" | "desc" }
) {
const ooos = await this.oooRepository.getUserOOOPaginated(userId, skip, take, sort);
return ooos.map((ooo) => this.formatOooReason(ooo));
}
}
Loading

0 comments on commit 651c574

Please sign in to comment.