Coder Social home page Coder Social logo

bangazonapi's Introduction

BangazonAPI

Welcome to Bangazon! The new virtual marketplace. This marketplace allows customers to buy and sell their products through a single page application web page and its data is tracked through a powerful, hand crafted and solely dedicated API.

API Documentation

Documentation can be found in our Bangazon Wiki

Table of Contents

(content to be filled)

Software Requirements

Sql Server Manangment Studio Visual Studio Community 2017 Google Chrome

Enitity Relationship Diagram

ERD

Database Setup

In Visual Studio right click on BangazonAPI and select Add -> New Item... when the window pops up select Data underneath ASP.NET Core and choose JSON File and name it appsettings.json then click add copy the contents of the BoilerplateAppSettings.json into appsettings.json then open SSMS and copy the contents of the Server name text box and paste where it says INSERT_DATABASE_CONNECTION_HERE then replace INSERT_DATABASE_NAME with the name of your database that you've created.

Http Request Methods

1. Customer

Start the program by cd'ing into the BangazonAPI and using the command dotnet run. Once the program is running, open up the Postman desktop app and run the following commands:

GET

  • select GET then paste localhost:5000/customer into the field and click send. The result should be an array of all the orders in the database.

  • select GET then paste http://localhost:5000/customer?_include=payments into the field and click send. The result should be an array of all the customers in the database with all of the payment types included in that customers as well.

  • select GET then paste http://localhost:5000/customer?_include=products into the field and click send. The result should be an array of all the customers in the database with all of the products types included in that customers as well.

  • select GET then paste http://localhost:5000/customer?q=sat into the field and click send. The result should be an array of all the customers in the database with first or last names that contains sat.

  • select GET then paste localhost:5000/customer/1 or any other number that showed up in the previous query as CustomerId and click send. The result should be only that object of the specified Customer

POST

select POST, then paste localhost:5000/customer into the field, then click Body underneath the field, then select raw, and then paste this snippet or make one similar

{
        "FirstName": "Test",
        "LastName": "Instructions",
        "Email": "[email protected]",
        "Address": "500 Interstate Drt.",
        "City": "Nashville",
        "State": "TN",
        "AcctCreationDate": "2018-09-18",
        "LastLogin": "2018-09-18"
    }

then click send. The result should be the new customer you made.

PUT

select PUT then paste localhost:5000/customer/1 or any other Customer Id , then click Body underneath the field, then select raw, and then paste this snippet or make one similar

    {
        "FirstName": "Test",
        "LastName": "Instructions",
        "Email": "[email protected]",
        "Address": "500 Interstate Drt.",
        "City": "Nashville",
        "State": "TN",
        "AcctCreationDate": "2018-09-18",
        "LastLogin": "2018-09-18"
    }

You should get nothing back from this. When you run the GET query the Customer you specified in your PUT query should show the updated, edited information you gave it.

3. PaymentType

Use the command dotnet run to start the program, BangazonAPI. Once the program is running, open up the Postman desktop app and run the following commands for each request method:

GET

To GET all product types, select GET in Postman then paste localhost:5000/PaymentType into the field and click send. The result should be an array of all the payment type in the database that should look like:

[
 {
   "paymentTypeId": 1,
   "paymentTypeName": "Visa"
 },
 {
   "paymentTypeId": 2,
   "paymentTypeName": "MasterCard"
 },
 {
   "paymentTypeId": 3,
   "paymentTypeName": "Discover"
 }
]

To GET a specific, single payment type, add an /{id} to the end of the localhost:5000/PaymentType URL. The result should only include the single payment type with the Id you added like the below:

[
  {
    "paymentTypeId": 1,
    "paymentTypeName": "Visa"
  }
]
POST

To POST a new object to your existing array for PaymentType, select POST, then paste localhost:5000/PaymentType into the field. Then click Body underneath the field, select raw, and then paste this below snippet or make one similar then click send. The result should be the new PaymentType you made:

{
	"paymentTypeName": "New Value"
}
PUT

To update an existing PaymentType, select PUT then paste localhost:5000/paymentType/2 or any other existing order. Then follow the same directions as the POST example, and change the values then click send:

{
	"paymentTypeName": "New Value"
}

You should get nothing back from this besides an OK status. When you run the GET query the computer you specified in your PUT query should show the updated, edited information you gave it.

DELETE

To DELETE an existing product type, select DELETE then paste localhost:5000/PaymentType/2 or any other existing PaymentType then click send. You should get nothing back from this besides an OK status. When you run the GET query the order with the Id you specified in your DELETE query should no longer exist.

4. Order

Use the command dotnet run to start the program, BangazonAPI. Once the program is running, open up the Postman desktop app and run the following commands for each request method:

GET

To GET all Orders, select GET in Postman then paste localhost:5000/order into the field and click send. The result should be an array of all the Orders in the database that should look like:

[
    {
        "orderId": 1,
        "customerId": 2,
        "customer": null,
        "customerPaymentId": 2,
        "product": []
    },
    {
        "orderId": 2,
        "customerId": 1,
        "customer": null,
        "customerPaymentId": null,
        "product": []
    },
    {
        "orderId": 3,
        "customerId": 3,
        "customer": null,
        "customerPaymentId": 3,
        "product": []
    }
]

To GET a specific, single order, add an /{id} to the end of the localhost:5000/order URL. The result should only include the single order with the Id you added like the below:

[
    {
        "orderId": 3,
        "customerId": 3,
        "customer": null,
        "customerPaymentId": 3,
        "product": []
    }
]
POST

To POST a new object to your existing array for Order, select POST, then paste localhost:5000/order into the field. Then click Body underneath the field, select raw, and then paste this below snippet or make one similar then click send. The result should be the new Order you made:

{
"CustomerId":"3"
}
PUT

To update an existing order, select PUT then paste localhost:5000/order/2 or any other existing order. Then follow the same directions as the POST example, and change the values then click send:

{
"CustomerPaymentId":"NewUpdatedId"
}

You should get nothing back from this besides an OK status. When you run the GET query the Order you specified in your PUT query should show the updated, edited information you gave it.

DELETE

To DELETE an existing Order, select DELETE then paste localhost:5000/order/2 or any other existing Order then click send. You should get nothing back from this besides an OK status. When you run the GET query the order with the Id you specified in your DELETE query should no longer exist.

7. Department

Use the command dotnet run to start the program, BangazonAPI. Once the program is running, open up the Postman desktop app and run the following commands for each request method:

GET

To GET all Departments, select GET in Postman then paste localhost:5000/department into the field and click send. The result should be an array of all the Departments in the database that should look like:

[
    {
        "departmentId": 1,
        "departmentName": "CodeRockstars",
        "expenseBudget": 140234,
        "employees": []
    },
    {
        "departmentId": 2,
        "departmentName": "IT",
        "expenseBudget": 23400,
        "employees": []
    },
    {
        "departmentId": 3,
        "departmentName": "Sales",
        "expenseBudget": 24000,
        "employees": []
    }
]
  • select GET then paste http://localhost:5000/department?_include=employee into the field and click send. The result should be an array of all the department in the database with all of the products included in that department as well.
[            
{
 "employeeId": 1,
 "firstName": "William",
 "lastName": "Kimball",
 "email": "[email protected]",
 "supervisor": true,
 "departmentId": 1,
 "department": null,
 "computer": null
}
]

To GET a specific, single Department, add an /{id} to the end of the localhost:5000/department URL. The result should only include the single department with the Id you added like the below:

[
    {
        "departmentId": 3,
        "departmentName": "Sales",
        "expenseBudget": 24000,
        "employees": []
    }
]
POST

To POST a new object to your existing array for Department, select POST, then paste localhost:5000/department into the field. Then click Body underneath the field, select raw, and then paste this below snippet or make one similar then click send. The result should be the new Department you made:

    {
        "DepartmentName": "Test",
        "ExpenseBudget": "300000"
    }
PUT

To update an existing Department, select PUT then paste localhost:5000/Department/2 or any other existing department. Then follow the same directions as the POST example, and change the values then click send:

{
"DepartmentName":"NewDepartmentName",
"DepartmentName":"234234"
}

You should get nothing back from this besides an OK status. When you run the GET query the Department you specified in your PUT query should show the updated, edited information you gave it.

DELETE

To DELETE an existing Department, select DELETE then paste localhost:5000/department/2 or any other existing Department then click send. You should get nothing back from this besides an OK status. When you run the GET query the order with the Id you specified in your DELETE query should no longer exist.

###Employees http methods supported: GET, POST, PUT example body:

To DELETE an existing product type, select DELETE then paste localhost:5000/order/2 or any other existing Order then click send. You should get nothing back from this besides an OK status. When you run the GET query the order with the Id you specified in your DELETE query should no longer exist.

5. Product Type

Use the command dotnet run to start the program, BangazonAPI. Once the program is running, open up the Postman desktop app and run the following commands for each request method:

GET

To GET all product types, select GET in Postman then paste localhost:5000/producttype into the field and click send. The result should be an array of all the ProductTypes in the database that should look like:

[
  {
    "productTypeId": 1,
    "productTypeName": "KnitCap"
  },
  {
    "productTypeId": 2,
    "productTypeName": "Craft Thing"
  },
  {
    "productTypeId": 3,
    "productTypeName": "Poem"
  }
]

To GET a specific, single product type, add an /{id} to the end of the localhost:5000/producttype URL. The result should only include the single product type with the Id you added like the below:

[
  {
    "productTypeId": 1,
    "productTypeName": "KnitCap"
  }
]
POST

To POST a new object to your existing array for Product Type, select POST, then paste localhost:5000/producttype into the field. Then click Body underneath the field, select raw, and then paste this below snippet or make one similar then click send. The result should be the new ProductType you made:

{
"productTypeName":"Appliances"
}
PUT

To update an existing product type, select PUT then paste localhost:5000/producttype/6 or any other existing ProductTypeId. Then follow the same directions as the POST example, and change the values then click send:

{
"productTypeName":"NewUpdatedName"
}

You should get nothing back from this besides an OK status. When you run the GET query the computer you specified in your PUT query should show the updated, edited information you gave it.

DELETE

To DELETE an existing product type, select DELETE then paste localhost:5000/producttype/6 or any other existing ProductTypeId then click send. You should get nothing back from this besides an OK status. When you run the GET query the product type with the Id you specified in your DELETE query should no longer exist.

6. Employee

Use the command dotnet run to start the program, BangazonAPI. Once the program is running, open up the Postman desktop app and run the following commands for each request method:

GET

To GET all employees, select GET in Postman then paste localhost:5000/employee into the field and click send. The result should be an array of all the Employees in the database that should look like:

[
    {
        "employeeId": 1,
        "firstName": "William",
        "lastName": "Kimball",
        "email": "[email protected]",
        "supervisor": true,
        "departmentId": 1,
        "department": {
            "departmentId": 1,
            "departmentName": "CodeRockstars",
            "expenseBudget": 140234,
            "employees": []
        },
        "computer": null
    },
    {
        "employeeId": 2,
        "firstName": "Robert",
        "lastName": "Leedy",
        "email": "[email protected]",
        "supervisor": false,
        "departmentId": 2,
        "department": {
            "departmentId": 2,
            "departmentName": "IT",
            "expenseBudget": 23400,
            "employees": []
        },
        "computer": {
            "computerId": 1,
            "datePurchased": "2017-10-11T00:00:00",
            "dateDecommissioned": null,
            "working": true,
            "modelName": "XPS",
            "manufacturer": "Dell"
        }
    },
    {
        "employeeId": 3,
        "firstName": "Seth",
        "lastName": "Dana",
        "email": "[email protected]",
        "supervisor": false,
        "departmentId": 3,
        "department": {
            "departmentId": 3,
            "departmentName": "Sales",
            "expenseBudget": 24000,
            "employees": []
        },
        "computer": {
            "computerId": 3,
            "datePurchased": "2018-12-11T00:00:00",
            "dateDecommissioned": null,
            "working": true,
            "modelName": "Pro",
            "manufacturer": "Mac"
        }
    }
]

