فهرست منبع

Merge branch 'feat/auditlog' of https://github.com/weseek/growi into feat/auditlog

Shun Miyazawa 3 سال پیش
والد
کامیت
90ea083f81

+ 1 - 1
packages/app/src/components/Admin/AuditLog/ActivityTable.tsx

@@ -28,7 +28,7 @@ export const ActivityTable : FC<Props> = (props: Props) => {
           {props.activityList.map((activity) => {
             return (
               <tr data-testid="activity-table" key={activity._id}>
-                <td>{activity.user?.username}</td>
+                <td>{activity.snapshot?.username}</td>
                 <td>{activity.targetModel}</td>
                 <td>{activity.action}</td>
                 <td>{formatDate(activity.createdAt)}</td>

+ 0 - 1
packages/app/src/components/Admin/AuditLogManagement.tsx

@@ -58,7 +58,6 @@ export const AuditLogManagement: FC = () => {
   }, []);
 
   const datePickerChangedHandler = useCallback((dateList: Date[] | null[]) => {
-    console.log(dateList);
     setActivePage(1);
     setStartDate(dateList[0]);
     setEndDate(dateList[1]);

+ 4 - 3
packages/app/src/interfaces/activity.ts

@@ -66,14 +66,15 @@ export type SupportedTargetModelType = typeof SUPPORTED_TARGET_MODEL_TYPE[keyof
 export type SupportedActionType = typeof SUPPORTED_ACTION_TYPE[keyof typeof SUPPORTED_ACTION_TYPE];
 
 
+export type ISnapshot = Partial<Pick<IUser, 'username'>>
+
 export type IActivity = {
   user?: IUser
   targetModel: SupportedTargetModelType
-  targe: string
+  target: string
   action: SupportedActionType
   createdAt: Date
+  snapshot?: ISnapshot
 }
 
 export type IActivityHasId = IActivity & HasObjectId;
-
-export type ISnapshot = Pick<IUser, 'username'>

+ 1 - 2
packages/app/src/server/routes/apiv3/activity.ts

@@ -3,13 +3,12 @@ import express, { Request, Router } from 'express';
 import rateLimit from 'express-rate-limit';
 import { query } from 'express-validator';
 
-import { IActivity, AllSupportedActionType } from '~/interfaces/activity';
+import { AllSupportedActionType } from '~/interfaces/activity';
 import Activity from '~/server/models/activity';
 import loggerFactory from '~/utils/logger';
 
 import Crowi from '../../crowi';
 import { apiV3FormValidator } from '../../middlewares/apiv3-form-validator';
-import { serializeUserSecurely } from '../../models/serializers/user-serializer';
 
 import { ApiV3Response } from './interfaces/apiv3-response';