Compare commits
2 Commits
main
...
fix/ui-but
Author | SHA1 | Date | |
---|---|---|---|
c5d4d281ea | |||
0e24a9e22a |
|
@ -78,10 +78,7 @@ async function patchHandler(req: NextApiRequest) {
|
||||||
confirmed,
|
confirmed,
|
||||||
} = bookingConfirmPatchBodySchema.parse(req.body);
|
} = bookingConfirmPatchBodySchema.parse(req.body);
|
||||||
|
|
||||||
const currentUser = await prisma.user.findFirst({
|
const currentUser = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound() {
|
|
||||||
throw new HttpError({ statusCode: 404, message: "User not found" });
|
|
||||||
},
|
|
||||||
where: {
|
where: {
|
||||||
id: session.user.id,
|
id: session.user.id,
|
||||||
},
|
},
|
||||||
|
@ -101,13 +98,10 @@ async function patchHandler(req: NextApiRequest) {
|
||||||
|
|
||||||
const tOrganizer = await getTranslation(currentUser.locale ?? "en", "common");
|
const tOrganizer = await getTranslation(currentUser.locale ?? "en", "common");
|
||||||
|
|
||||||
const booking = await prisma.booking.findFirst({
|
const booking = await prisma.booking.findFirstOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id: bookingId,
|
id: bookingId,
|
||||||
},
|
},
|
||||||
rejectOnNotFound() {
|
|
||||||
throw new HttpError({ statusCode: 404, message: "Booking not found" });
|
|
||||||
},
|
|
||||||
select: {
|
select: {
|
||||||
title: true,
|
title: true,
|
||||||
description: true,
|
description: true,
|
||||||
|
|
|
@ -111,8 +111,7 @@ function isAvailable(busyTimes: BufferedBusyTimes, time: dayjs.ConfigType, lengt
|
||||||
}
|
}
|
||||||
|
|
||||||
const getEventTypesFromDB = async (eventTypeId: number) => {
|
const getEventTypesFromDB = async (eventTypeId: number) => {
|
||||||
const eventType = await prisma.eventType.findUnique({
|
const eventType = await prisma.eventType.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: eventTypeId,
|
id: eventTypeId,
|
||||||
},
|
},
|
||||||
|
@ -645,10 +644,8 @@ async function handler(req: NextApiRequest) {
|
||||||
|
|
||||||
if (typeof eventType.price === "number" && eventType.price > 0) {
|
if (typeof eventType.price === "number" && eventType.price > 0) {
|
||||||
/* Validate if there is any stripe_payment credential for this user */
|
/* Validate if there is any stripe_payment credential for this user */
|
||||||
await prisma.credential.findFirst({
|
/* note: removes custom error message about stripe */
|
||||||
rejectOnNotFound(err) {
|
await prisma.credential.findFirstOrThrow({
|
||||||
throw new HttpError({ statusCode: 400, message: "Missing stripe credentials", cause: err });
|
|
||||||
},
|
|
||||||
where: {
|
where: {
|
||||||
type: "stripe_payment",
|
type: "stripe_payment",
|
||||||
userId: organizerUser.id,
|
userId: organizerUser.id,
|
||||||
|
|
|
@ -40,8 +40,7 @@ const rescheduleSchema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
const findUserDataByUserId = async (userId: number) => {
|
const findUserDataByUserId = async (userId: number) => {
|
||||||
return await prisma.user.findUnique({
|
return await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: userId,
|
id: userId,
|
||||||
},
|
},
|
||||||
|
@ -76,7 +75,7 @@ const handler = async (
|
||||||
return res.status(501).end();
|
return res.status(501).end();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bookingToReschedule = await prisma.booking.findFirst({
|
const bookingToReschedule = await prisma.booking.findFirstOrThrow({
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
uid: true,
|
uid: true,
|
||||||
|
@ -95,7 +94,6 @@ const handler = async (
|
||||||
dynamicGroupSlugRef: true,
|
dynamicGroupSlugRef: true,
|
||||||
destinationCalendar: true,
|
destinationCalendar: true,
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
uid: bookingId,
|
uid: bookingId,
|
||||||
NOT: {
|
NOT: {
|
||||||
|
@ -127,14 +125,13 @@ const handler = async (
|
||||||
if (bookingToReschedule && user) {
|
if (bookingToReschedule && user) {
|
||||||
let event: Partial<EventType> = {};
|
let event: Partial<EventType> = {};
|
||||||
if (bookingToReschedule.eventTypeId) {
|
if (bookingToReschedule.eventTypeId) {
|
||||||
event = await prisma.eventType.findFirst({
|
event = await prisma.eventType.findFirstOrThrow({
|
||||||
select: {
|
select: {
|
||||||
title: true,
|
title: true,
|
||||||
users: true,
|
users: true,
|
||||||
schedulingType: true,
|
schedulingType: true,
|
||||||
recurringEvent: true,
|
recurringEvent: true,
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: bookingToReschedule.eventTypeId,
|
id: bookingToReschedule.eventTypeId,
|
||||||
},
|
},
|
||||||
|
|
|
@ -106,7 +106,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
throw new HttpError({ statusCode: 404, message: "User not found" });
|
throw new HttpError({ statusCode: 404, message: "User not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const organizer = await prisma.user.findFirst({
|
const organizer = await prisma.user.findFirstOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id: bookingToDelete.userId,
|
id: bookingToDelete.userId,
|
||||||
},
|
},
|
||||||
|
@ -116,7 +116,6 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
timeZone: true,
|
timeZone: true,
|
||||||
locale: true,
|
locale: true,
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const attendeesListPromises = bookingToDelete.attendees.map(async (attendee) => {
|
const attendeesListPromises = bookingToDelete.attendees.map(async (attendee) => {
|
||||||
|
|
|
@ -32,8 +32,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: session.user.id,
|
id: session.user.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,8 +15,7 @@ type CalendlyEventType = {
|
||||||
|
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const session = await getSession({ req });
|
const session = await getSession({ req });
|
||||||
const authenticatedUser = await prisma.user.findFirst({
|
const authenticatedUser = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: session?.user.id,
|
id: session?.user.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,8 +15,7 @@ type SavvyCalEventType = {
|
||||||
|
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const session = await getSession({ req });
|
const session = await getSession({ req });
|
||||||
const authenticatedUser = await prisma.user.findFirst({
|
const authenticatedUser = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: session?.user.id,
|
id: session?.user.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,13 +12,12 @@ export async function getHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
try {
|
try {
|
||||||
const session = await getSession({ req });
|
const session = await getSession({ req });
|
||||||
const userId = session?.user?.id;
|
const userId = session?.user?.id;
|
||||||
const user = await prisma.user.findFirst({
|
const user = await prisma.user.findFirstOrThrow({
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
metadata: true,
|
metadata: true,
|
||||||
},
|
},
|
||||||
where: { id: userId },
|
where: { id: userId },
|
||||||
rejectOnNotFound: true,
|
|
||||||
});
|
});
|
||||||
const checkPremiumUsernameResult = await checkUsername(intentUsername);
|
const checkPremiumUsernameResult = await checkUsername(intentUsername);
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: session.user.id,
|
id: session.user.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,8 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
throw new HttpCode({ statusCode: 405, message: "Method Not Allowed" });
|
throw new HttpCode({ statusCode: 405, message: "Method Not Allowed" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: session.user.id,
|
id: session.user.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,8 +24,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
return res.status(400).json({ message: "No user id provided" });
|
return res.status(400).json({ message: "No user id provided" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const authenticatedUser = await prisma.user.findFirst({
|
const authenticatedUser = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: session.user.id,
|
id: session.user.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,8 +18,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
|
|
||||||
if (req.method === "DELETE") {
|
if (req.method === "DELETE") {
|
||||||
// Get user
|
// Get user
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: session.user?.id,
|
id: session.user?.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -206,8 +206,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||||
const id = context.params?.id as string;
|
const id = context.params?.id as string;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resetPasswordRequest = await prisma.resetPasswordRequest.findUnique({
|
const resetPasswordRequest = await prisma.resetPasswordRequest.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id,
|
id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -54,8 +54,7 @@ export const createUsersFixture = (page: Page, workerInfo: WorkerInfo) => {
|
||||||
length: 30,
|
length: 30,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: { id: _user.id },
|
where: { id: _user.id },
|
||||||
include: userIncludes,
|
include: userIncludes,
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,8 +10,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
if (req.method === "POST") {
|
if (req.method === "POST") {
|
||||||
const { username, password } = req.body;
|
const { username, password } = req.body;
|
||||||
// Get user
|
// Get user
|
||||||
const user = await prisma.user.findFirst({
|
const user = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: req.session?.user?.id,
|
id: req.session?.user?.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,8 +10,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
if (req.method === "POST") {
|
if (req.method === "POST") {
|
||||||
const { username, password, url } = req.body;
|
const { username, password, url } = req.body;
|
||||||
// Get user
|
// Get user
|
||||||
const user = await prisma.user.findFirst({
|
const user = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: req.session?.user?.id,
|
id: req.session?.user?.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,8 +19,7 @@ const bodySchema = z
|
||||||
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const body = bodySchema.parse(req.body);
|
const body = bodySchema.parse(req.body);
|
||||||
// Get user
|
// Get user
|
||||||
const user = await prisma.user.findFirst({
|
const user = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: req.session?.user?.id,
|
id: req.session?.user?.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,8 +19,7 @@ const bodySchema = z
|
||||||
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const body = bodySchema.parse(req.body);
|
const body = bodySchema.parse(req.body);
|
||||||
// Get user
|
// Get user
|
||||||
const user = await prisma.user.findFirst({
|
const user = await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: req.session?.user?.id,
|
id: req.session?.user?.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,8 +16,7 @@ async function handler(req: NextApiRequest) {
|
||||||
|
|
||||||
const { client_id } = await getSlackAppKeys();
|
const { client_id } = await getSlackAppKeys();
|
||||||
// Get user
|
// Get user
|
||||||
await prisma.user.findFirst({
|
await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: req.session.user.id,
|
id: req.session.user.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -42,8 +42,7 @@ export default async function createEvent(req: NextApiRequest, res: NextApiRespo
|
||||||
|
|
||||||
// Im sure this query can be made more efficient... The JSON filtering wouldnt work when doing it directly on user.
|
// Im sure this query can be made more efficient... The JSON filtering wouldnt work when doing it directly on user.
|
||||||
const foundUser = await db.credential
|
const foundUser = await db.credential
|
||||||
.findFirst({
|
.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
...WhereCredsEqualsId(user.id),
|
...WhereCredsEqualsId(user.id),
|
||||||
})
|
})
|
||||||
.user({
|
.user({
|
||||||
|
|
|
@ -12,8 +12,7 @@ let base_url = "";
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
if (req.method === "GET") {
|
if (req.method === "GET") {
|
||||||
// Get user
|
// Get user
|
||||||
await prisma.user.findFirst({
|
await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: req.session?.user?.id,
|
id: req.session?.user?.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -57,8 +57,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
try {
|
try {
|
||||||
if (event.data.user_id) {
|
if (event.data.user_id) {
|
||||||
const json = { userVitalId: event.data.user_id as string };
|
const json = { userVitalId: event.data.user_id as string };
|
||||||
const credential = await prisma.credential.findFirst({
|
const credential = await prisma.credential.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
type: "vital_other",
|
type: "vital_other",
|
||||||
key: {
|
key: {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { getCalendar } from "../../_utils/getCalendar";
|
||||||
type PersonAttendeeCommonFields = Pick<User, "id" | "email" | "name" | "locale" | "timeZone" | "username">;
|
type PersonAttendeeCommonFields = Pick<User, "id" | "email" | "name" | "locale" | "timeZone" | "username">;
|
||||||
|
|
||||||
const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||||
const bookingToReschedule = await prisma.booking.findFirst({
|
const bookingToReschedule = await prisma.booking.findFirstOrThrow({
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
uid: true,
|
uid: true,
|
||||||
|
@ -42,7 +42,6 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
uid: bookingUid,
|
uid: bookingUid,
|
||||||
NOT: {
|
NOT: {
|
||||||
|
@ -55,13 +54,12 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||||
|
|
||||||
if (bookingToReschedule && bookingToReschedule.eventTypeId && bookingToReschedule.user) {
|
if (bookingToReschedule && bookingToReschedule.eventTypeId && bookingToReschedule.user) {
|
||||||
const userOwner = bookingToReschedule.user;
|
const userOwner = bookingToReschedule.user;
|
||||||
const event = await prisma.eventType.findFirst({
|
const event = await prisma.eventType.findFirstOrThrow({
|
||||||
select: {
|
select: {
|
||||||
title: true,
|
title: true,
|
||||||
users: true,
|
users: true,
|
||||||
schedulingType: true,
|
schedulingType: true,
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: bookingToReschedule.eventTypeId,
|
id: bookingToReschedule.eventTypeId,
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { getCalendar } from "../../_utils/getCalendar";
|
||||||
type PersonAttendeeCommonFields = Pick<User, "id" | "email" | "name" | "locale" | "timeZone" | "username">;
|
type PersonAttendeeCommonFields = Pick<User, "id" | "email" | "name" | "locale" | "timeZone" | "username">;
|
||||||
|
|
||||||
const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||||
const bookingToReschedule = await prisma.booking.findFirst({
|
const bookingToReschedule = await prisma.booking.findFirstOrThrow({
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
uid: true,
|
uid: true,
|
||||||
|
@ -42,7 +42,6 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
uid: bookingUid,
|
uid: bookingUid,
|
||||||
NOT: {
|
NOT: {
|
||||||
|
@ -55,13 +54,12 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||||
|
|
||||||
if (bookingToReschedule && bookingToReschedule.eventTypeId && bookingToReschedule.user) {
|
if (bookingToReschedule && bookingToReschedule.eventTypeId && bookingToReschedule.user) {
|
||||||
const userOwner = bookingToReschedule.user;
|
const userOwner = bookingToReschedule.user;
|
||||||
const event = await prisma.eventType.findFirst({
|
const event = await prisma.eventType.findFirstOrThrow({
|
||||||
select: {
|
select: {
|
||||||
title: true,
|
title: true,
|
||||||
users: true,
|
users: true,
|
||||||
schedulingType: true,
|
schedulingType: true,
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: bookingToReschedule.eventTypeId,
|
id: bookingToReschedule.eventTypeId,
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,8 +9,7 @@ import { getZoomAppKeys } from "../lib";
|
||||||
|
|
||||||
async function handler(req: NextApiRequest) {
|
async function handler(req: NextApiRequest) {
|
||||||
// Get user
|
// Get user
|
||||||
await prisma.user.findFirst({
|
await prisma.user.findFirstOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: req.session?.user?.id,
|
id: req.session?.user?.id,
|
||||||
},
|
},
|
||||||
|
|
|
@ -95,8 +95,7 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
|
||||||
private async getUserById(userId: number) {
|
private async getUserById(userId: number) {
|
||||||
let resultUser: User | null;
|
let resultUser: User | null;
|
||||||
try {
|
try {
|
||||||
resultUser = await prisma.user.findUnique({
|
resultUser = await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: userId,
|
id: userId,
|
||||||
},
|
},
|
||||||
|
@ -111,8 +110,7 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
|
||||||
private async getEventFromEventId(eventTypeId: number) {
|
private async getEventFromEventId(eventTypeId: number) {
|
||||||
let resultEventType;
|
let resultEventType;
|
||||||
try {
|
try {
|
||||||
resultEventType = await prisma.eventType.findUnique({
|
resultEventType = await prisma.eventType.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: eventTypeId,
|
id: eventTypeId,
|
||||||
},
|
},
|
||||||
|
@ -223,8 +221,7 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
|
||||||
public async setUsersFromId(userId: User["id"]) {
|
public async setUsersFromId(userId: User["id"]) {
|
||||||
let resultUser: User | null;
|
let resultUser: User | null;
|
||||||
try {
|
try {
|
||||||
resultUser = await prisma.user.findUnique({
|
resultUser = await prisma.user.findUniqueOrThrow({
|
||||||
rejectOnNotFound: true,
|
|
||||||
where: {
|
where: {
|
||||||
id: userId,
|
id: userId,
|
||||||
},
|
},
|
||||||
|
|
|
@ -81,7 +81,7 @@ export const bookingsRouter = createProtectedRouter()
|
||||||
const { booking } = ctx;
|
const { booking } = ctx;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const organizer = await ctx.prisma.user.findFirst({
|
const organizer = await ctx.prisma.user.findFirstOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id: booking.userId || 0,
|
id: booking.userId || 0,
|
||||||
},
|
},
|
||||||
|
@ -91,7 +91,6 @@ export const bookingsRouter = createProtectedRouter()
|
||||||
timeZone: true,
|
timeZone: true,
|
||||||
locale: true,
|
locale: true,
|
||||||
},
|
},
|
||||||
rejectOnNotFound: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const tOrganizer = await getTranslation(organizer.locale ?? "en", "common");
|
const tOrganizer = await getTranslation(organizer.locale ?? "en", "common");
|
||||||
|
|
|
@ -14,6 +14,7 @@ export type ButtonBaseProps = {
|
||||||
StartIcon?: SVGComponent;
|
StartIcon?: SVGComponent;
|
||||||
startIconClassName?: string;
|
startIconClassName?: string;
|
||||||
EndIcon?: SVGComponent;
|
EndIcon?: SVGComponent;
|
||||||
|
endIconClassName?: string;
|
||||||
shallow?: boolean;
|
shallow?: boolean;
|
||||||
};
|
};
|
||||||
export type ButtonProps = ButtonBaseProps &
|
export type ButtonProps = ButtonBaseProps &
|
||||||
|
@ -32,6 +33,7 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
||||||
size = "base",
|
size = "base",
|
||||||
StartIcon,
|
StartIcon,
|
||||||
startIconClassName,
|
startIconClassName,
|
||||||
|
endIconClassName,
|
||||||
EndIcon,
|
EndIcon,
|
||||||
shallow,
|
shallow,
|
||||||
// attributes propagated from `HTMLAnchorProps` or `HTMLButtonProps`
|
// attributes propagated from `HTMLAnchorProps` or `HTMLButtonProps`
|
||||||
|
@ -130,7 +132,9 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{EndIcon && <EndIcon className="-mr-1 inline h-5 w-5 ltr:ml-2 rtl:mr-2" />}
|
{EndIcon && (
|
||||||
|
<EndIcon className={classNames("-mr-1 inline h-5 w-5 ltr:ml-2 rtl:mr-2", endIconClassName || "")} />
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
return props.href ? (
|
return props.href ? (
|
||||||
|
|
|
@ -20,6 +20,7 @@ export function Tooltip({
|
||||||
onOpenChange?: (open: boolean) => void;
|
onOpenChange?: (open: boolean) => void;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
|
<TooltipPrimitive.Provider>
|
||||||
<TooltipPrimitive.Root
|
<TooltipPrimitive.Root
|
||||||
delayDuration={50}
|
delayDuration={50}
|
||||||
open={open}
|
open={open}
|
||||||
|
@ -38,6 +39,7 @@ export function Tooltip({
|
||||||
{content}
|
{content}
|
||||||
</TooltipPrimitive.Content>
|
</TooltipPrimitive.Content>
|
||||||
</TooltipPrimitive.Root>
|
</TooltipPrimitive.Root>
|
||||||
|
</TooltipPrimitive.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user