Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ database.database
database.db
diagram.png
__pycache__/
migrations
Binary file added docs/assets/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 0 additions & 35 deletions migrations/versions/0763d677d453_.py

This file was deleted.

155 changes: 0 additions & 155 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 29 additions & 29 deletions src/api/commands.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@

import click
from api.models import db, User
# import click
# from api.models import db

"""
In this file, you can add as many commands as you want using the @app.cli.command decorator
Flask commands are usefull to run cronjobs or tasks outside of the API but sill in integration
with youy database, for example: Import the price of bitcoin every night as 12am
"""
def setup_commands(app):
# """
# In this file, you can add as many commands as you want using the @app.cli.command decorator
# Flask commands are usefull to run cronjobs or tasks outside of the API but sill in integration
# with youy database, for example: Import the price of bitcoin every night as 12am
# """
# def setup_commands(app):

"""
This is an example command "insert-test-users" that you can run from the command line
by typing: $ flask insert-test-users 5
Note: 5 is the number of users to add
"""
@app.cli.command("insert-test-users") # name of our command
@click.argument("count") # argument of out command
def insert_test_users(count):
print("Creating test users")
for x in range(1, int(count) + 1):
user = User()
user.email = "test_user" + str(x) + "@test.com"
user.password = "123456"
user.is_active = True
db.session.add(user)
db.session.commit()
print("User: ", user.email, " created.")
# """
# This is an example command "insert-test-users" that you can run from the command line
# by typing: $ flask insert-test-users 5
# Note: 5 is the number of users to add
# """
# @app.cli.command("insert-test-users") # name of our command
# @click.argument("count") # argument of out command
# def insert_test_users(count):
# print("Creating test users")
# for x in range(1, int(count) + 1):
# user = User()
# user.email = "test_user" + str(x) + "@test.com"
# user.password = "123456"
# user.is_active = True
# db.session.add(user)
# db.session.commit()
# print("User: ", user.email, " created.")

print("All test users created")
# print("All test users created")

@app.cli.command("insert-test-data")
def insert_test_data():
pass
# @app.cli.command("insert-test-data")
# def insert_test_data():
# pass
Loading