mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 15:35:35 +00:00
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import AuthController from '#controllers/auth/auth_controller';
|
|
import LinksController from '#controllers/links/delete_link_controller';
|
|
import { UserWithCountersDto } from '#dtos/user_with_counters';
|
|
import { CollectionService } from '#services/collections/collection_service';
|
|
import { inject } from '@adonisjs/core';
|
|
import { HttpContext } from '@adonisjs/core/http';
|
|
|
|
@inject()
|
|
export default class AdminController {
|
|
constructor(
|
|
protected usersController: AuthController,
|
|
protected linksController: LinksController,
|
|
protected collectionService: CollectionService
|
|
) {}
|
|
|
|
async render({ inertia }: HttpContext) {
|
|
const users = await this.usersController.getAllUsersWithTotalRelations();
|
|
const linksCount = await this.linksController.getTotalLinksCount();
|
|
const collectionsCount =
|
|
await this.collectionService.getTotalCollectionsCount();
|
|
|
|
return inertia.render('admin/dashboard', {
|
|
users: UserWithCountersDto.fromArray(users),
|
|
totalLinks: linksCount,
|
|
totalCollections: collectionsCount,
|
|
});
|
|
}
|
|
}
|