Skip to content

Commit

Permalink
get by eventId
Browse files Browse the repository at this point in the history
riyap committed Apr 24, 2024
1 parent ba7d327 commit fb37b7c
Showing 3 changed files with 44 additions and 59 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: Lint on Push and PR

on:
push:
branches:
- 'main'
- 'dev**'
pull_request:
branches:
- 'main'
push:
branches:
- "main"
- "dev**"
pull_request:
branches:
- "main"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Install dependencies
run: yarn
- name: Run ESLint
run: npx eslint .
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Install dependencies
run: yarn
- name: Run ESLint
run: npx eslint .
44 changes: 22 additions & 22 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu/rp-api
file_exists_behavior: OVERWRITE
hooks:
BeforeInstall:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
AfterInstall:
- location: scripts/build.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
- location: scripts/reload_server.sh
timeout: 300
runas: root
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu/rp-api
file_exists_behavior: OVERWRITE
hooks:
BeforeInstall:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
AfterInstall:
- location: scripts/build.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
- location: scripts/reload_server.sh
timeout: 300
runas: root
23 changes: 4 additions & 19 deletions src/services/events/events-router.ts
Original file line number Diff line number Diff line change
@@ -16,30 +16,15 @@ eventRouter.post("/", async (req, res, next) => {
}
});

// eventRouter.get("/:eventId", async (req, res, next) => {
// try {
// const { eventId } = req.params; // Extract eventId from URL parameters
// const event = await Database.EVENTS.findOne({ eventId: eventId });
// if (!event) {
// return res.status(404).json({ message: "Event not found." });
// }
// return res.status(StatusCodes.OK).json(event.toObject());
// } catch (error) {
// next(error);
// }
// });

eventRouter.get("/:eventId", async (req, res, next) => {
try {
const event = await Database.EVENTS.findOneAndUpdate({
eventId: req.params,
});
const { eventId } = req.params;
const event = await Database.EVENTS.findOne({ eventId: eventId });

if (!event) {
return { error: "DoesNotExist" };
return { error: "Event not found" };
}

return res.status(StatusCodes.OK).json(event);
return res.status(StatusCodes.OK).json(event.toObject());
} catch (error) {
next(error);
}

0 comments on commit fb37b7c

Please sign in to comment.