diff --git a/models/Media.ts b/models/Media.ts index 14d3b3c..a1f8890 100644 --- a/models/Media.ts +++ b/models/Media.ts @@ -13,7 +13,7 @@ export interface IMedia { const MediaSchema = new Schema<IMedia>({ assetId: { type: String, - default: crypto.randomBytes(12).toString('hex') + default: () => crypto.randomBytes(12).toString('hex') }, clientId: { type: Number, diff --git a/models/ShortenedLink.ts b/models/ShortenedLink.ts index e7c91b6..34cceee 100644 --- a/models/ShortenedLink.ts +++ b/models/ShortenedLink.ts @@ -12,7 +12,7 @@ export interface IShortenedLink { const ShortenedSchema = new Schema<IShortenedLink>({ shortenedId: { type: String, - default: crypto.randomBytes(3).toString('hex') + default: () => crypto.randomBytes(3).toString('hex') }, originalUrl: { type: String,