Api v1.15.0 (#1610)
* refactor(chalice): refactored users code * fix(chalice): fixed path analysis empty exclude support * fix(chalice): fixed update notes
This commit is contained in:
parent
8aad437f53
commit
b4d8e45e5d
2 changed files with 7 additions and 11 deletions
|
|
@ -86,7 +86,8 @@ def create(tenant_id, user_id, project_id, session_id, data: schemas.SessionNote
|
|||
query = cur.mogrify(f"""INSERT INTO public.sessions_notes (message, user_id, tag, session_id, project_id, timestamp, is_public)
|
||||
VALUES (%(message)s, %(user_id)s, %(tag)s, %(session_id)s, %(project_id)s, %(timestamp)s, %(is_public)s)
|
||||
RETURNING *,(SELECT name FROM users WHERE users.user_id=%(user_id)s) AS user_name;""",
|
||||
{"user_id": user_id, "project_id": project_id, "session_id": session_id, **data.model_dump()})
|
||||
{"user_id": user_id, "project_id": project_id, "session_id": session_id,
|
||||
**data.model_dump()})
|
||||
cur.execute(query)
|
||||
result = helper.dict_to_camel_case(cur.fetchone())
|
||||
if result:
|
||||
|
|
@ -120,7 +121,8 @@ def edit(tenant_id, user_id, project_id, note_id, data: schemas.SessionUpdateNot
|
|||
row = helper.dict_to_camel_case(cur.fetchone())
|
||||
if row:
|
||||
row["createdAt"] = TimeUTC.datetime_to_timestamp(row["createdAt"])
|
||||
return row
|
||||
return row
|
||||
return {"errors": ["Note not found"]}
|
||||
|
||||
|
||||
def delete(tenant_id, user_id, project_id, note_id):
|
||||
|
|
|
|||
|
|
@ -1464,13 +1464,7 @@ class SessionUpdateNoteSchema(SessionNoteSchema):
|
|||
|
||||
@model_validator(mode='after')
|
||||
def __validator(cls, values):
|
||||
assert len(values.keys()) > 0, "at least 1 attribute should be provided for update"
|
||||
c = 0
|
||||
for v in values.values():
|
||||
if v is not None and (not isinstance(v, str) or len(v) > 0):
|
||||
c += 1
|
||||
break
|
||||
assert c > 0, "at least 1 value should be provided for update"
|
||||
assert values.message is not None or values.timestamp is not None or values.is_public is not None, "at least 1 attribute should be provided for update"
|
||||
return values
|
||||
|
||||
|
||||
|
|
@ -1578,6 +1572,6 @@ class FeatureFlagSchema(BaseModel):
|
|||
|
||||
class ModuleStatus(BaseModel):
|
||||
module: Literal["assist", "notes", "bug-reports",
|
||||
"offline-recordings", "alerts", "assist-statts", "recommendations", "feature-flags"] = Field(..., description="Possible values: assist, notes, bug-reports, offline-recordings, alerts, assist-statts, recommendations, feature-flags")
|
||||
"offline-recordings", "alerts", "assist-statts", "recommendations", "feature-flags"] = Field(...,
|
||||
description="Possible values: assist, notes, bug-reports, offline-recordings, alerts, assist-statts, recommendations, feature-flags")
|
||||
status: bool = Field(...)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue