25 lines
787 B
TypeScript
25 lines
787 B
TypeScript
import { Router } from 'express';
|
|
import bodyParser from 'body-parser';
|
|
import {
|
|
getAppearancePreferences,
|
|
updateAppearancePreferences
|
|
} from '../controllers/global-preferences/appearance-preferences.controller.js';
|
|
import { withAuth, tokenAndRoleValidator, apiKeyValidator } from '../middlewares/auth.middleware.js';
|
|
import { UserRole } from '@typings-ce';
|
|
|
|
export const preferencesRouter = Router();
|
|
|
|
preferencesRouter.use(bodyParser.urlencoded({ extended: true }));
|
|
preferencesRouter.use(bodyParser.json());
|
|
|
|
preferencesRouter.put(
|
|
'/appearance',
|
|
withAuth(apiKeyValidator, tokenAndRoleValidator(UserRole.ADMIN)),
|
|
updateAppearancePreferences
|
|
);
|
|
preferencesRouter.get(
|
|
'/appearance',
|
|
withAuth(apiKeyValidator, tokenAndRoleValidator(UserRole.ADMIN)),
|
|
getAppearancePreferences
|
|
);
|