Files
stack/apps/api/src/activity/interfaces/activity.interface.ts
Jason Woltje d361d00674
Some checks failed
ci/woodpecker/push/ci Pipeline failed
fix: Logs page — activity_logs, optional workspaceId, autoRefresh on (#637)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-03-01 22:10:16 +00:00

59 lines
1.2 KiB
TypeScript

import type { ActivityAction, EntityType, Prisma } from "@prisma/client";
/**
* Interface for creating a new activity log entry
* workspaceId is optional - allows logging events without workspace context
*/
export interface CreateActivityLogInput {
workspaceId?: string | null;
userId: string;
action: ActivityAction;
entityType: EntityType;
entityId: string;
details?: Prisma.JsonValue;
ipAddress?: string | undefined;
userAgent?: string | undefined;
}
/**
* Interface for activity log query filters
*/
export interface ActivityLogFilters {
workspaceId: string;
userId?: string;
action?: ActivityAction;
entityType?: EntityType;
entityId?: string;
startDate?: Date;
endDate?: Date;
}
/**
* Type for activity log result with user info
* Uses Prisma's generated type for type safety
*/
export type ActivityLogResult = Prisma.ActivityLogGetPayload<{
include: {
user: {
select: {
id: true;
name: true;
email: true;
};
};
};
}>;
/**
* Interface for paginated activity log results
*/
export interface PaginatedActivityLogs {
data: ActivityLogResult[];
meta: {
total: number;
page: number;
limit: number;
totalPages: number;
};
}