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:
Dan Funk 2020-09-23 15:24:09 -04:00
parent 75ff45e9e4
commit 6ee2d4f019
2 changed files with 15 additions and 5 deletions

View File

@ -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:

View File

@ -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()