Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into reroute-with-correcte…
Browse files Browse the repository at this point in the history
…d-responses
  • Loading branch information
hariombalhara committed Oct 15, 2024
2 parents 14bf3b3 + 2acb555 commit 24f52f5
Show file tree
Hide file tree
Showing 58 changed files with 817 additions and 201 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This is just to test this file
name: Build

on:
workflow_call:

jobs:
build:
name: Build Docs
permissions:
contents: read
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dangerous-git-checkout
- name: Cache Docs build
uses: buildjet/cache@v4
id: cache-docs-build
env:
cache-name: docs-build
key-1: ${{ hashFiles('yarn.lock') }}
key-2: ${{ hashFiles('docs/**.*', '!**/node_modules') }}
key-3: ${{ github.event.pull_request.number || github.ref }}
key-4: ${{ github.sha }}
with:
path: |
**/docs/**
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }}
- name: Run build
working-directory: docs
run: |
export NODE_OPTIONS="--max_old_space_size=8192"
if [ ${{ steps.cache-docs-build.outputs.cache-hit }} == 'true' ]; then
echo "Cache hit for Docs build. Skipping build."
else
npm install -g mintlify
mintlify dev &
sleep 5 # Let it run for 5 seconds
kill $!
fi
shell: bash
8 changes: 8 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ jobs:
uses: ./.github/workflows/atoms-production-build.yml
secrets: inherit

build-docs:
name: Production builds
needs: [changes, check-label, deps]
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
uses: ./.github/workflows/docs-build.yml
secrets: inherit

build:
name: Production builds
needs: [changes, check-label, deps]
Expand Down Expand Up @@ -225,6 +232,7 @@ jobs:
build-api-v1,
build-api-v2,
build-atoms,
build-docs,
e2e,
e2e-api-v2,
e2e-embed,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production-build-without-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ env:

jobs:
build:
name: Web App
name: Build Web App
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 30
steps:
Expand Down
5 changes: 3 additions & 2 deletions apps/api/v1/lib/validations/attendee.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { z } from "zod";

import { emailSchema } from "@calcom/lib/emailSchema";
import { _AttendeeModel as Attendee } from "@calcom/prisma/zod";

import { timeZone } from "~/lib/validations/shared/timeZone";
Expand All @@ -14,7 +15,7 @@ export const schemaAttendeeBaseBodyParams = Attendee.pick({
const schemaAttendeeCreateParams = z
.object({
bookingId: z.number().int(),
email: z.string().email(),
email: emailSchema,
name: z.string(),
timeZone: timeZone,
})
Expand All @@ -23,7 +24,7 @@ const schemaAttendeeCreateParams = z
const schemaAttendeeEditParams = z
.object({
name: z.string().optional(),
email: z.string().email().optional(),
email: emailSchema.optional(),
timeZone: timeZone.optional(),
})
.strict();
Expand Down
6 changes: 4 additions & 2 deletions apps/api/v1/lib/validations/shared/queryAttendeeEmail.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { withValidation } from "next-validations";
import { z } from "zod";

import { emailSchema } from "@calcom/lib/emailSchema";

import { baseApiParams } from "./baseApiParams";

// Extracted out as utility function so can be reused
// at different endpoints that require this validation.
export const schemaQueryAttendeeEmail = baseApiParams.extend({
attendeeEmail: z.string().email(),
attendeeEmail: emailSchema,
});

export const schemaQuerySingleOrMultipleAttendeeEmails = z.object({
attendeeEmail: z.union([z.string().email(), z.array(z.string().email())]).optional(),
attendeeEmail: z.union([emailSchema, z.array(emailSchema)]).optional(),
});

export const withValidQueryAttendeeEmail = withValidation({
Expand Down
6 changes: 4 additions & 2 deletions apps/api/v1/lib/validations/shared/queryUserEmail.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { withValidation } from "next-validations";
import { z } from "zod";

import { emailSchema } from "@calcom/lib/emailSchema";

import { baseApiParams } from "./baseApiParams";

// Extracted out as utility function so can be reused
// at different endpoints that require this validation.
export const schemaQueryUserEmail = baseApiParams.extend({
email: z.string().email(),
email: emailSchema,
});

export const schemaQuerySingleOrMultipleUserEmails = z.object({
email: z.union([z.string().email(), z.array(z.string().email())]),
email: z.union([emailSchema, z.array(emailSchema)]),
});

export const withValidQueryUserEmail = withValidation({
Expand Down
5 changes: 3 additions & 2 deletions apps/api/v1/lib/validations/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { z } from "zod";

import { emailSchema } from "@calcom/lib/emailSchema";
import { checkUsername } from "@calcom/lib/server/checkUsername";
import { _UserModel as User } from "@calcom/prisma/zod";
import { iso8601 } from "@calcom/prisma/zod-utils";
Expand Down Expand Up @@ -92,7 +93,7 @@ export const schemaUserBaseBodyParams = User.pick({
// Here we can both require or not (adding optional or nullish) and also rewrite validations for any value
// for example making weekStart only accept weekdays as input
const schemaUserEditParams = z.object({
email: z.string().email().toLowerCase(),
email: emailSchema.toLowerCase(),
username: usernameSchema,
weekStart: z.nativeEnum(weekdays).optional(),
brandColor: z.string().min(4).max(9).regex(/^#/).optional(),
Expand All @@ -115,7 +116,7 @@ const schemaUserEditParams = z.object({
// merging both BaseBodyParams with RequiredParams, and omiting whatever we want at the end.

const schemaUserCreateParams = z.object({
email: z.string().email().toLowerCase(),
email: emailSchema.toLowerCase(),
username: usernameSchema,
weekStart: z.nativeEnum(weekdays).optional(),
brandColor: z.string().min(4).max(9).regex(/^#/).optional(),
Expand Down
Loading

0 comments on commit 24f52f5

Please sign in to comment.