st-ten-1/src/lib/db/models/steps.py

23 lines
689 B
Python
Raw Normal View History

2022-07-19 09:59:00 +00:00
from peewee import AutoField, BooleanField, TextField
from playhouse.sqlite_ext import JSONField
from .base_model import BaseModel
class Steps(BaseModel):
id = AutoField(primary_key=True, unique=True, null=False)
2022-07-26 10:24:53 +00:00
name = TextField(null=True)
2022-07-19 09:59:00 +00:00
type = TextField(null=False)
spec = JSONField(null=False) # keys inside spec must not overlap withthe model
2022-07-26 10:24:53 +00:00
description = TextField(null=True)
2022-07-19 09:59:00 +00:00
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"