To GET a specific, single order, add an /{id} to the end of the localhost:5000/employee URL. The result should only include the single employee with the Id you added like the below:

{
    "employeeId": 1,
    "firstName": "William",
    "lastName": "Kimball",
    "email": "[email protected]",
    "supervisor": true,
    "departmentId": 1,
    "department": {
        "departmentId": 1,
        "departmentName": "CodeRockstars",
        "expenseBudget": 140234,
        "employees": []
    },
    "computer": null
}
POST

To POST a new object to your existing array for Employee, select POST, then paste localhost:5000/employee into the field. Then click Body underneath the field, select raw, and then paste this below snippet or make one similar then click send. The result should be the new Employee you made:

{
	"FirstName": "Example",
	"LastName": "Person",
	"Email": "[email protected]",
	"Supervisor": true,
	"DepartmentId": 2
}
PUT

To update an existing employee, select PUT then paste localhost:5000/employee/2 or any other existing employee. Then follow the same directions as the POST example, and change the values then click send:

{
"employeeId": 2,
    "firstName": "Jack",
    "lastName": "Bob",
    "email": "[email protected]",
    "supervisor": false,
    "departmentId": 2,
}

You should get nothing back from this besides an OK status. When you run the GET query the employee you specified in your PUT query should show the updated, edited information you gave it.

5. Product

Use the command dotnet run to start the program, BangazonAPI. Once the program is running, open up the Postman desktop app and run the following commands for each request method:

GET

To GET all products, select GET in Postman then paste localhost:5000/Product into the field and click send. The result should be an array of all the Products in the database that should look like:

[
  {
"price": 43.34,
"title": 'details',
"description": 'more details',
"customerId": 1,
"quantity": 3,
"productTypeId": 1 
  },
  {
"price": 66.84,
"title": 'words',
"description": 'english',
"customerId": 2, 
"quantity": 7,
"productTypeId": 2 
  },
  {
"price": 44.44,
"title": 'stuff',
"description": 'and things',
"customerId": 9,
"quantity": 3,
"productTypeId": 3
  }
]

To GET a specific, single product, add an /{id} to the end of the localhost:5000/Product URL. The result should only include the single product type with the Id you added like the below:

[
  {
"price": 46.11,
"title": 'say',
"description": 'what',
"customerId": 5,
"quantity": 1,
"productTypeId": 5 
  }
]

POST

To POST a new object to your existing array for Product, select POST, then paste localhost:5000/Product into the field. Then click Body underneath the field, select raw, and then paste this below snippet or make one similar then click send. The result should be the new Product you made:

 {
"price": 32.23,
"title": 'glad',
"description": 'happy',
"customerId": 8,
"quantity": 48,
"productTypeId": 8
  }

PUT

To update an existing product, select PUT then paste localhost:5000/Product/6 or any other existing ProductId. Then follow the same directions as the POST example, and change the values then click send:

  {
"price": 22.23,
"title": 'glad',
"description": 'mad',
"customerId": 8,
"quantity": 49,
"productTypeId": 8
  }

You should get nothing back from this besides an OK status. When you run the GET query the computer you specified in your PUT query should show the updated, edited information you gave it.

DELETE

To DELETE an existing product, select DELETE then paste localhost:5000/Product/6 or any other existing ProductId then click send. You should get nothing back from this besides an OK status. When you run the GET query the product with the Id you specified in your DELETE query should no longer exist.

8. Computer

Use the command dotnet run to start the program, BangazonAPI. Once the program is running, open up the Postman desktop app and run the following commands for each request method:

GET

To GET all Computers, select GET in Postman then paste localhost:5000/computer into the field and click send. The result should be an array of all the Computers in the database that should look like:

[
    {
        "computerId": 1,
        "datePurchased": "2017-10-11T00:00:00",
        "dateDecommissioned": null,
        "working": true,
        "modelName": "XPS",
        "manufacturer": "Dell"
    },
    {
        "computerId": 3,
        "datePurchased": "2018-12-11T00:00:00",
        "dateDecommissioned": null,
        "working": true,
        "modelName": "Pro",
        "manufacturer": "Mac"
    }
]

To GET a specific, single computer, add an /{id} to the end of the localhost:5000/computer URL. The result should only include the single computer with the Id you added like the below:

{
    "computerId": 1,
    "datePurchased": "2017-10-11T00:00:00",
    "dateDecommissioned": null,
    "working": true,
    "modelName": "XPS",
    "manufacturer": "Dell"
}
POST

To POST a new object to your existing array for Computer, select POST, then paste localhost:5000/computer into the field. Then click Body underneath the field, select raw, and then paste this below snippet or make one similar then click send. The result should be the new Computer you made:

{
    "datePurchased": "2017-10-11T00:00:00",
    "dateDecommissioned": null,
    "working": false,
    "modelName": "XPS",
    "manufacturer": "Dell"
}
PUT

To update an existing computer, select PUT then paste localhost:5000/computer/2 or any other existing computer. Then follow the same directions as the POST example, and change the values then click send:

{
    "datePurchased": "2017-10-11T00:00:00",
    "dateDecommissioned": "2018-12-13",
    "working": false,
    "modelName": "XPS",
    "manufacturer": "Dell"
}

You should get nothing back from this besides an OK status. When you run the GET query the Computer you specified in your PUT query should show the updated, edited information you gave it.

DELETE

To DELETE an existing Computer, select DELETE then paste localhost:5000/computer/2 or any other existing Computer then click send. You should get nothing back from this besides an OK status. When you run the GET query the computer with the Id you specified in your DELETE query should no longer exist.

bangazonapi's People

Contributors

williamkimball avatar shu52 avatar joeysgithuub avatar 1asdfghjkl7 avatar leahhoefling avatar

Watchers

James Cloos avatar  avatar

bangazonapi's Issues

3.1 PaymentType

  • Create PaymentType model
  • Create PaymentType Controller
    • GET a list
    • GET a single item
    • POST
    • PUT
    • DELETE

1.1 Allow developers to access Customer resource

  • Customer Controller
  • GET
  • POST
  • PUT
  • User should be able to GET a list of customers, and GET a single customer.
  • If the query string parameter of ?_include=products is provided, then any products that the customer is selling should be included in the response.
  • f the query string parameter of ?_include=payments is provided, then any payment types that the customer has used to pay for an order should be included in the response.
  • If the query string parameter of q is provided when querying the list of customers, then any customer that has property value that matches the pattern should be returned.

Allow developers to access the Training Program resource

Verbs to be supported

  1. GET
  2. POST
  3. PUT
  4. DELETE (but only if the start date is in the future)
  • User should be able to GET a list, and GET a single item.
  • Employees who signed up for a training program should be included in the response
  • Should be able to view only programs starting today, or in the future, with the ?completed=false query string parameter.

Allow developers to access Customer resource

Verbs to be supported

  1. GET
  2. POST
  3. PUT
  • User should be able to GET a list of customers, and GET a single customer.
  • If the query string parameter of ?_include=products is provided, then any products that the customer is selling should be included in the response.
  • If the query string parameter of ?_include=payments is provided, then any payment types that the customer has used to pay for an order should be included in the response.
  • If the query string parameter of q is provided when querying the list of customers, then any customer that has property value that matches the pattern should be returned.

