framework of google login
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from sqlalchemy import Column, String, DateTime
|
||||
from sqlalchemy.orm import declarative_base
|
||||
from sqlalchemy.sql import func
|
||||
import uuid
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
def gen_uuid():
|
||||
return str(uuid.uuid4())
|
||||
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
id = Column(String, primary_key=True, default=gen_uuid)
|
||||
|
||||
# Google 信息
|
||||
google_id = Column(String, unique=True, index=True)
|
||||
email = Column(String, unique=True, index=True)
|
||||
name = Column(String)
|
||||
avatar = Column(String)
|
||||
|
||||
# 元信息
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
Reference in New Issue
Block a user