Feature/additional fields (#189)

Added timeZone, attendees.(email, name, timeZone, locale), user.(email,
name, timeZone, locale) & metadata
This commit is contained in:
Alex van Andel authored and GitHub committed 2022-10-19 17:03:54 +01:00
1 parent 07b011424f
commit ce2df7641f
5 files changed
+111 -3

No files matched your search

+21 -2
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import { _BookingModel as Booking } from "@calcom/prisma/zod";
import { _BookingModel as Booking, _AttendeeModel, _UserModel } from "@calcom/prisma/zod";
import { extendedBookingCreateBody } from "@calcom/prisma/zod-utils";
import { schemaQueryUserId } from "./shared/queryUserId";
@@ -27,7 +27,22 @@ const schemaBookingEditParams = z
export const schemaBookingEditBodyParams = schemaBookingBaseBodyParams.merge(schemaBookingEditParams);
export const schemaBookingReadPublic = Booking.pick({
export const schemaBookingReadPublic = Booking.extend({
attendees: z.array(
_AttendeeModel.pick({
email: true,
name: true,
timeZone: true,
locale: true,
})
),
user: _UserModel.pick({
email: true,
name: true,
timeZone: true,
locale: true,
}),
}).pick({
id: true,
userId: true,
description: true,
@@ -36,4 +51,8 @@ export const schemaBookingReadPublic = Booking.pick({
title: true,
startTime: true,
endTime: true,
timeZone: true,
attendees: true,
user: true,
metadata: true,
});
+4
View File
@@ -23,6 +23,10 @@ import { schemaQueryIdParseInt } from "@lib/validations/shared/queryIdTransformP
* responses:
* 200:
* description: OK
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/Booking"
* 401:
* description: Authorization information is missing or invalid.
* 404:
+4
View File
@@ -17,6 +17,10 @@ import { schemaQuerySingleOrMultipleUserIds } from "@lib/validations/shared/quer
* responses:
* 200:
* description: OK
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/ArrayOfBookings"
* 401:
* description: Authorization information is missing or invalid.
* 404:
+1 -1
View File
@@ -26,7 +26,7 @@ import { defaultResponder } from "@calcom/lib/server";
* endTime:
* type: string
* example: 1970-01-01T17:00:00.000Z
* recurringCount:
* recurringCount:
* type: number
* example: 8
* tags:
+81
View File
@@ -22,6 +22,87 @@ const swaggerHandler = withSwagger({
},
components: {
securitySchemes: { ApiKeyAuth: { type: "apiKey", in: "query", name: "apiKey" } },
schemas: {
ArrayOfBookings: {
type: "array",
items: {
$ref: "#/components/schemas/Booking",
},
},
Booking: {
properties: {
id: {
type: "number",
},
description: {
type: "string",
},
eventTypeId: {
type: "number",
},
uid: {
type: "string",
format: "uuid",
},
title: {
type: "string",
},
startTime: {
type: "string",
format: "date-time",
},
endTime: {
type: "string",
format: "date-time",
},
timeZone: {
type: "string",
example: "Europe/London",
},
attendees: {
type: "array",
items: {
properties: {
email: {
type: "string",
example: "[email protected]",
},
name: {
type: "string",
},
timeZone: {
type: "string",
example: "Europe/London",
},
locale: {
type: "string",
example: "en",
},
},
},
},
user: {
properties: {
email: {
type: "string",
example: "[email protected]",
},
name: {
type: "string",
},
timeZone: {
type: "string",
example: "Europe/London",
},
locale: {
type: "string",
example: "en",
},
},
},
},
},
},
},
security: [{ ApiKeyAuth: [] }],
tags: [