Skip to content

Commit

Permalink
Begin action route for getting an action by id
Browse files Browse the repository at this point in the history
  • Loading branch information
dangtony98 committed Jan 1, 2023
1 parent 3c349b1 commit 4dac65e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 10 deletions.
4 changes: 1 addition & 3 deletions backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { apiLimiter } from './helpers/rateLimiter';

import {
workspace as eeWorkspaceRouter,
secret as eeSecretRouter,
log as eeLogRouter,
secret as eeSecretRouter
} from './ee/routes/v1';
import {
signup as v1SignupRouter,
Expand Down Expand Up @@ -70,7 +69,6 @@ if (NODE_ENV === 'production') {
// (EE) routes
app.use('/api/v1/secret', eeSecretRouter);
app.use('/api/v1/workspace', eeWorkspaceRouter);
app.use('/api/v1/log', eeLogRouter);

// v1 routes
app.use('/api/v1/signup', v1SignupRouter);
Expand Down
20 changes: 20 additions & 0 deletions backend/src/ee/controllers/v1/actionController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Request, Response } from 'express';
import * as Sentry from '@sentry/node';
import { Action } from '../../models';

export const getAction = (req: Request, res: Response) => {
let action;
// try {
// const { actionId } = req.params;

// action = await Action.findById(actionId);


// } catch (err) {

// }

return res.status(200).send({
action
});
}
4 changes: 3 additions & 1 deletion backend/src/ee/controllers/v1/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as stripeController from './stripeController';
import * as secretController from './secretController';
import * as workspaceController from './workspaceController';
import * as actionController from './actionController';

export {
stripeController,
secretController,
workspaceController
workspaceController,
actionController
}
17 changes: 17 additions & 0 deletions backend/src/ee/routes/v1/action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import express from 'express';
const router = express.Router();
import {
validateRequest
} from '../../../middleware';
import { param } from 'express-validator';
import { actionController } from '../../controllers/v1';

// TODO: put into action controller
router.get(
'/:actionId',
param('actionId').exists().trim(),
validateRequest,
actionController.getAction
);

export default router;
4 changes: 2 additions & 2 deletions backend/src/ee/routes/v1/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import secret from './secret';
import workspace from './workspace';
import log from './log';
import action from './action';

export {
secret,
workspace,
log
action
}
4 changes: 0 additions & 4 deletions backend/src/ee/routes/v1/log.ts

This file was deleted.

0 comments on commit 4dac65e

Please sign in to comment.