If /customers?q=Mic is requested, then any customer whose first name is Michelle, or Michael, or Mick should be returned. Any customer whose last name is Michaelangelo, or Micacci, Micajkov should be returned. Every property of the customer object should be checked for a match.

9.1 Allow developers to access the Training Program resource

Verbs to be supported

  • GET
  • POST
  • PUT
  • DELETE (but only if the start date is in the future)
  • User should be able to GET a list, and GET a single item.
  • Employees who signed up for a training program should be included in the response
  • Should be able to view only programs starting today, or in the future, with the ?completed=false query string parameter.

Allow developers to access the Order resource

Verbs to be supported

  1. GET
  2. POST
  3. PUT
  4. DELETE
  • User should be able to GET a list, and GET a single item.
  • When an order is deleted, every line item (i.e. entry in OrderProduct) should be removed
  • Should be able to filter out completed orders with the ?completed=false query string parameter. If the parameter value is true, then only completed order should be returned.
  • If the query string parameter of ?_include=products is in the URL, then the list of products in the order should be returned.
  • If the query string parameter of ?_include=customers is in the URL, then the customer representation should be included in the response.

title test

Description

Fixes Issue number:

Type of change

Please delete options that are not relevant.

  • New feature (a non-breaking change which adds functionality)

Testing Instructions

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added test instructions that prove my fix is effective or that my feature works

Allow developers to access the Department resource

Verbs to be supported

  1. GET
  2. POST
  3. PUT
  • User should be able to GET a list, and GET a single item.
  • If the query string parameter of ?_include=employees is provided, then all employees in the department(s) should be included in the response.
  • If the query string parameters of ?_filter=budget&_gt=300000 is provided on a request for the list of departments, then any department whose budget is $300,000, or greater, should be in the response.

Allow developers to browse and modify API with client-side application

We need a bare-bones, single page, client application written with a component-based JavaScript framework that will allow our customers to view all resources, add new resources, and modify existing resources.

Do not allow client application to delete resource for first iteration.

6.1 Allow developers to access the Employee resource

  • GET a list of Employee
  • GET a single Employee
  • POST a new Employee to the database
  • PUT an Employee that already exists in the database
  • The employee's department name should be included in the employee representation
  • A representation of the computer that the employee is currently using should be included in the employee representation

Allow developers to access the Employee resource

Verbs to be supported

  1. GET
  2. POST
  3. PUT
  • User should be able to GET a list, and GET a single item.
  • The employee's department name should be included in the employee representation
  • A representation of the computer that the employee is currently using should be included in the employee representation

4.1 Allow developers to access the Order resource

Verbs to be supported

  1. GET
  2. POST
  3. PUT
  4. DELETE
  • User should be able to GET a list, and GET a single item.
  • When an order is deleted, every line item (i.e. entry in OrderProduct) should be removed
  • Should be able to filter out completed orders with the ?completed=false query string parameter. If the parameter value is true, then only completed order should be returned.
  • If the query string parameter of ?_include=products is in the URL, then the list of products in the order should be returned.
  • If the query string parameter of ?_include=customers is in the URL, then the customer representation should be included in the response.

Order detail JSON should contain product details

Update the Order detail JSON object should contain all nested Product information.

For example:

{
   OrderId: 21,
   CustomerId: 16,
   PaymentTypeId: 83,
   Products: [
      {
         ProductId: 156,
         Name: "Kite",
         Price: 14.25
         Quantity: 1
      },
      {
         ProductId: 212,
         Name: "Roller blades",
         Price: 88.99
         Quantity: 1
      }
   ]
}

#4.1 GET Order List and Single

  • User should be able to GET a single item.

  • User should be able to GET a list.

  • Should be able to filter out completed orders with the ?completed=false query string parameter. If the parameter value is true, then only completed order should be returned.

  • If the query string parameter of ?_include=products is in the URL, then the list of products in the order should be returned.

  • If the query string parameter of ?_include=customers is in the URL, then the customer representation should be included in the response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.