17 lines
		
	
	
	
		
			453 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			453 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import type { HttpContext } from '@adonisjs/core/http'
 | |
| import { inject } from '@adonisjs/core'
 | |
| import { SubjectService } from '#services/subject_service'
 | |
| 
 | |
| @inject()
 | |
| export default class SubjectsController {
 | |
|   constructor(private subjectService: SubjectService) {}
 | |
| 
 | |
|   // GET /subjects
 | |
|   async index({ auth }: HttpContext) {
 | |
|     const data = await this.subjectService.getAll(auth.user!.className)
 | |
|     return {
 | |
|       success: true,
 | |
|       data,
 | |
|     }
 | |
|   }
 | |
| }
 |