Skip to content

Commit c1eeac9

Browse files
committed
Refactor AbstractServiceSchema to use generic type for document creation
1 parent 3f011eb commit c1eeac9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/_common/abstracts/abstract.service.schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export abstract class AbstractServiceSchema extends AbstractService implements S
170170
if (beforeEvent?.options) options = { ...options, ...beforeEvent.options }
171171
}
172172
}
173-
const document: Document<T, any, T> = new this._model({
173+
const document = new this._model<T>({
174174
metadata: {
175175
createdBy: this.request?.user?.username || 'anonymous',
176176
createdAt: new Date(),
@@ -189,7 +189,7 @@ export abstract class AbstractServiceSchema extends AbstractService implements S
189189
if (afterEvent?.created) created = { ...created, ...afterEvent.created }
190190
}
191191
}
192-
return created
192+
return created as unknown as Document<T, any, T>
193193
}
194194

195195
public async update<T extends AbstractSchema | Document>(

0 commit comments

Comments
 (0)