feat(backend): add the db connection

This commit is contained in:
2025-08-20 15:08:30 -04:00
parent 7b64dbe150
commit 8f0dc0d658
13 changed files with 375 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
from ..connection import DatabaseConnection
class Service:
def __init__(self, service_type_id: int, service_date: str):
self.service_type_id = service_type_id
self.service_date = service_date
def save(self, db: DatabaseConnection):
query = "INSERT INTO Services (ServiceTypeId, ServiceDate) VALUES (?, ?)"
db.execute_query(query, (self.service_type_id, self.service_date))
@classmethod
def get_all(cls, db: DatabaseConnection):
query = "SELECT * FROM Services"
return db.execute_query_with_return(query)