Service
Overview
import { Service, Autowired } from "odi";
import { TodoRepository } from "./todo.repository"
@Service()
export class TodoService {
@Autowired()
todoRep: TodoRepository;
public getTodos() {
return this.todoRep.find();
}
public async getUsedSpace() {
const todos = await this.getTodos();
const rolled = todos.reduce((p,todo) => p += todo.title, '');
return Buffer.byteLength(rolled, 'utf8');
}
}Definition
Dependency Injection
Last updated
Was this helpful?