@@ -41,7 +41,9 @@ export interface TypeOrmQueryServiceOpts<Entity> {
41
41
* }
42
42
* ```
43
43
*/
44
- export class TypeOrmQueryService < Entity > extends RelationQueryService < Entity > implements QueryService < Entity > {
44
+ export class TypeOrmQueryService < Entity >
45
+ extends RelationQueryService < Entity >
46
+ implements QueryService < Entity , DeepPartial < Entity > , DeepPartial < Entity > > {
45
47
readonly filterQueryBuilder : FilterQueryBuilder < Entity > ;
46
48
47
49
readonly useSoftDelete : boolean ;
@@ -127,7 +129,7 @@ export class TypeOrmQueryService<Entity> extends RelationQueryService<Entity> im
127
129
* ```
128
130
* @param record - The entity to create.
129
131
*/
130
- async createOne < C extends DeepPartial < Entity > > ( record : C ) : Promise < Entity > {
132
+ async createOne ( record : DeepPartial < Entity > ) : Promise < Entity > {
131
133
const entity = await this . ensureIsEntityAndDoesNotExist ( record ) ;
132
134
return this . repo . save ( entity ) ;
133
135
}
@@ -144,7 +146,7 @@ export class TypeOrmQueryService<Entity> extends RelationQueryService<Entity> im
144
146
* ```
145
147
* @param records - The entities to create.
146
148
*/
147
- async createMany < C extends DeepPartial < Entity > > ( records : C [ ] ) : Promise < Entity [ ] > {
149
+ async createMany ( records : DeepPartial < Entity > [ ] ) : Promise < Entity [ ] > {
148
150
const entities = await Promise . all ( records . map ( ( r ) => this . ensureIsEntityAndDoesNotExist ( r ) ) ) ;
149
151
return this . repo . save ( entities ) ;
150
152
}
@@ -160,11 +162,7 @@ export class TypeOrmQueryService<Entity> extends RelationQueryService<Entity> im
160
162
* @param update - A `Partial` of the entity with fields to update.
161
163
* @param opts - Additional options.
162
164
*/
163
- async updateOne < U extends DeepPartial < Entity > > (
164
- id : number | string ,
165
- update : U ,
166
- opts ?: UpdateOneOptions < Entity > ,
167
- ) : Promise < Entity > {
165
+ async updateOne ( id : number | string , update : DeepPartial < Entity > , opts ?: UpdateOneOptions < Entity > ) : Promise < Entity > {
168
166
this . ensureIdIsNotPresent ( update ) ;
169
167
const entity = await this . getById ( id , opts ) ;
170
168
return this . repo . save ( this . repo . merge ( entity , update ) ) ;
@@ -183,7 +181,7 @@ export class TypeOrmQueryService<Entity> extends RelationQueryService<Entity> im
183
181
* @param update - A `Partial` of entity with the fields to update
184
182
* @param filter - A Filter used to find the records to update
185
183
*/
186
- async updateMany < U extends DeepPartial < Entity > > ( update : U , filter : Filter < Entity > ) : Promise < UpdateManyResponse > {
184
+ async updateMany ( update : DeepPartial < Entity > , filter : Filter < Entity > ) : Promise < UpdateManyResponse > {
187
185
this . ensureIdIsNotPresent ( update ) ;
188
186
const updateResult = await this . filterQueryBuilder
189
187
. update ( { filter } )
0 commit comments