feat: add private journals and centralized Baidu media storage for v0.1.28
This commit is contained in:
@@ -157,6 +157,8 @@ class Households:
|
||||
raise a.Problem('家庭不存在', 404)
|
||||
if user['role'] != 'admin' and (not old or old['id'] != self.scope(user)):
|
||||
raise a.Problem('只能管理自己所属的家庭', 403)
|
||||
if type(data.get('profileRevision', 0)) is not int or data.get('profileRevision', 0) != (old or {}).get('profileRevision', 0):
|
||||
raise a.Problem('家庭档案已被更新,请重新打开后保存,避免覆盖他人的修改', 409)
|
||||
kind = data.get('kind', old.get('kind', 'home') if old else 'home')
|
||||
if kind not in ('home', 'office', 'factory'):
|
||||
raise a.Problem('请选择家庭、办公场所或工厂')
|
||||
@@ -164,6 +166,7 @@ class Households:
|
||||
name=a.clean_text(data.get('name', ''), 80, True),
|
||||
kind=kind,
|
||||
note=a.clean_text(data.get('note', ''), 300),
|
||||
profileRevision=(old or {}).get('profileRevision', 0)+1,
|
||||
createdAt=old['createdAt'] if old else dt.datetime.now(dt.timezone.utc).isoformat())
|
||||
for field in ('province','city','district'):
|
||||
item[field] = a.clean_text(data.get(field, (old or {}).get(field, '')), 60)
|
||||
|
||||
Reference in New Issue
Block a user