sqlite-support
Some checks failed
Deploy on push / deploy (push) Failing after 9s

This commit is contained in:
2024-10-14 02:05:20 +03:00
parent 5c40ab3d00
commit 7c86d95f5e
6 changed files with 74 additions and 53 deletions

16
main.py
View File

@@ -16,6 +16,8 @@ from services.search import search_service
from services.viewed import ViewedStorage
from services.webhook import WebhookEndpoint
from settings import DEV_SERVER_PID_FILE_NAME, MODE
from services.db import engine, create_table_if_not_exists
from orm import author, notification, shout, topic, reaction, community #, collection, invite
import_module("resolvers")
schema = make_executable_schema(load_schema_from_path("schema/"), resolvers)
@@ -30,6 +32,19 @@ async def start():
print(f"[main] process started in {MODE} mode")
def create_all_tables():
for model in [author.Author, author.AuthorRating, author.AuthorFollower,
notification.Notification, notification.NotificationSeen,
shout.Shout, shout.ShoutAuthor, shout.ShoutTopic, shout.ShoutCommunity,
topic.Topic, topic.TopicFollower,
reaction.Reaction,
community.Community, community.CommunityFollower,
# collection.Collection, collection.ShoutCollection,
# invite.Invite
]:
create_table_if_not_exists(engine, model)
# main starlette app object with ariadne mounted in root
app = Starlette(
routes=[
@@ -37,6 +52,7 @@ app = Starlette(
Route("/new-author", WebhookEndpoint),
],
on_startup=[
create_all_tables,
redis.connect,
precache_data,
ViewedStorage.init,