mirror of
https://github.com/sartography/uva-covid19-testing-communicator.git
synced 2025-02-23 04:18:11 +00:00
Don't load samples from firebase (they will be added via direct calls to the api)
Provide a mechanism to clear out all the samples - should remove this or protect it at some point.
This commit is contained in:
parent
75ff45e9e4
commit
6ee2d4f019
@ -63,6 +63,14 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Sample"
|
||||
delete:
|
||||
operationId: communicator.api.admin.clear_samples
|
||||
summary: Removes the given samples completely.
|
||||
tags:
|
||||
- Studies
|
||||
responses:
|
||||
'204':
|
||||
description: All Samples removed.
|
||||
components:
|
||||
schemas:
|
||||
Status:
|
||||
|
@ -20,14 +20,16 @@ def add_sample(body):
|
||||
db.session.add(sample)
|
||||
db.session.commit()
|
||||
|
||||
def clear_samples():
|
||||
db.session.query(Sample).delete()
|
||||
db.session.commit()
|
||||
|
||||
def update_data():
|
||||
"""Updates the database based on local files placed by IVY and records
|
||||
read in from the firecloud database."""
|
||||
fb_service = FirebaseService()
|
||||
"""Updates the database based on local files placed by IVY. No longer attempts
|
||||
to pull files from the Firebase service."""
|
||||
ivy_service = IvyService()
|
||||
|
||||
samples = fb_service.get_samples()
|
||||
samples.extend(ivy_service.load_directory())
|
||||
samples = ivy_service.load_directory()
|
||||
SampleService().add_or_update_records(samples)
|
||||
db.session.commit()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user