cyntaria / ConstructionERP-Backend

A REST API backend system for the construction ERP software made with NodeJS
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

As a contractor, I should be able to get all ordered materials for a project, so that I can understand how much of each was ordered and how much did it cost #84

Open arafaysaleem opened 3 years ago

arafaysaleem commented 3 years ago

Summary

As a contractor, I should be able to get all ordered materials for a project, so that I can understand how much of each was ordered and how much did it cost.

Acceptance Criteria

Scenario 1: Search for all possible materials orders in a project

GIVEN an contractor is requesting all possible materials in the desktop app WHEN the app hits the /projects/:id/materials endpoint with a valid GET request, containing the path parameter:

THEN the app should receive a status 200 AND in the response, the following information should be returned:

Sample Request/Sample Response For e.g. If we request ordered materials for project id 1:

headers: {
    error: 0,
    message: "..."
}
body: [
    {
        order_id: 0,
        mat_id: 1,
        milestone_id: 0,
        project_id: 1,
        price: 1000,
        quantity_unit: "tonnes",
        quantity: 2
    },
    {
        order_id: 2,
        mat_id: 2,
        milestone_id: 0,
        project_id: 1,
        price: 1000,
        quantity_unit: "kg",
        quantity: 20
    },
    {
        order_id: 2,
        mat_id: 3,
        milestone_id: 0,
        project_id: 1,
        price: 1000,
        quantity_unit: "g",
        quantity: 200
    },
    ....
]

Scenario 2: Search for all possible materials orders in a project for a material

GIVEN an contractor is requesting all possible materials orders in the desktop app WHEN the app hits the /projects/:id/materials endpoint with a valid GET request, containing:-"

THEN the app should receive a status 200 AND in the response, the following information should be returned:

Sample Request/Sample Response For project id 1 and query parameter mat_id=3:

headers: {
    error: 0,
    message: "..."
}
body: [
    {
        order_id: 0,
        mat_id: 3,
        milestone_id: 0,
        project_id: 1,
        price: 1000,
        quantity_unit: "tonnes",
        quantity: 2
    },
    {
        order_id: 2,
        mat_id: 3,
        milestone_id: 0,
        project_id: 1,
        price: 1000,
        quantity_unit: "kg",
        quantity: 20
    },
    {
        order_id: 2,
        mat_id: 3,
        milestone_id: 0,
        project_id: 1,
        price: 1000,
        quantity_unit: "g",
        quantity: 200
    },
    ....
]

Resources

Dev Notes

Testing Notes

{notes for QA, with examples if applicable}