/*
 * @Author: sunhaolin@hotoa.com
 * @Date: 2022-12-24 10:53:58
 * @LastEditors: sunhaolin@hotoa.com
 * @LastEditTime: 2022-12-24 11:02:37
 * @Description: 
 */
'use strict';
// @ts-check
const express = require('express');
const router = express.Router();
const { requireAuthentication } = require("@steedos/auth");
const WorkflowManager = require('../manager/workflow_manager');

router.get('/api/formula/user/:userId', requireAuthentication, async function (req, res) {
    try {
        let userSession = req.user;

        const { userId } = req.params;
        
        const result = await WorkflowManager.getFormulaUserObject(userSession.spaceId, userId);

        res.status(200).send(result);
    } catch (e) {
        res.status(200).send({
            errors: [{ errorMessage: e.message }]
        });
    }
});
exports.default = router;
