forked from Yara724/api
fanavaran duplication request problems fixed.
This commit is contained in:
@@ -62,12 +62,33 @@ export class FanavaranAuditLog {
|
||||
@Prop({ type: String, required: false })
|
||||
requestUrl?: string;
|
||||
|
||||
@Prop({ type: String, required: false })
|
||||
requestMethod?: string;
|
||||
|
||||
@Prop({ type: Number, required: false })
|
||||
httpStatus?: number;
|
||||
|
||||
/** Sanitized outbound headers (secrets masked). */
|
||||
@Prop({ type: Object, required: false })
|
||||
requestHeaders?: Record<string, unknown>;
|
||||
|
||||
/** Outbound JSON/body (truncated; secrets masked). */
|
||||
@Prop({ type: Object, required: false })
|
||||
requestBody?: unknown;
|
||||
|
||||
/** Compact structured facts (ids, flags) — kept for filtering/dashboards. */
|
||||
@Prop({ type: Object, required: false })
|
||||
requestMeta?: Record<string, unknown>;
|
||||
|
||||
/** Sanitized inbound response headers. */
|
||||
@Prop({ type: Object, required: false })
|
||||
responseHeaders?: Record<string, unknown>;
|
||||
|
||||
/** Inbound response body (truncated). */
|
||||
@Prop({ type: Object, required: false })
|
||||
responseBody?: unknown;
|
||||
|
||||
/** Compact structured facts from the response. */
|
||||
@Prop({ type: Object, required: false })
|
||||
responseMeta?: Record<string, unknown>;
|
||||
|
||||
@@ -86,3 +107,4 @@ export const FanavaranAuditLogSchema =
|
||||
SchemaFactory.createForClass(FanavaranAuditLog);
|
||||
|
||||
FanavaranAuditLogSchema.index({ trackingCode: 1, createdAt: 1 });
|
||||
FanavaranAuditLogSchema.index({ claimCaseId: 1, createdAt: 1 });
|
||||
|
||||
24
src/fanavaran/schema/fanavaran-auth-token.schema.ts
Normal file
24
src/fanavaran/schema/fanavaran-auth-token.schema.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { HydratedDocument } from "mongoose";
|
||||
import type { FanavaranClientKey } from "src/core/config/fanavaran-client.config";
|
||||
|
||||
/**
|
||||
* Shared Fanavaran authenticationToken per tenant.
|
||||
* Survives process restarts / multi-instance so we do not Login on every request.
|
||||
*/
|
||||
@Schema({ collection: "fanavaranAuthTokens", timestamps: true })
|
||||
export class FanavaranAuthToken {
|
||||
@Prop({ type: String, required: true, unique: true, index: true })
|
||||
clientKey: FanavaranClientKey;
|
||||
|
||||
@Prop({ type: String, required: true })
|
||||
authenticationToken: string;
|
||||
|
||||
/** When this token should be refreshed (Asia/Tehran midnight). */
|
||||
@Prop({ type: Date, required: true, index: true })
|
||||
expiresAt: Date;
|
||||
}
|
||||
|
||||
export type FanavaranAuthTokenDocument = HydratedDocument<FanavaranAuthToken>;
|
||||
export const FanavaranAuthTokenSchema =
|
||||
SchemaFactory.createForClass(FanavaranAuthToken);
|
||||
Reference in New Issue
Block a user