VRMS
VRMS copied to clipboard
Implement a service for operating ProjectInfo entity
The task is blocked by:
- [x] #456
Overview
Implement a service to operate the ProjectInfo data model.
Action Items
- [ ] Add
projectInfo.service.jsintobackend/servicesfolder. - [ ] Implement
createProject(projectInfo, authorEmail)function that returns the saved entity. Features:
- Required fields for creating a project are the following:
-
name,type,description -
locationZone,timeZone -
activeStatus -
urls: { hflaPage }
-
- Validate required fields to be not empty.
- Set field
createdusing current date and time.
- [ ] Implement
updateProject(projectInfo, authorEmail)function that returns the updated entity. Features:
- Use Mongoose
findOneAndUpdatewithidas a key. - Treat undefined fields as no-change
- Removing required fields is not allowed and should be validated.
- Set field
lastModifiedusing current date and time.
- [ ] For both
createandupdatefunctions:
- Throw ValidationError if a change is not valid.
- Wrap possible database errors into DatabaseError using
try/catch. - Make a record in the ModificationLogs collection.
- Place create/update actions into one transaction with saving logs.
- [ ] Implement
getProject(id)function that returns uniqueProjectInfoentity. - [ ] Implement
getActiveProjects()function that returns allProjectInfoentities withactiveStatusequals "Active". - [ ] Cover implemented functionality with tests.
Resources/Instructions
I'm quite busy for the next week or so, and I won't be able to work on this. I'll move it back to the backlog. Thanks!
Closed as not planned - planning on back end be People Depot. No longer relevant.