refactor: remove all legacy files

+ comment/delete things that haven't yet migrated to mantine
This commit is contained in:
Sonny
2024-11-07 00:29:58 +01:00
committed by Sonny
parent 861906d29b
commit 5c37fe9c31
148 changed files with 469 additions and 4728 deletions

View File

@@ -31,16 +31,22 @@ export default class AdminController {
protected collectionsController: CollectionsController
) {}
async index({ inertia }: HttpContext) {
async index({ response }: HttpContext) {
const users = await this.usersController.getAllUsersWithTotalRelations();
const linksCount = await this.linksController.getTotalLinksCount();
const collectionsCount =
await this.collectionsController.getTotalCollectionsCount();
return inertia.render('admin/dashboard', {
// TODO: return view
return response.json({
users: users.map((user) => new UserWithRelationCountDto(user).toJson()),
totalLinks: linksCount,
totalCollections: collectionsCount,
});
// return inertia.render('admin/dashboard', {
// users: users.map((user) => new UserWithRelationCountDto(user).toJson()),
// totalLinks: linksCount,
// totalCollections: collectionsCount,
// });
}
}

View File

@@ -26,7 +26,7 @@ export default class CollectionsController {
}
// TODO: Create DTOs
return inertia.render('mantine_dashboard', {
return inertia.render('dashboard', {
collections: collections.map((collection) => collection.serialize()),
activeCollection:
activeCollection?.serialize() || collections[0].serialize(),
@@ -36,7 +36,7 @@ export default class CollectionsController {
// Create collection form
async showCreatePage({ inertia, auth }: HttpContext) {
const collections = await this.getCollectionsByAuthorId(auth.user!.id);
return inertia.render('mantine/collections/create', {
return inertia.render('collections/create', {
disableHomeLink: collections.length === 0,
});
}
@@ -61,7 +61,7 @@ export default class CollectionsController {
collectionId,
auth.user!.id
);
return inertia.render('mantine/collections/edit', {
return inertia.render('collections/edit', {
collection,
});
}
@@ -96,7 +96,7 @@ export default class CollectionsController {
collectionId,
auth.user!.id
);
return inertia.render('mantine/collections/delete', {
return inertia.render('collections/delete', {
collection,
});
}

View File

@@ -17,7 +17,7 @@ export default class LinksController {
async showCreatePage({ auth, inertia }: HttpContext) {
const collections =
await this.collectionsController.getCollectionsByAuthorId(auth.user!.id);
return inertia.render('mantine/links/create', { collections });
return inertia.render('links/create', { collections });
}
async store({ auth, request, response }: HttpContext) {
@@ -50,7 +50,7 @@ export default class LinksController {
await this.collectionsController.getCollectionsByAuthorId(userId);
const link = await this.getLinkById(linkId, userId);
return inertia.render('mantine/links/edit', { collections, link });
return inertia.render('links/edit', { collections, link });
}
async update({ request, auth, response }: HttpContext) {
@@ -98,7 +98,7 @@ export default class LinksController {
const link = await this.getLinkById(linkId, auth.user!.id);
await link.load('collection');
return inertia.render('mantine/links/delete', { link });
return inertia.render('links/delete', { link });
}
async delete({ request, auth, response }: HttpContext) {

View File

@@ -4,13 +4,16 @@ import { getSharedCollectionValidator } from '#validators/shared_collection';
import type { HttpContext } from '@adonisjs/core/http';
export default class SharedCollectionsController {
async index({ request, inertia }: HttpContext) {
async index({ request, response }: HttpContext) {
const { params } = await request.validateUsing(
getSharedCollectionValidator
);
const collection = await this.getSharedCollectionById(params.id);
return inertia.render('shared', { collection });
console.log('shared page', collection);
// TODO: return view
return response.json(collection);
// return inertia.render('shared', { collection });
}
private async getSharedCollectionById(id: Collection['id']) {