This commit is contained in:
parent
cd0ba88462
commit
4697b44504
7
main.py
7
main.py
|
@ -1,22 +1,17 @@
|
|||
import os
|
||||
import re
|
||||
from importlib import import_module
|
||||
from os.path import exists
|
||||
from ariadne import load_schema_from_path, make_executable_schema
|
||||
from ariadne.asgi import GraphQL
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sentry_sdk.integrations.ariadne import AriadneIntegration
|
||||
from sentry_sdk.integrations.redis import RedisIntegration
|
||||
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
|
||||
from sentry_sdk.integrations.starlette import StarletteIntegration
|
||||
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
|
||||
from starlette.applications import Starlette
|
||||
from starlette.endpoints import HTTPEndpoint
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import JSONResponse
|
||||
from starlette.routing import Route
|
||||
|
||||
from resolvers.author import create_author
|
||||
from resolvers.webhook import WebhookEndpoint
|
||||
from services.rediscache import redis
|
||||
from services.schema import resolvers
|
||||
from settings import DEV_SERVER_PID_FILE_NAME, SENTRY_DSN, MODE
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import time
|
||||
from enum import Enum as Enumeration
|
||||
|
||||
from sqlalchemy import Column, Enum, ForeignKey, Integer, String
|
||||
from sqlalchemy import Column, ForeignKey, Integer, String
|
||||
|
||||
from services.db import Base
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import time
|
||||
from enum import Enum as Enumeration
|
||||
|
||||
from sqlalchemy import JSON, Boolean, Column, Enum, ForeignKey, Integer, String
|
||||
from sqlalchemy import JSON, Boolean, Column, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from orm.author import Author
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import time
|
||||
|
||||
from sqlalchemy import JSON, Boolean, Column, Integer, String
|
||||
from sqlalchemy import Boolean, Column, Integer, String
|
||||
|
||||
from services.db import Base
|
||||
|
||||
|
|
|
@ -145,9 +145,17 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False):
|
|||
# main topic
|
||||
# TODO: test main_topic update
|
||||
if "main_topic" in shout_input:
|
||||
old_main_topic = session.query(ShoutTopic).filter(and_(ShoutTopic.shout == shout.id, ShoutTopic.main == True)).first()
|
||||
old_main_topic = (
|
||||
session.query(ShoutTopic)
|
||||
.filter(and_(ShoutTopic.shout == shout.id, ShoutTopic.main == True))
|
||||
.first()
|
||||
)
|
||||
main_topic = session.query(Topic).filter(Topic.slug == shout_input["main_topic"]).first()
|
||||
new_main_topic = session.query(ShoutTopic).filter(and_(ShoutTopic.shout == shout.id, ShoutTopic.topic == main_topic.id)).first()
|
||||
new_main_topic = (
|
||||
session.query(ShoutTopic)
|
||||
.filter(and_(ShoutTopic.shout == shout.id, ShoutTopic.topic == main_topic.id))
|
||||
.first()
|
||||
)
|
||||
if old_main_topic is not new_main_topic:
|
||||
old_main_topic.main = False
|
||||
new_main_topic.main = True
|
||||
|
|
Loading…
Reference in New Issue
Block a user