mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
92e5a13ae6
Signed-off-by: Charles Le Maux <charles.le-maux@epitech.eu>
43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
import file_manager
|
|
import firebase_manager
|
|
|
|
db = firebase_manager.firestore_database
|
|
users = firebase_manager.auth.list_users().users
|
|
|
|
|
|
def create_properties_collection(uid, name):
|
|
"""Create properties collection for a specific server of a user."""
|
|
properties = {
|
|
"difficulty": "easy",
|
|
"gamemode": "survival",
|
|
"force-gamemode": False,
|
|
"hardcore": False,
|
|
"generate-structures": True,
|
|
"motd": "A Minecraft Server",
|
|
"pvp": True,
|
|
"online-mode": True,
|
|
"max-players": 20,
|
|
"enable-command-block": False
|
|
}
|
|
|
|
doc_ref = db.document(f'users/{uid}/servers/{name}')
|
|
#doc_ref.set(properties)
|
|
doc_ref.delete()
|
|
|
|
|
|
def get_servers(uid):
|
|
servers_ref = db.collection(f'users/{uid}/servers').stream()
|
|
servers_names = [doc.id for doc in servers_ref]
|
|
return servers_names
|
|
|
|
|
|
if __name__ == 'voituredecourse':
|
|
for user in users:
|
|
user_id = user.uid
|
|
servers = get_servers(user_id)
|
|
for server_id in servers:
|
|
create_properties_collection(user_id, server_id)
|
|
|
|
if __name__ == '__main__':
|
|
print(file_manager.kebab_to_camel_case("enable-command-block"))
|