Code | Description | Suggested Action |
---|---|---|
901 |
Valid google user does not exist on FPTrack DB | Create user with same email, along with metadata by POSTing to /api/user first |
951 |
Trying to modify approval/rejection status of already approved/rejected proposal | N/A : Verify proposal details with admin |
952 |
DB error when trying to update status of a collection | Attempt the same operation later |
961 |
Very frequent project update | Attempt to make a project update entry after at least 2 days from the previous |
801 |
Resource for ID not found | ID is of valid format. Send it to the correct resource! |
- Find the specifications document here: https://docs.google.com/document/d/1jRCV0GmPHsXNXjA9UHeSrwmuguNEEI4yCPcC1Dmvwz4/edit?usp=sharing
- PDF Proposal Upload must be under 8MB (soft limit)
- When new user uses OAuth to register, the token validation (POST /api/auth/) will return with,
Initiate a form on the frontend to collect user metadata i.e. role, access, etc. and create a user using the given URL and METHOD. Then, send the same token to the token validation (POST /api/auth/) endpoint.
{ error_code: 901, message: "User must be created", url: "/api/user/", method: "POST" } HTTP_CODE: 404
NOTE: Specify API endpoint requirements under Requested Endpoint Requirements
here: https://docs.google.com/document/d/1BuqWLfZSf08XkSRbJId3BAIZCT0FmTrVLlO-6XchuT4/edit?usp=sharing
- Resonds with all user collections
- Now supports filters! Multiple filters may be used
- The following fields can be used for fitering by being passed as GET query parameters,
?email=abc@gmail.com
?first_name=Adam
: Case-sensitive for now?last_name=Adam
: Case-sensitive for now?role=student
: One offaculty
,student
userId
is the_id
field value of the user- Responds with all projects belonging to the specified user, like so
{ as_supervisor: [ <proposal collections with the user as a supervisor>... ], as_member: [ <proposal collections with the user as a member>... ], as_leader: [ <propoal collections with the user as a leader>... ] }
userId
is the_id
field value of the user- Responds with all projects belonging to the specified user, like so
{ as_supervisor: [ <project collections with the user as a supervisor>... ], as_member: [ <project collections with the user as a member>... ], as_leader: [ <project collections with the user as a leader>... ] }
[anything]
is an arbitrary value. This is parsed for GET syntactic convenience - value ignored- The key
available
is of importance - Responds with all resource groups having allocatable resources along with an additional field
avl_qty
to denote number of resource instances of the group that can be allotted, like so
[
{
<all-resource-group fields> : <field-values>,
.
.
avl_qty: 2
}
.
.
]
With request body,
{
rsrc_mgr_id = '<manager_id>',
project_id = '<project_id>',
rsrc_grp_id = '<resource_group_id>',
qty = 1
}
-
The
id
s correspond the the_id
fields of the respective resources -
qty
refers to the number of assignments of thatresource group
desired at the end of this transaction. This can be lower or higher than the current number of allocations -
Responds with the type of changes made:
- If current assignments are same as
qty
,
{"total_qty":2,"assigned_qty":0,"message":"No resource assignments made"}
- If new assignments were made:
{"total_qty":4,"assigned_qty":1,"project_id":"62a4e23619d791faaf76e19a","resource_group_id":"628abd6b4bc531d7264a0aaa","message":"Resource deallocations made"}
- If assignments were removed:
{"total_qty":4,"assigned_qty":1,"project_id":"62a4e23619d791faaf76e19a","resource_group_id":"628abd6b4bc531d7264a0aaa","message":"Resource deallocations made"}
Numbers above are samples only
- If current assignments are same as
NOTE: If the available qty CANNOT satisfy the request, maximum possible qty is assigned. Eg: If only 3 resources can be allocated, and the request is made for 4, then 3 items are allocated and the response indicated the same through assigned_qty
field
[projectId]
is the project id of the project whose resource allocations are being requested- Responds with all resource allocation records for the project resources along, with three additional fields:
_id
denoting the ID of the resource groupassigned_qty
to denote number of resource instances of the group already allottedresource_data
containing specific resource details, along with the ID of its resource group
[
{
_id: <resource-group id>
<all-resource-allocation fields> : <field-values>,
.
.
resource_data : [ { <all resource fields> : <field-values> } ]
assigned_qty: 2
}
.
.
]
With request body,
{
id: '62912ac4f4ebb586b9b82e02',
remarks: 'Needs more novelty'
}
id
is the corresponding proposal's_id
fieldremarks
is the remarks given during rejection, by the scrutiny team (if any)- Marks the proposal as
rejected
, as long as it ispending decision
state --- neither approved nor rejected to far - Responds with the proposal's
_id
and updation status.
With request body,
{
proposal = <proposal_id>,
approved_budget = 10000,
approved_duration = 20
}
proposal
is the corresponding proposal's_id
fieldapproved_duration
is the the approved project duration in months- Marks the proposal as
rejected
, as long as it ispending decision
state --- neither approved nor rejected to far - Responds with the proposal's
_id
and updation status.
With request body like so,
{
id: '62912ac4f4ebb586b9b82e02',
title: 'Lit survey done',
description: 'reviewed 10 directions'
}
id
is the corresponding project's_id
fieldtitle
is a short name for the updatedescription
(optional) is a short description about the status update- Updates are
rejected
if they are made more frequently than 2 days i.e. the second update in a continual period of 2 days is rejected - Responds with the proposal's
_id
, a short message and the update title
With request body like so,
{
id = <project_id>,
title = "Patent submitted",
description = "Fully approved design patent made",
kind = "patent",
reference = "www.patents.com/aaa123"
}
id
is the corresponding project's_id
fieldtitle
is a short name for the updatedescription
(optional) is a short description about the status updatekind
is one of the allowed outcomes. Look into theproject
schema definition.reference
is basically an external URL to prove the outcome- Updates are
rejected
if they are made more frequently than 2 days i.e. the second update in a continual period of 2 days is rejected - Responds with the proposal's
_id
, a short message and the update title
- Find unique/de-duplication factor for Proposals (and hence, Projects)
- Find unique/de-duplication factor for Resource Groups
Use LTS - Version v16.15.0 (includes npm 8.5.5)
- Install NVM using this: https://github.com/nvm-sh/nvm#install--update-script
- Install NodeJS LTS (16.15.0 as of now)
nvm install --lts
Do npm install -g [package-name]
- migrate-mongoose
- nodemon
- express (Obviously!)
- express-generator