mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-11 08:43:04 +00:00
feat: add api controllers and routes for browser extension
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { CollectionService } from '#collections/services/collection_service';
|
||||
import { inject } from '@adonisjs/core';
|
||||
import { HttpContext } from '@adonisjs/core/http';
|
||||
|
||||
@inject()
|
||||
export default class GetCollectionsController {
|
||||
constructor(private collectionService: CollectionService) {}
|
||||
|
||||
async show({ response }: HttpContext) {
|
||||
const collections =
|
||||
await this.collectionService.getCollectionsForAuthenticatedUser();
|
||||
return response.json({
|
||||
collections: collections.map((collection) => collection.serialize()),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user