mirror of
https://github.com/flibusta-apps/services_manager_server.git
synced 2025-12-06 04:25:38 +01:00
Add username to service
This commit is contained in:
30
src/app/alembic/versions/738a796c3f0b_.py
Normal file
30
src/app/alembic/versions/738a796c3f0b_.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 738a796c3f0b
|
||||
Revises: 85ece6cfed22
|
||||
Create Date: 2021-12-13 01:34:21.957994
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "738a796c3f0b"
|
||||
down_revision = "85ece6cfed22"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column(
|
||||
"services", sa.Column("username", sa.String(length=64), nullable=True)
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column("services", "username")
|
||||
# ### end Alembic commands ###
|
||||
@@ -29,6 +29,7 @@ class Service(ormar.Model):
|
||||
|
||||
id: int = ormar.Integer(primary_key=True) # type: ignore
|
||||
token: str = ormar.String(max_length=128, unique=True) # type: ignore
|
||||
username: str = ormar.String(max_length=64, default="") # type: ignore
|
||||
user: int = ormar.BigInteger() # type: ignore
|
||||
status: str = ormar.String(
|
||||
max_length=12, choices=list(Statuses), default=Statuses.pending
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, constr
|
||||
|
||||
@@ -7,7 +8,8 @@ from app.models import Statuses, CachePrivileges
|
||||
|
||||
class ServiceCreate(BaseModel):
|
||||
token: constr(max_length=128) # type: ignore
|
||||
user: str
|
||||
user: Optional[str] = None
|
||||
username: constr(max_length=64) # type: ignore
|
||||
status: Statuses
|
||||
cache: CachePrivileges
|
||||
|
||||
@@ -15,6 +17,7 @@ class ServiceCreate(BaseModel):
|
||||
class ServiceDetail(BaseModel):
|
||||
id: int
|
||||
token: str
|
||||
username: Optional[str]
|
||||
user: str
|
||||
status: str
|
||||
cache: str
|
||||
|
||||
Reference in New Issue
Block a user