From 3c538d37242d66af39c69d9e9aea07bb0b963aaa Mon Sep 17 00:00:00 2001 From: knst-kotov Date: Tue, 24 Aug 2021 12:32:20 +0300 Subject: [PATCH] minor fix --- orm/rbac.py | 2 +- orm/user.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/orm/rbac.py b/orm/rbac.py index 55cdaebf..d785d39a 100644 --- a/orm/rbac.py +++ b/orm/rbac.py @@ -56,7 +56,7 @@ class Operation(Base): class Resource(Base): __tablename__ = "resource" - resource_class: Type[Base] = Column(ClassType, nullable=False, unique=True, comment="Resource class") + resource_class: str = Column(String, nullable=False, unique=True, comment="Resource class") name: str = Column(String, nullable=False, unique=True, comment="Resource name") @staticmethod diff --git a/orm/user.py b/orm/user.py index 1cbdd42e..f55fde40 100644 --- a/orm/user.py +++ b/orm/user.py @@ -1,4 +1,5 @@ from typing import List +from datetime import datetime from sqlalchemy import Table, Column, Integer, String, ForeignKey, Boolean, DateTime, JSON as JSONType from sqlalchemy.orm import relationship @@ -42,8 +43,8 @@ class User(Base): slug: str = Column(String, unique=True, comment="User's slug") muted: bool = Column(Boolean, default=False) emailConfirmed: bool = Column(Boolean, default=False) - createdAt: DateTime = Column(DateTime, nullable=False, comment="Created at") - wasOnlineAt: DateTime = Column(DateTime, nullable=False, comment="Was online at") + createdAt: DateTime = Column(DateTime, nullable=False, default = datetime.now, comment="Created at") + wasOnlineAt: DateTime = Column(DateTime, nullable=False, default = datetime.now, comment="Was online at") links: JSONType = Column(JSONType, nullable=True, comment="Links") oauth: str = Column(String, nullable=True) notifications = relationship(lambda: UserNotifications)