-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocument_type_controller.py
More file actions
28 lines (22 loc) · 977 Bytes
/
document_type_controller.py
File metadata and controls
28 lines (22 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from models.document_type_model import DocumentTypeModel
class DocumentTypeController:
def __init__(self):
self.model = DocumentTypeModel()
def load_document_types(self):
"""Carga todos los tipos de documentos."""
return self.model.load_document_types()
def get_document_type_by_id(self, doc_type_id):
"""Obtiene un tipo de documento por su ID."""
return self.model.get_document_type_by_id(doc_type_id)
def add_document_type(self, name):
"""Agrega un nuevo tipo de documento."""
try:
self.model.add_document_type(name)
except ValueError as e:
raise e
def update_document_type(self, doc_type_id, name):
"""Actualiza un tipo de documento existente."""
self.model.update_document_type(doc_type_id, name)
def delete_document_type(self, doc_type_id):
"""Elimina un tipo de documento."""
self.model.delete_document_type(doc_type_id)