1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 23:15:24 +02:00

feat: add basis api documentation

This commit is contained in:
marclave 2024-01-14 17:21:10 -08:00
parent ee0dc9d4be
commit 87cd43c6d0
12 changed files with 2102 additions and 11 deletions

View file

@ -6,6 +6,9 @@ import * as Sentry from '@sentry/node'
import * as SentryTracing from '@sentry/tracing' import * as SentryTracing from '@sentry/tracing'
import * as trpcExpress from '@trpc/server/adapters/express' import * as trpcExpress from '@trpc/server/adapters/express'
import { appRouter, createTRPCContext } from './trpc' import { appRouter, createTRPCContext } from './trpc'
import { apiReference } from '@scalar/express-api-reference'
import swaggerJsdoc from 'swagger-jsdoc'
/** /**
* In Express 4.x, asynchronous errors are NOT automatically passed to next(). This middleware is a small * In Express 4.x, asynchronous errors are NOT automatically passed to next(). This middleware is a small
* wrapper around Express that enables automatic async error handling * wrapper around Express that enables automatic async error handling
@ -45,6 +48,7 @@ import {
e2eRouter, e2eRouter,
} from './routes' } from './routes'
import env from '../env' import env from '../env'
import maybeScalarTheme from './maybe-scalar-theme'
const app = express() const app = express()
@ -165,6 +169,32 @@ app.use('/v1/holdings', holdingsRouter)
app.use('/v1/securities', securitiesRouter) app.use('/v1/securities', securitiesRouter)
app.use('/v1/plans', plansRouter) app.use('/v1/plans', plansRouter)
// api docs
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'Maybe API References',
description:
'This page may not represent the current state of the API and is primarily here as a quick reference to see everything in one spot.',
version: '1.0.0',
},
},
apis: ['**/routes/**.router.ts'],
}
const openapiSpecification = swaggerJsdoc(options)
app.use(
'/reference',
apiReference({
customCss: maybeScalarTheme,
spec: {
content: openapiSpecification,
},
})
)
// Sentry must be the *first* handler // Sentry must be the *first* handler
app.use(identifySentryUser) app.use(identifySentryUser)
app.use(Sentry.Handlers.errorHandler()) app.use(Sentry.Handlers.errorHandler())

File diff suppressed because one or more lines are too long

View file

@ -5,6 +5,26 @@ import endpoint from '../lib/endpoint'
const router = Router() const router = Router()
/**
* @swagger
* tags:
* name: Account Rollups
* description: Account rollups
*/
/**
* @swagger
* /:
* get:
* description: Returns accounts
* tags:
* - Account Rollups
* produces:
* - application/json
* responses:
* 200:
* description: users
*/
router.get( router.get(
'/', '/',
endpoint.create({ endpoint.create({

View file

@ -13,6 +13,13 @@ import endpoint from '../lib/endpoint'
import keyBy from 'lodash/keyBy' import keyBy from 'lodash/keyBy'
import merge from 'lodash/merge' import merge from 'lodash/merge'
/**
* @swagger
* tags:
* name: Accounts
* description: Accounts
*/
const router = Router() const router = Router()
router.get( router.get(

View file

@ -8,6 +8,26 @@ import { devOnly } from '../middleware'
const router = Router() const router = Router()
/**
* @swagger
* tags:
* name: Account Connections
* description: Account Connections
*/
/**
* @swagger
* /:id:
* get:
* description: Returns connections
* tags:
* - Account Connections
* produces:
* - application/json
* responses:
* 200:
* description: users
*/
router.get( router.get(
'/:id', '/:id',
endpoint.create({ endpoint.create({

View file

@ -4,6 +4,26 @@ import endpoint from '../lib/endpoint'
const router = Router() const router = Router()
/**
* @swagger
* tags:
* name: Institutions
* description: Institutions
*/
/**
* @swagger
* /:
* get:
* description: Returns instriutions
* tags:
* - Institutions
* produces:
* - application/json
* responses:
* 200:
* description: users
*/
router.get( router.get(
'/', '/',
endpoint.create({ endpoint.create({

View file

@ -6,6 +6,26 @@ import { devOnly } from '../middleware'
const router = Router() const router = Router()
/**
* @swagger
* tags:
* name: Plaid
* description: Plaid
*/
/**
* @swagger
* /status:
* get:
* description: Returns status
* tags:
* - Plaid
* produces:
* - application/json
* responses:
* 200:
* description: users
*/
router.get( router.get(
'/status', '/status',
endpoint.create({ endpoint.create({

View file

@ -10,6 +10,13 @@ import {
UpdateOnboardingSchema, UpdateOnboardingSchema,
} from '@maybe-finance/server/features' } from '@maybe-finance/server/features'
/**
* @swagger
* tags:
* name: Users
* description: User management and login
*/
const router = Router() const router = Router()
router.get( router.get(
@ -21,6 +28,19 @@ router.get(
}) })
) )
/**
* @swagger
* /onboarding/:flow:
* get:
* description: Returns users
* tags:
* - Users
* produces:
* - application/json
* responses:
* 200:
* description: users
*/
router.get( router.get(
'/onboarding/:flow', '/onboarding/:flow',
endpoint.create({ endpoint.create({

View file

@ -6,6 +6,26 @@ import { DateUtil } from '@maybe-finance/shared'
const router = Router() const router = Router()
/**
* @swagger
* tags:
* name: Valuations
* description: Valuations
*/
/**
* @swagger
* /:id:
* get:
* description: Returns valuations
* tags:
* - Valuations
* produces:
* - application/json
* responses:
* 200:
* description: users
*/
router.get( router.get(
'/:id', '/:id',
endpoint.create({ endpoint.create({

View file

@ -8,6 +8,26 @@ import env from '../../env'
const router = Router() const router = Router()
/**
* @swagger
* tags:
* name: Webhooks
* description: Webhooks
*/
/**
* @swagger
* /plaid/webhook:
* get:
* description: Webhook for plaid
* tags:
* - Webhooks
* produces:
* - application/json
* responses:
* 200:
* description: users
*/
router.post( router.post(
'/plaid/webhook', '/plaid/webhook',
process.env.NODE_ENV !== 'development' ? validatePlaidJwt : (_req, _res, next) => next(), process.env.NODE_ENV !== 'development' ? validatePlaidJwt : (_req, _res, next) => next(),

View file

@ -45,6 +45,7 @@
"@polygon.io/client-js": "^6.0.6", "@polygon.io/client-js": "^6.0.6",
"@popperjs/core": "^2.11.5", "@popperjs/core": "^2.11.5",
"@prisma/client": "^5.8.0", "@prisma/client": "^5.8.0",
"@scalar/express-api-reference": "^0.2.12",
"@sentry/node": "^7.22.0", "@sentry/node": "^7.22.0",
"@sentry/react": "^7.22.0", "@sentry/react": "^7.22.0",
"@sentry/tracing": "^7.22.0", "@sentry/tracing": "^7.22.0",
@ -154,6 +155,7 @@
"smooth-scroll-into-view-if-needed": "^1.1.33", "smooth-scroll-into-view-if-needed": "^1.1.33",
"stripe": "^10.17.0", "stripe": "^10.17.0",
"superjson": "^1.11.0", "superjson": "^1.11.0",
"swagger-jsdoc": "^6.2.8",
"tailwindcss": "3.2.4", "tailwindcss": "3.2.4",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"uuid": "^9.0.0", "uuid": "^9.0.0",

1832
yarn.lock

File diff suppressed because it is too large Load diff