File tree Expand file tree Collapse file tree
scripts/code-generation/mongoose/repositories/templates
src/modules/crud/repositories/mongoose Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import { TransactionalAdapterMongoose } from '@nestjs-cls/transactional-adapter-mongoose';
99import { {{ENTITY_NAME_PASCAL}}MongooseEntity } from './{{ENTITY_NAME_KEBAB}}.mongoose-entity';
1010import { {{ENTITY_NAME_PASCAL}} } from '../../schemas/{{ENTITY_NAME_KEBAB}}.schema';
11- import { {{ENTITY_NAME_PASCAL}}MongooseBaseRepository } from './{{ENTITY_NAME_KEBAB}}.mongoose-repository.interface';
1211import { ServerConstants } from '../../../../constants/server.constants';
12+ import { MongooseBaseRepository } from '../../../../repositories/mongoose/mongoose.base-repository';
1313
1414@Injectable()
1515export class {{ENTITY_NAME_PASCAL}}MongooseRepository extends MongooseBaseRepository<
@@ -27,8 +27,8 @@ export class {{ENTITY_NAME_PASCAL}}MongooseRepository extends MongooseBaseReposi
2727
2828 protected toDomainEntity({{ENTITY_NAME_CAMEL}}Entity: {{ENTITY_NAME_PASCAL}}MongooseEntity): {{ENTITY_NAME_PASCAL}} {
2929 return {
30- id: dbEntity ._id?.toString() ?? '',
31- ...{{ENTITY_NAME_CAMEL}}Entity,
30+ id: {{ENTITY_NAME_CAMEL}}Entity ._id?.toString() ?? '',
31+ ...{{ENTITY_NAME_CAMEL}}Entity,
3232 };
3333 }
3434}
Original file line number Diff line number Diff line change @@ -25,12 +25,10 @@ export class CrudMongooseRepository extends MongooseBaseRepository<
2525 super ( crudModel , mongoTxHost ) ;
2626 }
2727
28- protected toDomainEntity ( dbEntity : CrudMongooseEntity ) : Crud {
28+ protected toDomainEntity ( crudEntity : CrudMongooseEntity ) : Crud {
2929 return {
30- id : dbEntity . _id ?. toString ( ) ?? '' ,
31- content : dbEntity . content ,
32- createdAt : dbEntity . createdAt ,
33- updatedAt : dbEntity . updatedAt ,
30+ id : crudEntity . _id ?. toString ( ) ?? '' ,
31+ ...crudEntity ,
3432 } ;
3533 }
3634}
You can’t perform that action at this time.
0 commit comments