server+client: update tag category api + fix formatting
This commit is contained in:
parent
368372e36d
commit
d2b6ecef4d
4 changed files with 8 additions and 8 deletions
|
@ -37,7 +37,8 @@ def create_tag_category(
|
|||
auth.verify_privilege(ctx.user, "tag_categories:create")
|
||||
name = ctx.get_param_as_string("name")
|
||||
color = ctx.get_param_as_string("color")
|
||||
category = tag_categories.create_category(name, color)
|
||||
order = ctx.get_param_as_int("order")
|
||||
category = tag_categories.create_category(name, color, order)
|
||||
ctx.session.add(category)
|
||||
ctx.session.flush()
|
||||
snapshots.create(category, ctx.user)
|
||||
|
|
|
@ -78,10 +78,11 @@ def serialize_category(
|
|||
return TagCategorySerializer(category).serialize(options)
|
||||
|
||||
|
||||
def create_category(name: str, color: str) -> model.TagCategory:
|
||||
def create_category(name: str, color: str, order: int) -> model.TagCategory:
|
||||
category = model.TagCategory()
|
||||
update_category_name(category, name)
|
||||
update_category_color(category, color)
|
||||
update_category_order(category, order)
|
||||
if not get_all_categories():
|
||||
category.default = True
|
||||
return category
|
||||
|
|
|
@ -19,9 +19,7 @@ def upgrade():
|
|||
"tag_category", sa.Column("order", sa.Integer, nullable=True)
|
||||
)
|
||||
op.execute(
|
||||
sa.table("tag_category", sa.column("order"))
|
||||
.update()
|
||||
.values(order=1)
|
||||
sa.table("tag_category", sa.column("order")).update().values(order=1)
|
||||
)
|
||||
op.alter_column("tag_category", "order", nullable=False)
|
||||
|
||||
|
|
Loading…
Reference in a new issue