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.js
intobackend/services
folder. - [ ] 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
created
using current date and time.
- [ ] Implement
updateProject(projectInfo, authorEmail)
function that returns the updated entity. Features:
- Use Mongoose
findOneAndUpdate
withid
as a key. - Treat undefined fields as no-change
- Removing required fields is not allowed and should be validated.
- Set field
lastModified
using current date and time.
- [ ] For both
create
andupdate
functions:
- 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 uniqueProjectInfo
entity. - [ ] Implement
getActiveProjects()
function that returns allProjectInfo
entities withactiveStatus
equals "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.