feat(api): add optimistic locking to LLM model config updates

- Include `version` field in all LLM model config response schemas
- Add `expected_version` parameter to update endpoints for optimistic locking
- Handle concurrent modification errors with HTTP 409 Conflict status
- Update both user and group config endpoints consistently
This commit is contained in:
YueGuobin committed 2026-03-03 16:59:12 +08:00
1 parent 9315f06e1f
commit 161b7feb01
5 files changed
+92 -8

No files matched your search

@@ -37,6 +37,7 @@ def upgrade() -> None:
sa.Column('user_id', postgresql.UUID(as_uuid=True), sa.ForeignKey('users.user_id', ondelete='CASCADE'), nullable=True),
sa.Column('group_id', postgresql.UUID(as_uuid=True), sa.ForeignKey('user_groups.user_group_id', ondelete='CASCADE'), nullable=True),
sa.Column('is_default', sa.Boolean(), default=False, nullable=False),
sa.Column('version', sa.Integer(), nullable=False, server_default='0'),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.CheckConstraint(