-
Notifications
You must be signed in to change notification settings - Fork 12k
feat: Add support to audit and view audit log with Booking CREATED action #25468
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ea1a499
feat: Add BookingAuditViewerService demo with CREATED action only
hariombalhara 08df744
feat: Implement Booking Audit System with Tasker Integration
hariombalhara a996c34
refactor: Enhance BookingLogsView with improved filtering and display…
hariombalhara cfd43aa
feat: Introduce TaskerService for improved task management
hariombalhara 983d7c5
refactor: Enhance BookingLogsView with new filtering components and i…
hariombalhara c6d10ba
refactor: Convert Task class to TaskRepository with instance methods
devin-ai-integration[bot] 90778c5
fix failing tests
hariombalhara b92ca4b
Merge branch 'main' into booking-audit-viewer-demo
hariombalhara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
apps/api/v2/src/lib/services/booking-audit-producer.service.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { TaskerService } from "@/lib/services/tasker.service"; | ||
| import { Injectable } from "@nestjs/common"; | ||
|
|
||
| import { BookingAuditTaskerProducerService } from "@calcom/platform-libraries/bookings"; | ||
|
|
||
| @Injectable() | ||
| export class BookingAuditProducerService extends BookingAuditTaskerProducerService { | ||
| constructor(taskerService: TaskerService) { | ||
| super({ | ||
| tasker: taskerService.getTasker(), | ||
| }); | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Injectable } from "@nestjs/common"; | ||
|
|
||
| import { getTasker, type Tasker } from "@calcom/platform-libraries"; | ||
|
|
||
| @Injectable() | ||
| export class TaskerService { | ||
| private readonly tasker: Tasker; | ||
|
|
||
| constructor() { | ||
| this.tasker = getTasker(); | ||
| } | ||
|
|
||
| getTasker(): Tasker { | ||
| return this.tasker; | ||
| } | ||
| } | ||
|
|
||
|
|
48 changes: 48 additions & 0 deletions
48
apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||
| // Added as a separate route for now to ease the testing of the audit logs feature | ||||||
| // It partially matches the figma design - https://www.figma.com/design/wleA2SR6rn60EK7ORxAfMy/Cal.com-New-Features?node-id=5641-6732&p=f | ||||||
| // TOOD: Move it to the booking page side bar later | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: Typo in comment: "TOOD" should be "TODO". Prompt for AI agents
Suggested change
|
||||||
| import { ShellMainAppDir } from "app/(use-page-wrapper)/(main-nav)/ShellMainAppDir"; | ||||||
| import type { PageProps } from "app/_types"; | ||||||
| import { _generateMetadata, getTranslate } from "app/_utils"; | ||||||
| import { cookies, headers } from "next/headers"; | ||||||
| import { redirect } from "next/navigation"; | ||||||
|
|
||||||
| import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; | ||||||
|
|
||||||
| import { buildLegacyRequest } from "@lib/buildLegacyCtx"; | ||||||
|
|
||||||
| import BookingLogsView from "~/booking/logs/views/booking-logs-view"; | ||||||
|
|
||||||
| export const generateMetadata = async ({ params }: { params: Promise<{ uid: string }> }) => | ||||||
| await _generateMetadata( | ||||||
| (t) => t("booking_history"), | ||||||
| (t) => t("booking_history_description"), | ||||||
| undefined, | ||||||
| undefined, | ||||||
| `/booking/${(await params).uid}/logs` | ||||||
| ); | ||||||
|
|
||||||
| const Page = async ({ params }: PageProps) => { | ||||||
| const resolvedParams = await params; | ||||||
| const bookingUid = resolvedParams.uid; | ||||||
|
|
||||||
| if (!bookingUid || typeof bookingUid !== "string") { | ||||||
| redirect("/bookings/upcoming"); | ||||||
| } | ||||||
|
|
||||||
| const t = await getTranslate(); | ||||||
| const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) }); | ||||||
|
|
||||||
| if (!session?.user?.id) { | ||||||
| redirect("/auth/login"); | ||||||
| } | ||||||
|
|
||||||
| return ( | ||||||
| <ShellMainAppDir heading={t("booking_history")} subtitle={t("booking_history_description")}> | ||||||
| <BookingLogsView bookingUid={bookingUid} /> | ||||||
hariombalhara marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| </ShellMainAppDir> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
| export default Page; | ||||||
|
|
||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Something to consider while we're working on this is to add a permission check before logging more sensitive data.
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.
Yeah, I have been thinking about it. So right now I haven;t implemented permission check at all.
I believe audit logs is initially for admins only and they need to see all the data.
Going forward we might need to show audit logs for regular members too, and there we might need to hide certain details.