schema update

This commit is contained in:
Untone 2021-07-29 20:26:15 +03:00
parent 437be2229b
commit fb779217bc
3 changed files with 13 additions and 10 deletions

View File

@ -21,7 +21,7 @@ class PayLoad(BaseModel):
class CreateUser(BaseModel): class CreateUser(BaseModel):
email: Text email: Text
username: Text username: Optional[Text]
# age: Optional[int] # age: Optional[int]
# phone: Optional[Text] # phone: Optional[Text]
password: Optional[Text] password: Optional[Text]

View File

@ -1,6 +1,6 @@
from typing import List from typing import List
from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy import Column, Integer, String, relationship
from orm import Permission from orm import Permission
from orm.base import Base from orm.base import Base
@ -13,8 +13,8 @@ class User(Base):
username: str = Column(String, nullable=False, comment="Name") username: str = Column(String, nullable=False, comment="Name")
password: str = Column(String, nullable=True, comment="Password") password: str = Column(String, nullable=True, comment="Password")
role_id: int = Column(ForeignKey("role.id"), nullable=True, comment="Role") # role_id: list = Column(ForeignKey("role.id"), nullable=True, comment="Roles")
# roles = relationship("Role") TODO: one to many, see schema.graphql
oauth_id: str = Column(String, nullable=True) oauth_id: str = Column(String, nullable=True)
@classmethod @classmethod

View File

@ -4,7 +4,7 @@ scalar DateTime
input registerUserInput { input registerUserInput {
email: String! email: String!
username: String! username: String
password: String! password: String!
} }
@ -113,7 +113,10 @@ type Subscription {
############################################ Entities ############################################ Entities
type Role { type Role {
id: Int!
name: String! name: String!
org: String!
level: Int! # 1-8
desc: String desc: String
} }
@ -139,7 +142,7 @@ type Message {
id: Int! id: Int!
replyTo: Int replyTo: Int
updatedAt: DateTime! updatedAt: DateTime!
visibleForUsers: [Int] visibleForUsers: [Int]!
} }
# is publication # is publication
@ -160,17 +163,17 @@ type Shout {
topics: [String] # topic-slugs topics: [String] # topic-slugs
title: String title: String
versionOf: Int versionOf: Int
visibleForRoles: [String]! # role ids are strings visibleForRoles: [String] # role ids are strings
visibleForUsers: [Int] visibleForUsers: [Int]
} }
type Topic { type Topic {
slug: String! # ID slug: String! # ID
createdBy: Int! # User createdBy: Int! # User
original: String createdAt: DateTime!
value: String
parents: [String] # NOTE: topic can have parent topics parents: [String] # NOTE: topic can have parent topics
children: [String] # and children children: [String] # and children
createdAt: DateTime!
} }
# TODO: resolvers to add/remove topics from publication # TODO: resolvers to add/remove topics from publication
@ -196,7 +199,7 @@ type Token {
type Like { type Like {
author: Int! author: Int!
id: Int! id: Int!
value: Int!
shout: Int shout: Int
user: Int user: Int
value: Int!
} }