forked from Yara724/api
Fixed legacy requestedCounts methods and statistics + claimLink address
This commit is contained in:
52
src/users/entities/schema/expert-file-activity.schema.ts
Normal file
52
src/users/entities/schema/expert-file-activity.schema.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { HydratedDocument, Types } from "mongoose";
|
||||
|
||||
export type ExpertFileActivityDocument = HydratedDocument<ExpertFileActivity>;
|
||||
|
||||
export enum ExpertFileActivityType {
|
||||
CHECKED = "checked",
|
||||
HANDLED = "handled",
|
||||
UNCHECKED = "unchecked",
|
||||
}
|
||||
|
||||
export enum ExpertFileKind {
|
||||
BLAME = "blame",
|
||||
CLAIM = "claim",
|
||||
}
|
||||
|
||||
@Schema({ collection: "expertFileActivities", timestamps: true })
|
||||
export class ExpertFileActivity {
|
||||
@Prop({ type: Types.ObjectId, required: true, index: true })
|
||||
expertId: Types.ObjectId;
|
||||
|
||||
@Prop({ type: Types.ObjectId, required: true, index: true })
|
||||
tenantId: Types.ObjectId;
|
||||
|
||||
@Prop({ type: Types.ObjectId, required: true, index: true })
|
||||
fileId: Types.ObjectId;
|
||||
|
||||
@Prop({ type: String, enum: ExpertFileKind, required: true, index: true })
|
||||
fileType: ExpertFileKind;
|
||||
|
||||
@Prop({
|
||||
type: String,
|
||||
enum: ExpertFileActivityType,
|
||||
required: true,
|
||||
index: true,
|
||||
})
|
||||
eventType: ExpertFileActivityType;
|
||||
|
||||
@Prop({ type: Date, default: Date.now, index: true })
|
||||
occurredAt: Date;
|
||||
|
||||
@Prop({ type: String, required: false, index: true })
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export const ExpertFileActivitySchema =
|
||||
SchemaFactory.createForClass(ExpertFileActivity);
|
||||
|
||||
ExpertFileActivitySchema.index(
|
||||
{ idempotencyKey: 1 },
|
||||
{ unique: true, partialFilterExpression: { idempotencyKey: { $exists: true } } },
|
||||
);
|
||||
Reference in New Issue
Block a user