mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-05 01:02:59 +08:00
@@ -1,14 +1,14 @@
|
||||
import { Schema, getMongoLogModel } from '../../../common/mongo';
|
||||
import { type OperationLogSchema } from '@fastgpt/global/support/user/audit/type';
|
||||
import { type TeamAuditSchemaType } from '@fastgpt/global/support/user/audit/type';
|
||||
import { AdminAuditEventEnum, AuditEventEnum } from '@fastgpt/global/support/user/audit/constants';
|
||||
import {
|
||||
TeamCollectionName,
|
||||
TeamMemberCollectionName
|
||||
} from '@fastgpt/global/support/user/team/constant';
|
||||
|
||||
export const OperationLogCollectionName = 'operationLogs';
|
||||
export const TeamAuditCollectionName = 'operationLogs';
|
||||
|
||||
const OperationLogSchema = new Schema({
|
||||
const TeamAuditSchema = new Schema({
|
||||
tmbId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: TeamMemberCollectionName,
|
||||
@@ -34,9 +34,10 @@ const OperationLogSchema = new Schema({
|
||||
}
|
||||
});
|
||||
|
||||
OperationLogSchema.index({ teamId: 1, tmbId: 1, event: 1 });
|
||||
TeamAuditSchema.index({ teamId: 1, tmbId: 1, event: 1 });
|
||||
TeamAuditSchema.index({ timestamp: 1, teamId: 1 });
|
||||
|
||||
export const MongoOperationLog = getMongoLogModel<OperationLogSchema>(
|
||||
OperationLogCollectionName,
|
||||
OperationLogSchema
|
||||
export const MongoTeamAudit = getMongoLogModel<TeamAuditSchemaType>(
|
||||
TeamAuditCollectionName,
|
||||
TeamAuditSchema
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { i18nT } from '../../../../web/i18n/utils';
|
||||
import { MongoOperationLog } from './schema';
|
||||
import { MongoTeamAudit } from './schema';
|
||||
import type {
|
||||
AdminAuditEventEnum,
|
||||
AuditEventEnum,
|
||||
@@ -86,7 +86,7 @@ export function addAuditLog<T extends AuditEventEnum | AdminAuditEventEnum>({
|
||||
params?: any;
|
||||
}) {
|
||||
retryFn(() =>
|
||||
MongoOperationLog.create({
|
||||
MongoTeamAudit.create({
|
||||
tmbId: tmbId,
|
||||
teamId: teamId,
|
||||
event,
|
||||
|
||||
Reference in New Issue
Block a user