Skip to content

Commit

Permalink
Merge branch 'main' into fix-handle-changed-credential-key
Browse files Browse the repository at this point in the history
  • Loading branch information
joeauyeung committed Apr 29, 2024
2 parents 509a01f + 46ffeae commit 36eb5ca
Show file tree
Hide file tree
Showing 35 changed files with 319 additions and 104 deletions.
3 changes: 3 additions & 0 deletions apps/api/v1/lib/validations/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export const schemaTeamBaseBodyParams = Team.omit({ id: true, createdAt: true })
hideBranding: true,
metadata: true,
pendingPayment: true,
isOrganization: true,
isPlatform: true,
smsLockState: true,
});

const schemaTeamRequiredParams = z.object({
Expand Down
1 change: 1 addition & 0 deletions apps/api/v2/nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"entryFile": "./apps/api/v2/src/main.js",
"compilerOptions": {
"deleteOutDir": true,
"plugins": [
Expand Down
4 changes: 2 additions & 2 deletions apps/api/v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"start": "nest start",
"dev:build:watch": "yarn workspace @calcom/platform-constants build:watch & yarn workspace @calcom/platform-utils build:watch & yarn workspace @calcom/platform-types build:watch & yarn workspace @calcom/platform-libraries build:watch",
"dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build && yarn workspace @calcom/platform-libraries build",
"dev": "yarn dev:build && docker-compose up -d && yarn copy-swagger-module && nest start --watch",
"dev": "yarn dev:build && docker-compose up -d && yarn copy-swagger-module && yarn start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/src/main",
"start:prod": "node ./dist/apps/api/v2/src/main.js",
"test": "yarn dev:build && jest",
"test:watch": "yarn dev:build && jest --watch",
"test:cov": "yarn dev:build && jest --coverage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DeleteEventTypeOutput } from "@/ee/event-types/outputs/delete-event-typ
import { GetEventTypePublicOutput } from "@/ee/event-types/outputs/get-event-type-public.output";
import { GetEventTypeOutput } from "@/ee/event-types/outputs/get-event-type.output";
import { GetEventTypesPublicOutput } from "@/ee/event-types/outputs/get-event-types-public.output";
import { GetEventTypesOutput } from "@/ee/event-types/outputs/get-event-types.output";
import { GetEventTypesData, GetEventTypesOutput } from "@/ee/event-types/outputs/get-event-types.output";
import { UpdateEventTypeOutput } from "@/ee/event-types/outputs/update-event-type.output";
import { EventTypesService } from "@/ee/event-types/services/event-types.service";
import { GetUser } from "@/modules/auth/decorators/get-user/get-user.decorator";
Expand Down Expand Up @@ -96,7 +96,7 @@ export class EventTypesController {

return {
status: SUCCESS_STATUS,
data: eventTypes,
data: eventTypes as GetEventTypesData,
};
}

Expand Down
12 changes: 8 additions & 4 deletions apps/api/v2/src/ee/event-types/outputs/event-type.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export class EventTypeOutput {

@IsInt()
@ApiHideProperty()
position!: number;
@IsOptional()
position?: number;

@IsInt()
@ApiHideProperty()
Expand All @@ -71,7 +72,8 @@ export class EventTypeOutput {

@IsInt()
@ApiHideProperty()
profileId!: number | null;
@IsOptional()
profileId?: number | null;

@IsInt()
@ApiHideProperty()
Expand All @@ -83,7 +85,8 @@ export class EventTypeOutput {

@IsInt()
@ApiHideProperty()
parentId!: number | null;
@IsOptional()
parentId?: number | null;

@IsOptional()
@IsArray()
Expand Down Expand Up @@ -176,7 +179,8 @@ export class EventTypeOutput {

@IsInt()
@ApiHideProperty()
scheduleId!: number | null;
@IsOptional()
scheduleId?: number | null;

@IsNumber()
@ApiHideProperty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class EventTypeGroup {
eventTypes!: EventTypeOutput[];
}

class GetEventTypesData {
export class GetEventTypesData {
@ValidateNested({ each: true })
@Type(() => EventTypeGroup)
@IsArray()
Expand Down
15 changes: 10 additions & 5 deletions apps/api/v2/src/ee/event-types/services/event-types.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DEFAULT_EVENT_TYPES } from "@/ee/event-types/constants/constants";
import { EventTypesRepository } from "@/ee/event-types/event-types.repository";
import { CreateEventTypeInput } from "@/ee/event-types/inputs/create-event-type.input";
import { UpdateEventTypeInput } from "@/ee/event-types/inputs/update-event-type.input";
import { EventTypeOutput } from "@/ee/event-types/outputs/event-type.output";
import { MembershipsRepository } from "@/modules/memberships/memberships.repository";
import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
import { SelectedCalendarsRepository } from "@/modules/selected-calendars/selected-calendars.repository";
Expand All @@ -22,7 +23,7 @@ export class EventTypesService {
private readonly dbWrite: PrismaWriteService
) {}

async createUserEventType(user: UserWithProfile, body: CreateEventTypeInput) {
async createUserEventType(user: UserWithProfile, body: CreateEventTypeInput): Promise<EventTypeOutput> {
await this.checkCanCreateEventType(user.id, body);
const eventTypeUser = await this.getUserToCreateEvent(user);
const { eventType } = await createEventType({
Expand All @@ -34,7 +35,7 @@ export class EventTypesService {
prisma: this.dbWrite.prisma,
},
});
return eventType;
return eventType as EventTypeOutput;
}

async checkCanCreateEventType(userId: number, body: CreateEventTypeInput) {
Expand Down Expand Up @@ -88,7 +89,7 @@ export class EventTypesService {
}

this.checkUserOwnsEventType(user.id, eventType.eventType);
return eventType;
return eventType as { eventType: EventTypeOutput };
}

async getEventTypesPublicByUsername(username: string): Promise<EventTypesPublic> {
Expand Down Expand Up @@ -126,9 +127,13 @@ export class EventTypesService {
},
});

const { eventType } = await this.getUserEventTypeForAtom(user, eventTypeId);
const eventType = await this.getUserEventTypeForAtom(user, eventTypeId);

return eventType;
if (!eventType) {
throw new NotFoundException(`Event type with id ${eventTypeId} not found`);
}

return eventType.eventType;
}

async checkCanUpdateEventType(userId: number, eventTypeId: number) {
Expand Down
12 changes: 9 additions & 3 deletions apps/api/v2/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
},
"exclude": ["./dist", "next-i18next.config.js"],
"exclude": ["./dist", "./node_modules", "next-i18next.config.js"],
"include": [
"./**/*.ts",
"../../../packages/types/*.d.ts",
"../../../packages/platform/**/*.ts",
"../../../packages/platform/**/*.d.ts"
"../../../packages/platform/libraries/**/*.ts",
"../../../packages/platform/libraries/**/*.d.ts",
"../../../packages/platform/constants/**/*.ts",
"../../../packages/platform/constants/**/*.d.ts",
"../../../packages/platform/types/**/*.ts",
"../../../packages/platform/types/**/*.d.ts",
"../../../packages/platform/utils/**/*.ts",
"../../../packages/platform/utils/**/*.d.ts"
]
}
3 changes: 2 additions & 1 deletion apps/web/lib/team/[slug]/getServerSideProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { GetServerSidePropsContext } from "next";

import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
import { getFeatureFlag } from "@calcom/features/flags/server/utils";
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client";
import logger from "@calcom/lib/logger";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
Expand Down Expand Up @@ -127,7 +128,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
users: !isTeamOrParentOrgPrivate
? type.users.map((user) => ({
...user,
avatar: `/${user.username}/avatar.png`,
avatar: getUserAvatarUrl(user),
}))
: [],
descriptionAsSafeHTML: markdownToSafeHTML(type.description),
Expand Down
4 changes: 2 additions & 2 deletions apps/web/pages/team/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useEffect } from "react";

import { sdkActionManager, useIsEmbed } from "@calcom/embed-core/embed-iframe";
import EventTypeDescription from "@calcom/features/eventtypes/components/EventTypeDescription";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import { getOrgOrTeamAvatar } from "@calcom/lib/defaultAvatarImage";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
import useTheme from "@calcom/lib/hooks/useTheme";
Expand Down Expand Up @@ -162,7 +162,7 @@ function TeamPage({
</div>
);

const profileImageSrc = getPlaceholderAvatar(team.logoUrl || team.parent?.logoUrl, team.name);
const profileImageSrc = getOrgOrTeamAvatar(team);

return (
<>
Expand Down
5 changes: 3 additions & 2 deletions apps/web/test/lib/getSchedule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ describe("getSchedule", () => {
...TestData.users.example,
id: 101,
schedules: [TestData.schedules.IstWorkHours],
credentials: [],
credentials: [getGoogleCalendarCredential()],
selectedCalendars: [TestData.selectedCalendars.google],
},
],
bookings: [
Expand All @@ -642,7 +643,7 @@ describe("getSchedule", () => {
status: "ACCEPTED" as BookingStatus,
},
],
// apps: [TestData.apps.googleCalendar],
apps: [TestData.apps.googleCalendar],
};

await createBookingScenario(scenarioData);
Expand Down
2 changes: 2 additions & 0 deletions packages/app-store/apps.metadata.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import basecamp3_config_json from "./basecamp3/config.json";
import cal_ai_config_json from "./cal-ai/config.json";
import { metadata as caldavcalendar__metadata_ts } from "./caldavcalendar/_metadata";
import campfire_config_json from "./campfire/config.json";
import clic_config_json from "./clic/config.json";
import closecom_config_json from "./closecom/config.json";
import cron_config_json from "./cron/config.json";
import { metadata as dailyvideo__metadata_ts } from "./dailyvideo/_metadata";
Expand Down Expand Up @@ -97,6 +98,7 @@ export const appStoreMetadata = {
"cal-ai": cal_ai_config_json,
caldavcalendar: caldavcalendar__metadata_ts,
campfire: campfire_config_json,
clic: clic_config_json,
closecom: closecom_config_json,
cron: cron_config_json,
dailyvideo: dailyvideo__metadata_ts,
Expand Down
1 change: 1 addition & 0 deletions packages/app-store/apps.server.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const apiHandlers = {
"cal-ai": import("./cal-ai/api"),
caldavcalendar: import("./caldavcalendar/api"),
campfire: import("./campfire/api"),
clic: import("./clic/api"),
closecom: import("./closecom/api"),
cron: import("./cron/api"),
deel: import("./deel/api"),
Expand Down
9 changes: 9 additions & 0 deletions packages/app-store/clic/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
items:
- preview.png
- previewcheckins.png
- previewcontacts.png
- previewcreation.png
---

{DESCRIPTION}
20 changes: 20 additions & 0 deletions packages/app-store/clic/api/add.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { createDefaultInstallation } from "@calcom/app-store/_utils/installation";
import type { AppDeclarativeHandler } from "@calcom/types/AppHandler";

import appConfig from "../config.json";

const handler: AppDeclarativeHandler = {
appType: appConfig.type,
variant: appConfig.variant,
slug: appConfig.slug,
supportsMultipleInstalls: false,
handlerType: "add",
redirect: {
newTab: true,
url: "https://clicis.vercel.app",
},
createCredential: ({ appType, user, slug, teamId }) =>
createDefaultInstallation({ appType, user: user, slug, key: {}, teamId }),
};

export default handler;
1 change: 1 addition & 0 deletions packages/app-store/clic/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as add } from "./add";
16 changes: 16 additions & 0 deletions packages/app-store/clic/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"/*": "Don't modify slug - If required, do it using cli edit command",
"name": "Clic",
"slug": "clic",
"type": "check_in_automation",
"logo": "icon.svg",
"url": "https://clicis.vercel.app",
"variant": "automation",
"categories": ["automation"],
"publisher": "Chris Pacheco",
"email": "chrispacheco430@gmail.com",
"description": "Create, List and Interact with Your Cal.com links and connections easily.\r\r",
"isTemplate": false,
"__createdUsingCli": true,
"__template": "link-as-an-app"
}
1 change: 1 addition & 0 deletions packages/app-store/clic/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as api from "./api";
14 changes: 14 additions & 0 deletions packages/app-store/clic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"name": "@calcom/clic",
"version": "0.1.0",
"main": "./index.ts",
"dependencies": {
"@calcom/lib": "*"
},
"devDependencies": {
"@calcom/types": "*"
},
"description": "Create, List and Interact with Your Cal.com links and connections easily."
}
Binary file added packages/app-store/clic/preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/app-store/clic/previewcheckins.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/app-store/clic/previewcontacts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/app-store/clic/previewcreation.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 36eb5ca

Please sign in to comment.