u
This commit is contained in:
@@ -8,10 +8,56 @@ import { clearCachedUser } from '../../middleware/auth.js';
|
||||
*/
|
||||
export function register(app, basePath = '') {
|
||||
/**
|
||||
* @route PUT /auth/selected-company
|
||||
* @description Sets the authenticated user's selected company.
|
||||
* @body {number} companyId
|
||||
* @returns {Object} 200 - `{ user: { id, email, selectedCompanyId, picture? } }`
|
||||
* @openapi
|
||||
* /auth/selected-company:
|
||||
* put:
|
||||
* tags: [Auth]
|
||||
* summary: Set selected company
|
||||
* description: Sets the authenticated user's selected company.
|
||||
* security:
|
||||
* - cookieAuth: []
|
||||
* x-markdown: auth/selected-company.md
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required: [companyId]
|
||||
* properties:
|
||||
* companyId:
|
||||
* type: integer
|
||||
* minimum: 1
|
||||
* example:
|
||||
* companyId: 1
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Updated user
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* user:
|
||||
* $ref: '#/components/schemas/User'
|
||||
* 400:
|
||||
* description: Invalid companyId
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Error'
|
||||
* 401:
|
||||
* description: Unauthorized
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Error'
|
||||
* 500:
|
||||
* description: Server error
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Error'
|
||||
*/
|
||||
app.put(`${basePath}/auth/selected-company`, async (req, res) => {
|
||||
const companyId = Number(req.body?.companyId);
|
||||
|
||||
Reference in New Issue
Block a user