-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
97 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { NextFunction, Request, Response } from 'express'; | ||
import { login } from '../../../utils/login'; | ||
import { loginAccount } from '../../../utils/login'; | ||
|
||
export default [ | ||
// Middlewares | ||
|
||
// Controller | ||
async (request: Request, response: Response, next: NextFunction) => { | ||
await login(request, response, next, true); | ||
await loginAccount(request, response, next, true); | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NextFunction, Request, Response } from 'express'; | ||
import { fetchPartners } from '../../../operations/partner'; | ||
import { success } from '../../../utils/responses'; | ||
import { Permission } from '../../../types'; | ||
import { hasPermission } from '../../../middlewares/authentication'; | ||
|
||
export default [ | ||
// Middlewares | ||
...hasPermission(Permission.anim), | ||
|
||
// Controller | ||
async (request: Request, response: Response, next: NextFunction) => { | ||
try { | ||
const result = await fetchPartners(); | ||
|
||
return success(response, result); | ||
} catch (error) { | ||
return next(error); | ||
} | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NextFunction, Request, Response } from 'express'; | ||
import { success } from '../../../utils/responses'; | ||
import { fetchTournaments } from '../../../operations/tournament'; | ||
import { hasPermission } from '../../../middlewares/authentication'; | ||
import { Permission } from '../../../types'; | ||
|
||
export default [ | ||
// Middlewares | ||
...hasPermission(Permission.anim), | ||
|
||
// Controller | ||
async (request: Request, response: Response, next: NextFunction) => { | ||
try { | ||
const result = await fetchTournaments(); | ||
|
||
return success(response, result); | ||
} catch (error) { | ||
return next(error); | ||
} | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { Router } from 'express'; | ||
import updateTournament from './updateTournament'; | ||
import getTournaments from './getTournaments'; | ||
|
||
const router = Router(); | ||
|
||
router.get('/', getTournaments); | ||
router.patch('/:tournamentId', updateTournament); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import axios from "axios"; | ||
import env from "../utils/env"; | ||
import axios from 'axios'; | ||
import env from '../utils/env'; | ||
|
||
// Operations for file upload | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export const uploadFile = async (file: any, path: string, name: string) => { | ||
const fileBlob = new Blob([file.buffer], { type: file.mimetype }); | ||
|
||
const fileBlob = new Blob([file.buffer], { type: file.mimetype }); | ||
const formData = new FormData(); | ||
formData.append('file', fileBlob, file.originalname); | ||
formData.append('path', path); | ||
formData.append('name', name); | ||
|
||
const formData = new FormData(); | ||
formData.append('file', fileBlob, file.originalname); | ||
formData.append('path', path); | ||
formData.append('name', name); | ||
const result = await axios.post(`${env.front.website}/uploads/files/api`, formData, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
Accept: 'application/json', | ||
Authorization: `Bearer ${env.upload.token}`, | ||
}, | ||
}); | ||
|
||
const result = await axios.post(`${env.front.website}/uploads/files/api`, formData, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
'Accept': 'application/json', | ||
'Authorization': `Bearer ${env.upload.token}` | ||
}, | ||
}); | ||
|
||
return result.data; | ||
return result.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters