refactor: split links controller into multiple controllers

This commit is contained in:
Sonny
2025-08-17 00:39:51 +02:00
parent 56b52adac0
commit 9ff3ca112c
16 changed files with 260 additions and 208 deletions

View File

@@ -1,18 +1,17 @@
import BaseCollectionController from '#collections/controllers/base_collection_controller';
import { CollectionService } from '#collections/services/collection_service';
import { inject } from '@adonisjs/core';
import type { HttpContext } from '@adonisjs/core/http';
@inject()
export default class ShowCollectionsController extends BaseCollectionController {
constructor(private collectionService: CollectionService) {
super();
}
export default class ShowCollectionsController {
constructor(private collectionService: CollectionService) {}
// Dashboard
async render({ inertia, response }: HttpContext) {
const activeCollectionId = await this.validateCollectionId(false);
const collections = await this.collectionService.getCollectionsByAuthorId();
const activeCollectionId =
await this.collectionService.validateCollectionId(false);
const collections =
await this.collectionService.getCollectionsForAuthenticatedUser();
if (collections.length === 0) {
return response.redirectToNamedRoute('collection.create-form');
}