From 6a1cda5da12de08cbf771e921b88245ecaa31255 Mon Sep 17 00:00:00 2001 From: junjiequan Date: Thu, 12 Dec 2024 16:52:46 +0100 Subject: [PATCH] minor fixes --- .../access-logs/schemas/access-log.schema.ts | 1 - src/metrics-and-logs/metrics/schemas/metrics.schema.ts | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/metrics-and-logs/access-logs/schemas/access-log.schema.ts b/src/metrics-and-logs/access-logs/schemas/access-log.schema.ts index acfe02bb8..523d87e95 100644 --- a/src/metrics-and-logs/access-logs/schemas/access-log.schema.ts +++ b/src/metrics-and-logs/access-logs/schemas/access-log.schema.ts @@ -9,7 +9,6 @@ export type AccessLogDocument = AccessLog & Document; timestamps: { createdAt: true, updatedAt: false }, versionKey: false, }) -@Schema() export class AccessLog { @ApiPropertyOptional({ description: "User ID associated with the access log", diff --git a/src/metrics-and-logs/metrics/schemas/metrics.schema.ts b/src/metrics-and-logs/metrics/schemas/metrics.schema.ts index f8029e987..630669a21 100644 --- a/src/metrics-and-logs/metrics/schemas/metrics.schema.ts +++ b/src/metrics-and-logs/metrics/schemas/metrics.schema.ts @@ -1,5 +1,5 @@ import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; -import { ApiProperty } from "@nestjs/swagger"; +import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { Date, Document } from "mongoose"; import { MetricsRecord } from "./metrics-record.schema"; @@ -11,12 +11,12 @@ export type MetricsDocument = Metrics & Document; versionKey: false, }) export class Metrics { - @ApiProperty({ + @ApiPropertyOptional({ description: "The date the metric was recorded", - type: String, + type: Date, }) - @Prop({ type: Date, required: false, default: Date.now }) - date: Date; + @Prop({ type: Date, default: Date.now }) + createdAt?: Date; @ApiProperty({ description: "A list of endpoints with their access log compacted details",