Skip to content
Snippets Groups Projects
Commit a3705800 authored by fibasile's avatar fibasile
Browse files

update requirements, upload categories

parent 3158e318
No related merge requests found
firebase_admin
python-dateutil
......@@ -14,8 +14,7 @@ firebase_admin.initialize_app(cred)
db = firestore.client()
projects = json.load(open('./out_projects.json','r'))
categories = json.load(open('./out_categories.json','r'))
def delete_collection(coll_ref, batch_size):
docs = coll_ref.limit(batch_size).get()
deleted = 0
......@@ -32,7 +31,7 @@ def import_projects():
for p in projects:
print p['id']
print(p['id'])
project = {
"id": p['id'],
......@@ -55,6 +54,13 @@ def import_projects():
ref.set(project,True)
def import_categories():
for c in categories:
print(c)
ref = db.collection(u'categories').document(c['id'])
ref.set({"label": c['label'], "id": c['id']})
def import_files():
......@@ -64,7 +70,7 @@ def import_files():
for f in files:
file_ref = ref.collection(u'files').document()
file_ref.set(f)
print f
print(f)
def import_photos():
......@@ -74,7 +80,7 @@ def import_photos():
for f in files:
file_ref = ref.collection(u'photos').document()
file_ref.set(f)
print f
print(f)
def import_comments():
......@@ -84,7 +90,7 @@ def import_comments():
for f in files:
file_ref = ref.collection(u'comments').document()
file_ref.set(f)
print f
print(f)
......@@ -92,4 +98,5 @@ if __name__=='__main__':
#import_projects()
#import_files()
# import_comments()
import_photos()
\ No newline at end of file
# import_photos()
import_categories()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment