* feat: api v2 add missing event type fields for advanced settings Add 9 event type fields to API v2 that were available in tRPC but missing from the platform API: - disableCancelling: disable cancelling for guests/organizer - disableRescheduling: disable rescheduling for guests/organizer - canSendCalVideoTranscriptionEmails: send Cal Video transcription emails - autoTranslateInstantMeetingTitleEnabled: auto-translate instant meeting titles - interfaceLanguage: preferred booking interface language - allowReschedulingPastBookings: allow rescheduling past events - allowReschedulingCancelledBookings: allow booking via reschedule link - customReplyToEmail: custom reply-to email for confirmations - showOptimizedSlots: optimize time slot arrangement Updated output/input schemas, transformation services, and E2E tests. * fix(api-v2): add proper OpenAPI types for nullable event type fields Add explicit type and nullable properties to @ApiPropertyOptional decorators for fields with `boolean | null` or `string | null` types. Without these, Swagger was generating incorrect "type": "object" instead of the correct types. Fixed fields: - disableCancelling: type: Boolean, nullable: true - disableRescheduling: type: Boolean, nullable: true - interfaceLanguage: type: String, nullable: true - allowReschedulingCancelledBookings: type: Boolean, nullable: true - customReplyToEmail: type: String, nullable: true - showOptimizedSlots: type: Boolean, nullable: true * refactor: customReplyToEmail was intentionally excluded from this PR. The web UI restricts this field to only allow the user's own verified emails via a dropdown, but implementing the same validation in the API requires additional business logic. This will be addressed in a separate PR with proper email ownership validation. * feat(api-v2): add validation for interfaceLanguage field Add @IsIn validation to interfaceLanguage field to only accept supported locales. This ensures API v2 matches the web UI behavior where users can only select from a predefined dropdown of supported languages. Changes: - Add SUPPORTED_LOCALES constant to @calcom/platform-constants - Add @IsIn([...SUPPORTED_LOCALES]) validation to create/update DTOs - Add E2E tests for invalid locale rejection (400 error) - Add cross-reference comments in i18n.json and api.ts to keep in sync * docs(api): add default values to event type input field documentation Added default value documentation to @DocsPropertyOptional decorators for the new event type fields in API v2 (2024_06_14): - disableCancelling: false - disableRescheduling: false - canSendCalVideoTranscriptionEmails: true - autoTranslateInstantMeetingTitleEnabled: false - allowReschedulingPastBookings: false - allowReschedulingCancelledBookings: false - showOptimizedSlots: false This improves API documentation by clearly communicating default values to API consumers in the OpenAPI spec. * feat(api-v2): refactor event type settings to object types for future extensibility - Convert disableRescheduling from boolean to object with disabled and minutesBefore properties - Convert disableCancelling from boolean to object with disabled property - Move canSendCalVideoTranscriptionEmails into CalVideoSettings as sendTranscriptionEmails - Remove autoTranslateInstantMeetingTitleEnabled (Enterprise-only feature) - Add DisableRescheduling_2024_06_14 and DisableCancelling_2024_06_14 input/output types - Add transformation methods for new object types in input and output services - Update E2E tests for new API contract BREAKING CHANGE: disableRescheduling and disableCancelling now accept objects instead of booleans * fix(api-v2): prevent clearing calVideoSettings when only sendTranscriptionEmails is provided Only include calVideoSettings in transformed output if it has properties, avoiding unintentional reset of existing settings during updates.
A progressive Node.js framework for building efficient and scalable server-side applications.
Description
Cal.com is using the Nest framework TypeScript starter repository.
Installation
$ yarn install
Prisma setup
$ yarn prisma generate
Env setup
Copy .env.example to .env and fill values.
Add license Key to Deployment table in DB
id, logo, theme, licenseKey, agreedLicenseAt:- 1, null, null, '00000000-0000-0000-0000-000000000000', '2023-05-15 21:39:47.611'
Replace with your actual license key.
your CALCOM_LICENSE_KEY env var need to contain the same value
.env CALCOM_LICENSE_KEY=00000000-0000-0000-0000-000000000000
Running the app
Development
$ yarn run start
OR if you don't want to use docker, you can run following command.
$ yarn dev:no-docker
Additionally you can run following command(in different terminal) to ensure that any change in any of the dependencies is rebuilt and detected. It watches platform-libraries, platform-constants, platform-enums, platform-utils, platform-types.
$ yarn run dev:build:watch
If you are making changes in packages/platform/libraries, you should run the following command too that would connect your local packages/platform/libraries to the api/v2
$ yarn local
watch mode
$ yarn run start:dev
production mode
$ yarn run start:prod
## Test
```bash
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# e2e tests in watch mode
$ yarn test:e2e:watch
# run specific e2e test file in watch mode
$ yarn test:e2e:watch --testPathPattern=filePath
# test coverage
$ yarn run test:cov
Conventions
Guards
- In case a guard would return "false" for "canActivate" instead throw ForbiddenException with an error message containing guard name and the error.
- In case a guard would return "false" for "canActivate" DO NOT cache the result in redis, because we don't want that someone is forbidden, updates whatever was the problem, and then has to wait for cache to expire. We only cache in redis guard results where "canAccess" is "true".
- If you use ApiAuthGuard but want that only specific auth method is allowed, for example, api key, then you also need to add
@ApiAuthGuardOnlyAllow(["API_KEY"])under the@UseGuards(ApiAuthGuard). Shortly, useApiAuthGuardOnlyAllowto specify which auth methods are allowed byApiAuthGuard. IfApiAuthGuardOnlyAllowis not used or nothing is passed to it or empty array it means that all auth methods are allowed.
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.