-
Notifications
You must be signed in to change notification settings - Fork 10.2k
feat: booking audit log #22817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: booking audit log #22817
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
export type BookingAuditData = { | ||
version?: number; | ||
actor?: { | ||
type: "User" | "System" | "Attendee"; | ||
}; | ||
booking?: { | ||
meetingTime?: string; | ||
totalReschedules?: number; | ||
attendeeCountChange?: number; | ||
cancellationReason?: string; | ||
rejectionReason?: string; | ||
assignmentReason?: string; | ||
reassignmentReason?: string; | ||
}; | ||
attendee?: { | ||
id?: string; | ||
}; | ||
meeting?: { | ||
provider?: string; | ||
meetingId?: string; | ||
meetingUrl?: string; | ||
}; | ||
location?: { | ||
type?: string; | ||
address?: string; | ||
details?: Record<string, unknown>; | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emrysal Does this make sense as the structure? Anything I'm missing out on, or extra/unnecessary? Did you have the same vision about the versioning?
@@ -0,0 +1,8 @@ | |||
import type { BookingAudit, Prisma } from "@prisma/client"; | |||
|
|||
export interface IBookingAuditRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repository interface should be lightly decoupled from Prisma - use a DTO
e.g.
import type { BookingAuditCreateInput, BookingAudit } from "./dto/bookingAudit";
type BookingAuditCreateInput = Prisma.BookingAuditCreateInput;
...
}) | ||
.optional(); | ||
|
||
export type BookingAuditData = z.infer<typeof BookingAuditDataSchema>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try not to use z.infer if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
z.infer seems like the idiomatic way to infer types from the zod schema. Is there a reason why we should avoid it? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's heavy on TS, but it is idiomatic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the recommended alternative?
data?: BookingAuditData | null; | ||
}; | ||
|
||
const CURRENT_AUDIT_DATA_VERSION = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Versioning should be done on the action, not on the entire table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand on this? I'm not sure I follow 🤔
Currently we version the data's structure to then be able to parse correctly in the future when any further changes comes in. Was that not the purpose/intention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but this is per payload type, not the entire table 👍
What does this PR do?
Visual Demo (For contributors especially)
A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).
Video Demo (if applicable):
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist