Optimize the structure and readability of import statements in `admin` services, modules, and controllers. Ensure consistency and logical grouping for improved maintainability.
28 lines
842 B
TypeScript
28 lines
842 B
TypeScript
import { Injectable } from "@nestjs/common";
|
|
import { CategoriesRepository } from "../categories/repositories/categories.repository";
|
|
import { ContentsRepository } from "../contents/repositories/contents.repository";
|
|
import { UsersRepository } from "../users/repositories/users.repository";
|
|
|
|
@Injectable()
|
|
export class AdminService {
|
|
constructor(
|
|
private readonly usersRepository: UsersRepository,
|
|
private readonly contentsRepository: ContentsRepository,
|
|
private readonly categoriesRepository: CategoriesRepository,
|
|
) {}
|
|
|
|
async getStats() {
|
|
const [userCount, contentCount, categoryCount] = await Promise.all([
|
|
this.usersRepository.countAll(),
|
|
this.contentsRepository.count({}),
|
|
this.categoriesRepository.countAll(),
|
|
]);
|
|
|
|
return {
|
|
users: userCount,
|
|
contents: contentCount,
|
|
categories: categoryCount,
|
|
};
|
|
}
|
|
}
|