st-ten-1/src/lib/db/models/steps.py
matteo porta 47eb358a9b wip
2022-10-25 15:38:18 +02:00

24 lines
718 B
Python

from uuid import uuid4 as uuid
from peewee import BooleanField, TextField
from playhouse.sqlite_ext import JSONField
from .base_model import BaseModel
class Steps(BaseModel):
name = TextField(primary_key=True, unique=True, null=False, default=lambda: uuid().hex)
type = TextField(null=False)
spec = JSONField(null=False) # keys inside spec must not overlap withthe model
description = TextField(null=True)
archived = BooleanField(null=False, default=False)
# @classmethod
# def delete(cls, *args, **kwargs):
# # OVERRIDE DELETION
# # so that deleting a user will only archive it
# return cls.update(archived=True)
class Meta:
table_name = "steps"