Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit

Permalink
Merge branch 'release/2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenkii committed Jun 12, 2023
2 parents 7159022 + 9dd3fac commit 7f21d07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "loa-viewer-backend",
"version": "2.0.0",
"version": "2.0.1",
"description": "",
"main": "app.js",
"scripts": {
Expand Down
42 changes: 9 additions & 33 deletions backend/src/controllers/condition.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,37 @@ import { NextFunction, Request, Response } from 'express';
import conditionService from '../services/condition.service';
import { ConditionDocument } from '../models/condition.model';

export async function addCondition(
req: Request,
res: Response,
next: NextFunction
) {
export async function addCondition(req: Request, res: Response, next: NextFunction) {
try {
const condition: ConditionDocument =
await conditionService.addCondition(req.body);
const condition: ConditionDocument = await conditionService.addCondition(req.body);

res.json(condition);
} catch (error) {
next(error);
}
}

export async function getAllConditions(
req: Request,
res: Response,
next: NextFunction
) {
export async function getAllConditions(req: Request, res: Response, next: NextFunction) {
try {
const conditions: ConditionDocument[] =
await conditionService.getAllConditions();
const conditions: ConditionDocument[] = await conditionService.getAllConditions();

res.json(conditions);
} catch (error) {
next(error);
}
}

export async function getCondition(
req: Request,
res: Response,
next: NextFunction
) {
export async function getCondition(req: Request, res: Response, next: NextFunction) {
try {
const condition: ConditionDocument =
await conditionService.getCondition(req.params.icao);
const condition: ConditionDocument = await conditionService.getCondition(req.params.icao);

res.json(condition);
} catch (error) {
next(error);
}
}

export async function deleteCondition(
req: Request,
res: Response,
next: NextFunction
) {
export async function deleteCondition(req: Request, res: Response, next: NextFunction) {
try {
await conditionService.deleteCondition(req.params.id);

Expand All @@ -63,14 +44,9 @@ export async function deleteCondition(
}
}

export async function updateCondition(
req: Request,
res: Response,
next: NextFunction
) {
export async function updateCondition(req: Request, res: Response, next: NextFunction) {
try {
const condition: ConditionDocument =
await conditionService.updateCondition(req.params.id, req.body);
const condition: ConditionDocument = await conditionService.updateCondition(req.params.id, req.body);

res.json(condition);
} catch (error) {
Expand Down

0 comments on commit 7f21d07

Please sign in to comment.