Browse Source

Add service for export dataset

pull/1310/head
Hironsan 3 years ago
parent
commit
c0fcf8092c
1 changed files with 14 additions and 0 deletions
  1. 14
      app/api/views/download/service.py

14
app/api/views/download/service.py

@ -0,0 +1,14 @@
from .repositories import BaseRepository
from .writer import BaseWriter
class ExportApplicationService:
def __init__(self, repository: BaseRepository, writer: BaseWriter):
self.repository = repository
self.writer = writer
def export(self, export_approved=False) -> str:
records = self.repository.list(export_approved=export_approved)
filepath = self.writer.write(records)
return filepath
Loading…
Cancel
Save