huridocs/uwazi

View on GitHub
app/api/activitylog/routes.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { ActivityLogGetRequestSchema } from 'shared/types/activityLogApiSchemas';

import { parseQuery, validation } from '../utils';
import needsAuthorization from '../auth/authMiddleware';
import activitylog from './activitylog';

export default app => {
  app.get(
    '/api/activitylog',
    needsAuthorization(['admin']),
    parseQuery,
    validation.validateRequest(ActivityLogGetRequestSchema),
    (req, res, next) =>
      activitylog
        .get(req.query)
        .then(response => res.json(response))
        .catch(next)
  );
};