-
Notifications
You must be signed in to change notification settings - Fork 1
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
121 changed files
with
2,259 additions
and
1,448 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
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,7 +1,8 @@ | ||
import { FastifyInstance } from 'fastify'; | ||
import { ITelegramRoute } from './type'; | ||
import { telegramLogin } from './controller'; | ||
import { telegramSchema } from './schema'; | ||
|
||
export const authApi = async (fastify: FastifyInstance) => { | ||
fastify.get<ITelegramRoute>('/telegram', telegramLogin); | ||
fastify.get<ITelegramRoute>('/telegram', { schema: telegramSchema, handler: telegramLogin }); | ||
}; |
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,34 @@ | ||
export const telegramSchema = { | ||
description: 'Login/register through telegram', | ||
tags: ['Auth'], | ||
summary: 'Login through telegram', | ||
response: { | ||
302: { | ||
type: 'null', | ||
description: 'Redirect to special page, where token get stored on client side' | ||
} | ||
}, | ||
querystring: { | ||
type: 'object', | ||
properties: { | ||
id: { | ||
type: 'string' | ||
}, | ||
first_name: { | ||
type: 'string' | ||
}, | ||
last_name: { | ||
type: 'string' | ||
}, | ||
username: { | ||
type: 'string' | ||
}, | ||
photo_url: { | ||
type: 'string' | ||
}, | ||
auth_date: { | ||
type: 'number' | ||
} | ||
} | ||
} | ||
}; |
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,11 +1,18 @@ | ||
import { FastifyInstance } from 'fastify'; | ||
import { approve, decline, get } from './controller'; | ||
import { IApproveEventRoute, IDeclineEventRoute, IGetEventsRoute } from './types'; | ||
import { approveEventSchema, declineEventSchema, getEventsByStatusSchema } from './schema'; | ||
|
||
export const manualModerationApi = async (fastify: FastifyInstance) => { | ||
fastify.get<IGetEventsRoute>('/get/:status', get); | ||
fastify.get<IGetEventsRoute>('/get/:status', { schema: getEventsByStatusSchema, handler: get }); | ||
|
||
fastify.get<IApproveEventRoute>('/approve/:eventId', approve); | ||
fastify.get<IApproveEventRoute>('/approve/:eventId', { | ||
schema: approveEventSchema, | ||
handler: approve | ||
}); | ||
|
||
fastify.get<IDeclineEventRoute>('/decline/:eventId', decline); | ||
fastify.get<IDeclineEventRoute>('/decline/:eventId', { | ||
schema: declineEventSchema, | ||
handler: decline | ||
}); | ||
}; |
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,43 @@ | ||
import { ItemEvent } from '../events/schema'; | ||
|
||
export const getEventsByStatusSchema = { | ||
description: 'get events by moderation status', | ||
tags: ['Moderation'], | ||
summary: 'Get events by moderation status', | ||
params: { | ||
type: 'object', | ||
properties: { | ||
country: { type: 'string' } | ||
} | ||
}, | ||
response: { | ||
200: { | ||
type: 'array', | ||
items: ItemEvent | ||
} | ||
} | ||
}; | ||
|
||
export const approveEventSchema = { | ||
description: 'approve event', | ||
tags: ['Moderation'], | ||
summary: 'Approve event', | ||
params: { | ||
type: 'object', | ||
properties: { | ||
eventId: { type: 'string' } | ||
} | ||
} | ||
}; | ||
|
||
export const declineEventSchema = { | ||
description: 'decline event', | ||
tags: ['Moderation'], | ||
summary: 'Decline event', | ||
params: { | ||
type: 'object', | ||
properties: { | ||
eventId: { type: 'string' } | ||
} | ||
} | ||
}; |
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
Oops, something went wrong.