You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
656 B
19 lines
656 B
---
|
|
to: src/modules/<%=h.changeCase.param(name)%>/<%=h.changeCase.param(name)%>.repository.ts
|
|
---
|
|
<%
|
|
properName = h.changeCase.pascal(name);
|
|
kebabName = h.changeCase.param(name);
|
|
camelCase = h.changeCase.camel(name);
|
|
%>import { EntityRepository, Repository } from 'typeorm';
|
|
import { <%= properName %> } from './<%= kebabName %>.entity';
|
|
import { Optional } from 'typescript-optional';
|
|
|
|
@EntityRepository(<%= properName %>)
|
|
export class <%= properName %>Repository extends Repository<<%= properName %>> {
|
|
async findOneById(id: number): Promise<Optional<<%= properName %>>> {
|
|
return Optional.ofNullable(
|
|
await this.findOne(id, {}),
|
|
);
|
|
}
|
|
}
|