Started implementing auth

This commit is contained in:
Marta Borgia Leiva 2026-02-02 11:09:27 +01:00
parent e557c25789
commit b909a23fa3
7 changed files with 279 additions and 19 deletions

View file

@ -1,6 +1,6 @@
from sqlalchemy import Column, ForeignKey, String, Integer, Table
from sqlalchemy.orm import relationship
from sqlalchemy.dialects.sqlite import BLOB
from sqlalchemy.orm import relationship
from database import Base
from typing import Optional, List
@ -14,16 +14,17 @@ project_user = Table(
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
name = Column(String, index=True)
email = Column(String, unique=True, index=True)
password_hash = Column(BLOB)
password_hash = Column(String)
password_salt = Column(String)
projects = relationship("Project", secondary=project_user, back_populates="users")
class Project(Base):
__tablename__ = "projects"
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
name = Column(String, index=True)
description = Column(String)
users = relationship("User", secondary=project_user, back_populates="projects")
@ -32,7 +33,7 @@ class Project(Base):
class Task(Base):
__tablename__ = "tasks"
id = Column(Integer, primary_key=True, index=True)
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
title = Column(String, index=True)
description = Column(String)
status = Column(String, default="pending")