Skip to content

create endpoints for the employee and books#2

Open
ghost wants to merge 1 commit intomainfrom
balaji
Open

create endpoints for the employee and books#2
ghost wants to merge 1 commit intomainfrom
balaji

Conversation

@ghost
Copy link

@ghost ghost commented Sep 5, 2024

This pull request adds endpoints to manage employees and books in the application. It includes full CRUD operations

GET: Retrieve all or specific employee/book.
POST: Add a new employee/book.
PUT: Update existing employee/book.
DELETE: Remove an employee/book by ID.

# cur=conn.cursor()


db_config = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This credentials should be from config and config will not be pushed to git.

def get(self):
conn = db_connection()
cursor = conn.cursor(pymysql.cursors.DictCursor)
query = "SELECT * FROM employee"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO DB calls in service file. All external call like db or external api will be via coordinator.



# Database connection
def db_connection():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not declare this in each service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants