mirror of
https://github.com/ershisan99/coolify.git
synced 2026-01-26 12:34:32 +00:00
fix: more types for API
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
import { FastifyPluginAsync } from 'fastify';
|
||||
import { checkGitLabOAuthID, deleteSource, getSource, listSources, saveGitHubSource, saveGitLabSource, saveSource } from './handlers';
|
||||
|
||||
import type { OnlyId } from '../../../../types';
|
||||
import type { CheckGitLabOAuthId, SaveGitHubSource, SaveGitLabSource } from './types';
|
||||
|
||||
const root: FastifyPluginAsync = async (fastify, opts): Promise<void> => {
|
||||
fastify.addHook('onRequest', async (request, reply) => {
|
||||
const root: FastifyPluginAsync = async (fastify): Promise<void> => {
|
||||
fastify.addHook('onRequest', async (request) => {
|
||||
return await request.jwtVerify()
|
||||
})
|
||||
fastify.get('/', async (request) => await listSources(request));
|
||||
|
||||
fastify.get('/:id', async (request) => await getSource(request));
|
||||
fastify.get<OnlyId>('/:id', async (request) => await getSource(request));
|
||||
fastify.post('/:id', async (request, reply) => await saveSource(request, reply));
|
||||
fastify.delete('/:id', async (request) => await deleteSource(request));
|
||||
|
||||
fastify.post('/:id/check', async (request) => await checkGitLabOAuthID(request));
|
||||
fastify.post('/:id/github', async (request, reply) => await saveGitHubSource(request, reply));
|
||||
fastify.post('/:id/gitlab', async (request, reply) => await saveGitLabSource(request, reply));
|
||||
|
||||
fastify.post<CheckGitLabOAuthId>('/:id/check', async (request) => await checkGitLabOAuthID(request));
|
||||
fastify.post<SaveGitHubSource>('/:id/github', async (request) => await saveGitHubSource(request));
|
||||
fastify.post<SaveGitLabSource>('/:id/gitlab', async (request) => await saveGitLabSource(request));
|
||||
};
|
||||
|
||||
export default root;
|
||||
|
||||
Reference in New Issue
Block a user