GithubHelp home page GithubHelp logo

csci-ga-2820-su23-001 / customers Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 4.0 215 KB

NYU DevOps Customers Service Summer 2023

License: Apache License 2.0

Dockerfile 1.36% Shell 1.48% Makefile 3.66% Procfile 0.07% Python 73.60% HTML 5.79% JavaScript 9.36% Gherkin 4.68%

customers's Introduction

NYU DevOps Project Template

License Python

codecov Build Status Build Status

This is a skeleton you can use to start your projects

Overview

This project template contains starter code for your class project. The /service folder contains your models.py file for your model and a routes.py file for your service. The /tests folder has test case starter code for testing the model and the service separately. All you need to do is add your functionality. You can use the lab-flask-tdd for code examples to copy from.

Automatic Setup

The best way to use this repo is to start your own repo using it as a git template. To do this just press the green Use this template button in GitHub and this will become the source for your repository.

Manual Setup

You can also clone this repository and then copy and paste the starter code into your project repo folder on your local computer. Be careful not to copy over your own README.md file so be selective in what you copy.

There are 4 hidden files that you will need to copy manually if you use the Mac Finder or Windows Explorer to copy files from this folder into your repo folder.

These should be copied using a bash shell as follows:

    cp .gitignore  ../<your_repo_folder>/
    cp .flaskenv ../<your_repo_folder>/
    cp .gitattributes ../<your_repo_folder>/

Running the service

The project uses honcho which gets it's commands from the Procfile. To start the service:

$ honcho start

You could reach the service at: http://localhost:8000 as defined in the .flaskenv file, which Flask uses to load it's configuration from the environment by default.

Customer Service APIs

Customer Operations

Endpoint Methods Rule
create_customers POST /customers
get_customers GET /customers/{int:customer_id}
update_customers PUT /customers/{int:customer_id}
delete_a_customer DELETE /customers/{int:customer_id}
list_customers GET /customers

APIs Usage

Create a Customer

URL : http://127.0.0.1:8000/customers

Method : POST

Auth required : No

Permissions required : No

Create a customer using a JSON file that includes the customers's name, address, email, phone_number and password.

Example:

Request Body (JSON)

{
  "name": "John Doe",
  "address": "5th Fifth Ave, NY",
  "email": "[email protected]",
  "phone_number": "12345678",
  "password": "password",
  "available": True
}


Success Response : HTTP_200_CREATED

[
  {
    "id":1,
    "name": "John Doe",
    "address": "5th Fifth Ave, NY",
    "email": "[email protected]",
    "phone_number": "12345678",
    "password": "password",
    "available": True
}
]

Read a Customer

URL : http://127.0.0.1:8000/customers/{int:customer_id}

Method : GET

Auth required : No

Permissions required : No

Read all information of a customer with given id

Example:

Success Response : HTTP_200_OK

[
  {
    "id":1,
    "name": "John Doe",
    "address": "5th Fifth Ave, NY",
    "email": "[email protected]",
    "phone_number": "12345678",
    "password": "password",
    "available": True
}
]

Failure Response : HTTP_404_NOT_FOUND

{
  "error": "Not Found",
  "message": "404 Not Found: Customer with id '3' was not found.",
  "status": 404
}

Update a Customer

URL : http://127.0.0.1:8000/customers/{int:customer_id}

Method : PUT

Auth required : No

Permissions required : No

Updates a customer with id provided in the URL according to the updated fields provided in the body

Example:

Request Body (JSON)

  {
    "name": "John Foo",
    "address": "5th Fifth Ave, NY",
    "email": "[email protected]",
    "phone_number": "12345678",
    "password": "password",
    "available": True
}

Success Response : HTTP_200_OK

[
  {
    "id":1,
    "name": "John Foo",
    "address": "5th Fifth Ave, NY",
    "email": "[email protected]",
    "phone_number": "12345678",
    "password": "password",
    "available": True
}
]

Failure Response : HTTP_404_NOT_FOUND

{
  "error": "Not Found",
  "message": "404 Not Found: Customer with id '2' was not found.",
  "status": 404
}

Delete a Customer

URL : http://127.0.0.1:8000/customers/{int:customer_id}

Method : DELETE

Auth required : No

Permissions required : No

Deletes a Customer with id

Example:

Success Response : 204 NO CONTENT

List Customers

This is the planned version of listing customers. Currently the listing part still have some errors

URL : http://127.0.0.1:8000/customers

Method: GET

Auth required : No

Permissions required : No

List All Customers

Example:

Success Response : HTTP_200_OK

[
  {
    "id":1,
    "name": "John Foo",
    "address": "5th Fifth Ave, NY",
    "email": "[email protected]",
    "phone_number": "12345678",
    "password": "password",
    "available": True
}
]

Contents

The project contains the following:

.gitignore          - this will ignore vagrant and other metadata files
.flaskenv           - Environment variables to configure Flask
.gitattributes      - File to gix Windows CRLF issues
.devcontainers/     - Folder with support for VSCode Remote Containers
dot-env-example     - copy to .env to use environment variables
requirements.txt    - list if Python libraries required by your code
config.py           - configuration parameters

service/                   - service python package
├── __init__.py            - package initializer
├── models.py              - module with business models
├── routes.py              - module with service routes
└── common                 - common code package
    ├── error_handlers.py  - HTTP error handling code
    ├── log_handlers.py    - logging setup code
    └── status.py          - HTTP status constants
└── static                 - static code package
    ├── css                - UI page format
    ├── images             - UI page mage
    ├── js                 - UI page constants
    └── index.html         - UI page alignment

tests/              - test cases package
├── __init__.py     - package initializer
├── test_models.py  - test suite for business models
└── test_routes.py  - test suite for service routes

License

Copyright (c) John Rofrano. All rights reserved.

Licensed under the Apache License. See LICENSE

This repository is part of the NYU masters class: CSCI-GA.2820-001 DevOps and Agile Methodologies created and taught by John Rofrano, Adjunct Instructor, NYU Courant Institute, Graduate Division, Computer Science, and NYU Stern School of Business.

customers's People

Contributors

iamalicialin avatar yanchenn avatar nikhilyadavnyu avatar jeffrey2545 avatar nicolyn2517 avatar jjrofrano avatar

Stargazers

Mike Odnis avatar

Watchers

 avatar

customers's Issues

