-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from TreeHacks/connorff/update-form-api
feat: restrict scope access to forms, add/modify form schemas
- Loading branch information
Showing
13 changed files
with
113 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import mongoose from "mongoose"; | ||
import { Schema } from "mongoose"; | ||
|
||
const hardwareInfoSchema: Schema = new mongoose.Schema({ | ||
checkedOutBy: String, | ||
checkedOutAt: Date, | ||
pendingReturn: Boolean, | ||
returnedAt: Date, | ||
returnedBy: String, | ||
hardwareList: String | ||
}, { _id: false }); | ||
|
||
export default hardwareInfoSchema; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import mongoose from "mongoose"; | ||
import { Schema } from "mongoose"; | ||
|
||
const mealInfoSchema: Schema = new mongoose.Schema({ | ||
usedMeals: [String], | ||
}, { _id: false }); | ||
|
||
export default mealInfoSchema; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Request, Response } from 'express'; | ||
import { getApplicationAttribute } from "./common"; | ||
import { IApplication } from '../models/Application.d'; | ||
|
||
export function getAllForms(req: Request, res: Response) { | ||
return getApplicationAttribute(req, res, (e: IApplication) => { | ||
return e.forms || {}; | ||
}, true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Request, Response } from 'express'; | ||
import { getApplicationAttribute, setApplicationAttribute } from "./common"; | ||
import { IApplication } from '../models/Application.d'; | ||
|
||
export function getHardwareInfo(req: Request, res: Response) { | ||
return getApplicationAttribute(req, res, (e: IApplication) => { | ||
return e.forms.hardware_info || {}; | ||
}, true); | ||
} | ||
|
||
export function setHardwareInfo(req: Request, res: Response) { | ||
return setApplicationAttribute(req, res, | ||
(e: IApplication) => { | ||
e.forms.hardware_info = req.body; | ||
}, | ||
e => e.forms.hardware_info | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters