mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-21 23:40:26 +01:00
Lint and update
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* Contract source: https://git.io/Jte3T
|
||||
*
|
||||
* Feel free to let us know via PR, if you find something broken in this config
|
||||
* file.
|
||||
*/
|
||||
|
||||
import Bouncer from '@ioc:Adonis/Addons/Bouncer'
|
||||
|
||||
/*
|
||||
@@ -20,16 +13,16 @@ import Bouncer from '@ioc:Adonis/Addons/Bouncer'
|
||||
| as shown in the following example
|
||||
|
|
||||
| ```
|
||||
| Bouncer.define('deletePost', (user: User, post: Post) => {
|
||||
| return post.user_id === user.id
|
||||
| })
|
||||
| Bouncer.define('deletePost', (user: User, post: Post) => {
|
||||
| return post.user_id === user.id
|
||||
| })
|
||||
| ```
|
||||
|
|
||||
|****************************************************************
|
||||
| NOTE: Always export the "actions" const from this file
|
||||
|****************************************************************
|
||||
*/
|
||||
export const {actions} = Bouncer
|
||||
export const { actions } = Bouncer
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -44,14 +37,14 @@ export const {actions} = Bouncer
|
||||
| import the policy
|
||||
|
|
||||
| ```
|
||||
| Bouncer.registerPolicies({
|
||||
| UserPolicy: () => import('App/Policies/User'),
|
||||
| PostPolicy: () => import('App/Policies/Post')
|
||||
| })
|
||||
| Bouncer.registerPolicies({
|
||||
| UserPolicy: () => import('App/Policies/User'),
|
||||
| PostPolicy: () => import('App/Policies/Post')
|
||||
| })
|
||||
| ```
|
||||
|
|
||||
|****************************************************************
|
||||
| NOTE: Always export the "policies" const from this file
|
||||
|****************************************************************
|
||||
*/
|
||||
export const {policies} = Bouncer.registerPolicies({})
|
||||
export const { policies } = Bouncer.registerPolicies({})
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
import Server from "@ioc:Adonis/Core/Server";
|
||||
import Server from '@ioc:Adonis/Core/Server'
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global middleware
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Route from "@ioc:Adonis/Core/Route";
|
||||
import Application from "@ioc:Adonis/Core/Application";
|
||||
import Route from '@ioc:Adonis/Core/Route'
|
||||
import Application from '@ioc:Adonis/Core/Application'
|
||||
|
||||
Route.get('/me', 'ProfileController.me')
|
||||
Route.get('/stats', 'StatsController.index')
|
||||
@@ -21,9 +21,8 @@ Route.group(() => {
|
||||
Route.post('/commands', 'StatsController.incrementCommandCount')
|
||||
Route.post('/builds', 'StatsController.incrementBuildCount')
|
||||
}).prefix('stats')
|
||||
|
||||
}).middleware('auth:web,api')
|
||||
|
||||
Route.get('/files/:filename', async ({response, params}) => {
|
||||
Route.get('/files/:filename', async({ response, params }) => {
|
||||
response.download(Application.makePath('storage', params.filename))
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Route from "@ioc:Adonis/Core/Route";
|
||||
import Route from '@ioc:Adonis/Core/Route'
|
||||
|
||||
Route.group(() => {
|
||||
Route.resource('/form', 'FormsController').except(['edit', 'create', 'update'])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Route from "@ioc:Adonis/Core/Route";
|
||||
import Route from '@ioc:Adonis/Core/Route'
|
||||
|
||||
Route.group(() => {
|
||||
Route.get('/me', 'AuthController.user').middleware('auth:web,api')
|
||||
@@ -13,6 +13,4 @@ Route.group(() => {
|
||||
Route.post('/login', 'AuthController.loginWeb')
|
||||
Route.post('/logout', 'AuthController.logoutWeb')
|
||||
}).prefix('/web')
|
||||
|
||||
}).prefix('/auth')
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import Env from "@ioc:Adonis/Core/Env";
|
||||
import Route from "@ioc:Adonis/Core/Route";
|
||||
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
|
||||
import HealthCheck from "@ioc:Adonis/Core/HealthCheck";
|
||||
import Env from '@ioc:Adonis/Core/Env'
|
||||
import Route from '@ioc:Adonis/Core/Route'
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
import HealthCheck from '@ioc:Adonis/Core/HealthCheck'
|
||||
|
||||
const BASE_URL = Env.get('BASE_URL')
|
||||
|
||||
Route.get('/', async ({response}: HttpContextContract) => {
|
||||
Route.get('/', async({ response }: HttpContextContract) => {
|
||||
return response.status(200).send({
|
||||
domain: BASE_URL,
|
||||
version: Env.get('API_VERSION'),
|
||||
@@ -15,22 +15,24 @@ Route.get('/', async ({response}: HttpContextContract) => {
|
||||
profile: `${BASE_URL}/me`,
|
||||
stats: `${BASE_URL}/stats`,
|
||||
states: `${BASE_URL}/states`,
|
||||
locations: `${BASE_URL}/locations`
|
||||
}
|
||||
locations: `${BASE_URL}/locations`,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Route.get('/source', async ({response}: HttpContextContract) => {
|
||||
Route.get('/source', async({ response }: HttpContextContract) => {
|
||||
return response.redirect(Env.get('GITHUB_SOURCE'))
|
||||
})
|
||||
|
||||
Route.get('/health', async ({response}: HttpContextContract) => {
|
||||
Route.get('/health', async({ response }: HttpContextContract) => {
|
||||
const report = await HealthCheck.getReport()
|
||||
const isLive = await HealthCheck.isLive()
|
||||
const isReady = HealthCheck.isReady()
|
||||
return report.healthy ? response.ok({isLive, isReady, report: report.report}) : response.badRequest({
|
||||
isLive,
|
||||
isReady,
|
||||
report: report.report
|
||||
})
|
||||
return report.healthy
|
||||
? response.ok({ isLive, isReady, report: report.report })
|
||||
: response.badRequest({
|
||||
isLive,
|
||||
isReady,
|
||||
report: report.report,
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user