add elements to the UI to Read customer [Requirement #4]

As a eCommerce manager
I need a user interface to read customer data
So that I can find the given customer information

Details and Assumptions

Implement the UI page for reading a given customer.

The easiest way is to use the sample UI code in lab-flask-bdd as an example. You will also need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.

Attention: Bdd testing for create customer UI should be included in our work.

  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in
  • Write the features using Gherkin syntax that is understood by the behave tool

Acceptance Criteria

Run testing using behave until all scenarios are green

Update README

update the README.md according to the updates in this project

Modify root URL interface (problem of hw2)

As per the homework 2, our microservice root URL ('/') should return some useful information about the service like the name, version, and what the List resource URL is as JavaScript Object Notation (JSON).

Deploy application to IBM cloud

As a developer
I need to create Kubernetes cluster on IBM cloud
So that I can deploy our application and its services on IBM cloud

Acceptance criteria:

All team members have created IBM account and the Maintainer of your repo must must invite other members of your team to their IBM Cloud account.

Assumptions and Details:

Add a /health endpoint to your service that returns {"status":"OK}, 200 to be used as a health check for Kubernetes.
Create a dev namespace and a prod namespace in your Kubernetes cluster to deploy the development and production versions of your service.
Create the necessary Kubernetes metadata files for deployment (deployment.yaml, service.yaml, secrets.yaml, postgres.yaml, etc.) file so that Kubernetes will know how to deploy your application.
Use the Kubernetes CLI kubectl command to deploy your service to your Kubernetes cluster manually.
Get the IP address of your worker node and combine it with you port to go to the URL of your service and make sure that it works

Complete swagger docs and specify data model [Requirement #5]

**As a developer [role]
**I need to complete swagger docs and specify data model [function]
**So that others know what to send to our API [benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [some context]
When [action taken]
Then [outcome observed]

Implement a simple single page UI [Requirement #4]

As a eCommerce manager
I need to mange all the customer information easily
So that a UI to administer the application is necessary

We need to create a web user interface for your backend microservice for administrators of the service. The easiest way is to use the sample UI code in lab-flask-bdd as an example. We can modify the sample UI for our resource or build our own.

This issue requires an initialization of the UI. Adding details and functionalities will be in the following issues.

Enhance current REST API by adding query capability [Requirement #1]

As a developer,
I need to enhance the existing REST API by adding query and action capabilities.
So that users can filter the results and perform custom actions on the resources using name, email, address

Assumptions
The API will be built using the Flask framework in Python.
The customer and address data will be stored in a database.

Acceptance criteria
Ensure that the code coverage remains at 95% or above.
Run test cases and linter to validate the functionality and code quality.
Create pull requests after the tests pass and the code is clean.

Add Swagger annotations [Requirement #5]

**As a developer [role]
**I need to add swagger annotations to our service [function]
**So that to document our REST API using Flask-RESTX [benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [some context]
When [action taken]
Then [outcome observed]

Improve the UI

As a eCommerManager
I want a clear and nice-looking UI page
So that I can have better feeling while interacting with the app

Details and Assumptions

Improve the UI, refining the buttoms, outlines.. whatever you want.

Implement an API to create users

**As a user[role]
**I need to register a new account [function]
**So that I could log in the system and realize other functions [benefit]

Details and Assumptions

  • [The base URL would be /customers/{customer_id}]

Acceptance Criteria

Given [user click the register button]
When [user wants to register a new account]
Then [user will be redirected to the register page and can enter the user name, password and home address.]

More tests to increase coverage

More unit test are needed error_handlers. Need to go over apis and tests to check if there are any error cases missing. The coverage should be increased to at lease 95.

image.png

add elements to the UI to Delete customer [Requirement #4]

As a eCommerce manager
I need a user interface to delete the customer data
So that I can delete a customer when he quit the app

Details and Assumptions

Implement the UI page for deleting a given customer.

The easiest way is to use the sample UI code in lab-flask-bdd as an example. You will also need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.

Attention: Bdd testing for create customer UI should be included in our work.

  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in
  • Write the features using Gherkin syntax that is understood by the behave tool

Acceptance Criteria

Run testing using behave until all scenarios are green

Syntax error fixing

Describe the bug
auto tests indicating some syntax errors.
image.png

To Reproduce
follow the error message to fix.

Build an automated CI DevOps Pipeline [Requirement #6]

As a developer
I need automated integration and delivery pipeline
So that I can easily test, build and deploy our app.

Details and Assumptions

add a DevOps Pipeline to deploy your service to the IBM Cloud automatically. It should also run your TDD unit tests and your BDD integration tests. You will set up a DevOps Pipeline that will have 4 stages (Build, Deploy, Test, Production). The Build stage will also run TDD (unit) tests and then call the Deploy Stage to deploy to a
Development instance. Then the Integration Test Stage will run your BDD
tests against the running development instance, and if all of the tests pass,
it will deploy to a Production instance.

Your Dev and Prod instances should use different database instances if the free IBM Cloud account allows this (some services you can only have one of with the free trial). The easiest thing to do is to just deploy your database in your cluster and not have to worry about this.

Acceptance Criteria

We are looking for:

an operational pipeline with 4 stages that is trigger by a commit to the master branch on your GitHub repo that runs the TDD unit tests, and if successful deploys to your Dev space, then runs the BDD integration tests against the service running in dev, and if successful deploys the service to the Prod space.

Back to python 3.9

There is a bug in the docker-in-docker feature on Apple Silicon that is not compatible with Python 3.11 and causes the devcontainer to not build..
We have to go back to using Python 3.9 😞 Please change the base image in your project to:
FROM rofrano/nyu-devops-base:sp23
Notice that's sp23 (Spring 2023) instead of su23 (Summer 2023). This only affects Apple Silicon Macs but everyone should go back to keep things the same.

Add continuous integration

**As a developer [role]
**I need introducing automation in the application development phase [function]
**So that we could have the Ability to deliver applications to customers frequently [benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [we need to deliver to customers frequently]
When [develop a product or a function]
Then [we create CI to make all procedures be tested automatically ]

Add Swagger data models [Requirement #5]

**As a developer [role]
**I need to add Swagger data models [function]
**So that to document API payloads [benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [some context]
When [action taken]
Then [outcome observed]

Implement Customer Data Modification API

As a user
I need a way to modify customer data
so that I could update my user information

Details and Assumptions

Create a new RESTful API endpoint for the customer microservice. This endpoint allows other microservices to modify specific customer data based on a given customer ID.

API Specifications:

  • Input: JSON object containing all the updated information related to the customer identified by the given customer_id. The data set will include a customer id and some other fields such as name, address, transaction history and so on.

  • Output: The API returns the updated customer information, which should be a comprehensive data set.

  • Endpoint Design: The API endpoint path should follow the format: '/customer/{customer_id},' where customer_id is a variable for the unique customer's ID.

  • HTTP Method: The API should leverage the HTTP PUT method to modify customer data.

Syntax error fixing

Describe the bug
auto tests indicating some syntax errors.
image.png

To Reproduce
follow the error message to fix.

Refactor micro service to use Flask-RESTX [Requirement #5]

**As a developer [role]
**I need to move from a basic Flask application to one that uses FlaskRESTX. [function]
**So that it provides Swagger documentation with very little effort.[benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [some context]
When [action taken]
Then [outcome observed]

create bdd.yml [Requirement #4]

**As a developer [role]
**I need every pr run bdd tests [function]
**So that our code cover bdd features [benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [some context]
When [action taken]
Then [outcome observed]

Implement Customer Data Retrieval API

In our ongoing effort to bolster interoperability between microservices, there is a need to create a new API endpoint for the customer microservice. This endpoint will allow other microservices to retrieve specific customer data based on a given customer ID.

API Specifications:

1. API Type: The API should adhere to RESTful principles, providing a consistent, stateless, client-server communication model.

2. Input: The API will accept a single parameter, which is the 'customer_id.'

3. Output: The API should return a comprehensive data set related to the customer identified by the 'customer_id'. This may include but is not limited to name, address, contact details, transaction history, and other relevant details. Please define the structure of the returned JSON data object.

4. Endpoint Design: The API endpoint path should follow the format: '/customer/{customer_id},' where 'customer_id' is a variable representing the customer's ID.

5. HTTP Method: The API should leverage the HTTP GET method to retrieve customer data.

Initial BDD test environment [Requirement #4]

We need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.
This will be the gate in our DevOps Pipeline to deploy to Production. This is also a complement for the story #38.

To solve this issue, we need to:

  • Add .github/workflows/bdd.yml file
  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in.
  • Write the features using Gherkin syntax that is understood by the behave tool
  • Use Selenium to conduct your UI testing. There should be no direct connection to your service from your BDD tests. It should interact with the web interface only!

Attention: this is just an init of our bdd testing. All the detailed work should be implemented with the implementation of UI.

add elements to the UI for Action [Requirement #4]

### NOT COMPLETED FOR NOW

As a
I need
So that

Details and Assumptions

The easiest way is to use the sample UI code in lab-flask-bdd as an example. You will also need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.

Attention: Bdd testing for create customer UI should be included in our work.

  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in
  • Write the features using Gherkin syntax that is understood by the behave tool

Acceptance Criteria

Run testing using behave until all scenarios are green

Create a database model about infomation of customers

As a back-end developer
I need to maintain the information of customers
So that I need to create a database model to store and maintain data

Details & Assumptions:

  • The database's entity is the customer.

  • The database's attributes include name, address, phone number, gender, password, user_id, username, photo, etc.

  • Some attributes are not null, like name, user_id, username, password.

Acceptance Criteria:

The database can support a series of operations like add, delete, update, and search.
Every API will access the database model to get customers' data.

create database model for listing resources

As a Developer
I need to create database model for customer data
So that I could store customer information

Assumptions:
-It will need a database management system known as MySQL
Database model will be implemented using python

Acceptance Criteria
When search a query to find out a customer information
Given the customer information like first name, last name, one or more addresses, customer ID
Given the userid and password for all customer
Given the customer ID is the primary key of unique identifier
Then I should retrieve the information of required customer

Development of SQL Queries for Customer Data Modification API

As a back-end developer
I need a way to connect the database and server
So that I can update all the changes to the database

Details & Assumptions:

We need to devise appropriate SQL queries that interact with our pre-existing MySQL 'Customers' table. This issue focuses on the creation and testing of SQL queries to perform essential data operations.

  • SQL Queries: This query will be paramount for the API. It allows you to modify the customer information related to the customer given by the unique customer_id.

  • Data Integrity: First we need to ensure that all SQL queries respect data integrity rules of the 'Customers' table. Cross-check with existing constraints and relationships in the table design. Take care of all the edge cases and illegal modification.

  • Performance: The 'customer_id' field, the main reference in our queries, should already be indexed for efficient data retrieval and modification. Ensure that your queries are optimized to leverage this and other indexes where applicable.

create API to list resources

As a developer,
I need to create an API for the customers service,
So that I can manage customer data in the eCommerce site.

Assumptions:

  • The API will be built using the Flask framework in Python.
  • The customer and address data will be stored in a database.

Acceptance Criteria:
When I search for the customer data
Given the customer data including: first name, last name, customer ID and addresses
Given customer ID can be used for uniquely identifying them
Given address should contain fields such as street, city, state, and postal code.
Given customer can have more than one addresses
Given need implement REST API to store one or more addresses
Given the customer ID have user ID and password
Then the API should support retrieving a list of all customers.

Add password verification function for updating customer

As a User
I need an old password verification when changing my password
So that my account is secured

Details and Assumptions

  • Either in the api or the application side, we need to add this feature: while updating the customer information, especially the password. A request to type in the old password should be made. Then we could do the password verification before updating crucial information.

Update python 3.9 to 3.11

As a developer
I need to upgrade the development environment to Python 3.11 and update requirements.txt, Makefile, and setup.cfg
So that we use the updated version of Python for the project

Update requirements.txt, Makefile, and setup.cfg to replace nose (which is not compatible with Python 3.11) with green instead

add elements to the UI to Update customer [Requirement #4]

As a eCommerce manager
I need a user interface to update customer data
So that I can modify customer information

Details and Assumptions

Implement the UI page for updating a given customer.

The easiest way is to use the sample UI code in lab-flask-bdd as an example. You will also need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.

Attention: Bdd testing for create customer UI should be included in our work.

  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in
  • Write the features using Gherkin syntax that is understood by the behave tool

Acceptance Criteria

Run testing using behave until all scenarios are green

Add the prefix /api to our REST API [Requirement #5]

**As a developer [role]
**I need to add the prefix /api to our REST API [function]
**So that the swagger docs will work on the root URL. [benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [some context]
When [action taken]
Then [outcome observed]

add elements to the UI to Create customer [Requirement #4]

As a eCommerce manager
I need a user interface to create new customer in the database
So that I can simply add new user when necessary

Details and Assumptions

Implement the UI page for creating a new customer.

The easiest way is to use the sample UI code in lab-flask-bdd as an example. You will also need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.

Attention: Bdd testing for create customer UI should be included in our work.

  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in
  • Write the features using Gherkin syntax that is understood by the behave tool

Acceptance Criteria

Run testing using behave until all scenarios are green

Add a CI badge

**As a developer[role]
**I need a badge [function]
**So that I can figure out quickly whether this build fails or passes [benefit]

Details and Assumptions

  • [document what you know]

Acceptance Criteria

Given [we need to figure out whether build fails or passes]
When [a build finished]
Then [a badge should explicitly shows us pass or fails]

Develop and maintain Readme.md

**As a developer [role]
**I need a document to have a better understanding about this project[function]
**So that I could develop this project in a more consistent way [benefit]

Details and Assumptions

  • [This part will contain the basic function explanation of our project]

Acceptance Criteria

Given [other developers want to have a general view of the project]
When [they will continue develop this project based on our achievements ]
Then [they could have a look at our readme.md to have a general view and make this project more consistent]

Implement an Action endpoint route for customer service [Requirement #1]

An Action is a method that does something to the resource other than CRUD. Some actions might be cancelling an order, liking a product or recommendation, suspending a user, etc. Refer to the lecture of REST API's for more examples of Actions.

we need to implement a new endpoint for our action that follows the REST API guidelines learned in class for actions.

Add Docker devcontainer support

As a developer
I need a way to work locally and individually
So that I can run and test my work without being disturbed by other's updates

Details & Assumptions

After initial environment set-up, build a local dev environment using Visual Studio Code and Docker. Python is the expected developing language.

When I issue `git clone` on the project
And I change into the project folder
And I issue `code .`
Then I should have a complete development environment on my workstation````

add elements to the UI to List customer [Requirement #4]

As a eCommerce manager
I need a user interface to list all customer data
So that I can view all the customers' information

Details and Assumptions

Implement the UI page for listing all customers.

The easiest way is to use the sample UI code in lab-flask-bdd as an example. You will also need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.

Attention: Bdd testing for create customer UI should be included in our work.

  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in
  • Write the features using Gherkin syntax that is understood by the behave tool

Acceptance Criteria

Run testing using behave until all scenarios are green

Invalid param, functions, package names in test and service

Describe the bug
The api implementation for listing customers contains some invalid params, functions and packages. Tests keep failing

To Reproduce
pull the master to local work space and run the tests. Then you can see the error

Expected behavior
A clear and concise description of what you expected to happen.
Since there are too many errors in the last merge. It will be quicker to undo the merge and fix all the bugs locally.
Steps to reproduce the behavior:

  1. In github, undo the merge
  2. pull the master to local workspace
  3. fix the bugs and make sure the tests are running locally
  4. push to remote

image.png

Build an automated CD DevOps Pipeline [Requirement #6]

As a developer
I need automated integration and delivery pipeline
So that I can easily test, build and deploy our app.

Details and Assumptions

add a DevOps Pipeline to deploy your service to the IBM Cloud automatically. It should also run your TDD unit tests and your BDD integration tests. You will set up a DevOps Pipeline that will have 4 stages (Build, Deploy, Test, Production). The Build stage will also run TDD (unit) tests and then call the Deploy Stage to deploy to a
Development instance. Then the Integration Test Stage will run your BDD
tests against the running development instance, and if all of the tests pass,
it will deploy to a Production instance.

Your Dev and Prod instances should use different database instances if the free IBM Cloud account allows this (some services you can only have one of with the free trial). The easiest thing to do is to just deploy your database in your cluster and not have to worry about this.

Acceptance Criteria

We are looking for:

an operational pipeline with 4 stages that is trigger by a commit to the master branch on your GitHub repo that runs the TDD unit tests, and if successful deploys to your Dev space, then runs the BDD integration tests against the service running in dev, and if successful deploys the service to the Prod space.

Add Codecov and Github Actions for testing

As a Developer
I need github actions auto test
So that all the PR will be auto tested before merging

Details and Assumptions

*follow the instructions in the slides 05 - CI, adding github actions files and Codecov.

Development of SQL Queries for Customer Data Retrieval API

To ensure the seamless operation of our upcoming Customer Data Retrieval API, we need to devise appropriate SQL queries that interact with our pre-existing MySQL 'Customers' table. This issue focuses on the creation and testing of SQL queries to perform essential data operations.

Details & Assumptions:

1. SQL Queries: This query will be paramount for the API, enabling the retrieval of comprehensive customer data based on a specific 'customer_id'. The query should be written with performance optimization in mind.

2. Data Integrity: Please ensure that all SQL queries respect data integrity rules of the 'Customers' table. Cross-check with existing constraints and relationships in the table design.

3. Performance: The 'customer_id' field, the main reference in our queries, should already be indexed for efficient data retrieval. Ensure that your queries are optimized to leverage this and other indexes where applicable.

Implement Customer Data Deletion API

As a backend developer
I need to implement the operation of deleting customers' data
So that I need to create an API to delete customers' data

Details & Assumptions:

  • There should be one operation for customers to delete their data, like deleting accounts.

  • When customers make requests to delete their data, the server should receive the request and make an API call.

  • Implementing the API call needs to use a related function to access the database and delete the record of the customer.

  • At last, the front end will refresh the page and tell customers that their data have been deleted

Acceptance Criteria:

There is a database for managing user information.
In the user information management interface, users have the option to delete their data.
After deleting the data, the interface will automatically refresh, and users will be able to see the appearance of the interface after the deletion.

Setting Up Python Flask for Customer API

In preparation for the development of our upcoming Customer API, we need to establish a basic Python Flask environment. This issue involves installing the necessary software, initializing the Flask app, and configuring its basic settings.

Details & Assumptions:

1. Installation: Install Python Flask on the designated development environment. Ensure that the installed version is compatible with our existing systems and the requirements of the API.

2. Initialization: Initialize a new Flask app dedicated to the customer data retrieval. Establish a suitable directory structure for the project.

3. Basic Configuration: Set up the basic configuration settings for the Flask app. This may include, but not limited to, setting up the appropriate development, testing, and production environments.

4. Routes Setup: Prepare a basic route for the API endpoint ('/customer/{customer_id}') using the HTTP GET method. For now, this route should return a simple placeholder message indicating successful setup.

add elements to the UI for Query [Requirement #4]

### NOT COMPLETED FOR NOW

As a
I need
So that

Details and Assumptions

The easiest way is to use the sample UI code in lab-flask-bdd as an example. You will also need a Behavior Driven Development test suite that runs integration tests using Selenium against this UI.

Attention: Bdd testing for create customer UI should be included in our work.

  • Create the BDD features/steps folders and a.feature file and accompanying steps.py files to test your RESTful API from the outside in
  • Write the features using Gherkin syntax that is understood by the behave tool

Acceptance Criteria

Run testing using behave until all scenarios are green

create API using SQL queries

As a backend Developer
I need to use SQL queries to create API
So that I could perform CRUD (create, read, update and delete) operations on customer data

Assumptions:
-It will need a database management system known as MySQL
Database model will be implemented using python

Acceptance Criteria
When create API using SQL queries
Given the create table endpoint allowing to create table to add the customer information
Given the create endpoint allowing addition of new customer information
Given the update endpoint allowing updating the customer information
Given the read endpoint allowing to read the customer information
Given the delete endpoint allowing to delete the customer information
Then I could create API for customers by feeding required information

Development of SQL Queries for Customer Data Deletion API

As a back-end developer
I need to connect the database and server
So that I need to develop a set of SQL queries for customer data deletion API

Details & Assumptions:

  • The SQL queries need user_id to find the customer and his data.
  • After finding the customer, SQL queries should delete the customer.

Acceptance Criteria:

When the customer requests to delete data
The server should receive the request and use SQL queries to delete data
Then deliver the modified data to front-end

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.