Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x | import express from "express"; import swaggerJSDoc from "swagger-jsdoc"; import swaggerUi from 'swagger-ui-express'; import { cardOperationTransaction, standardTransferTransaction } from "../schemas/transaction"; import GoogleOAuth2Constants from "../../constants"; import { transactionTypes } from "../schemas/transactionTypes"; import { entryTypes } from "../schemas/entryTypes"; const router = express.Router(); const scopes: { [key in typeof GoogleOAuth2Constants.scopes[number]]: string; } = { 'https://www.googleapis.com/auth/userinfo.profile': 'See your personal info, including any personal info you\'ve made publicly available', 'https://www.googleapis.com/auth/userinfo.email': 'See your primary Google Account email address', 'https://www.googleapis.com/auth/gmail.readonly': 'View your email messages and settings', }; const googleOAuth2SecurityScheme = { Google: { type: 'oauth2', flows: { authorizationCode: { authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth?access_type=offline', tokenUrl: GoogleOAuth2Constants.defaultRedirectUri, scopes: scopes } } } }; const options = { definition: { openapi: '3.0.0', servers: [ { url: `${process.env.UNIXPENSE_HOST_PREFIX ?? ''}/api` } ], info: { title: 'Unixpense Tracker API', version: process.env.VERSION ?? 'develop', }, components: { securitySchemes: { ...googleOAuth2SecurityScheme }, schemas: { cardOperationTransaction, standardTransferTransaction, transactionTypes, entryTypes, } } }, apis: [ './**/web/routes/*.{js,ts}' ], }; const swaggerSpec = swaggerJSDoc(options); router.use('/', swaggerUi.serve, swaggerUi.setup(swaggerSpec)); export { router } |