Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions base_operations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,7 @@ paths:
name: Jasmin Tee
contact_email: jasmintee@example.com
avatar_url: https://cloud.seatable.io/media/avatars/default.png
app_user_list: []

# Rows
/api-gateway/api/v2/dtables/{base_uuid}/sql/:
Expand Down Expand Up @@ -4531,6 +4532,7 @@ paths:
example:
notification_list:
- id: 200
dtable_uuid: 12345678-7e27-46a8-8b18-6cc6f3db2057
username: 123456786569491ba42905bf1647fd3f@auth.local
msg_type: row_comment
created_at: "2021-02-25T10:38:14.000Z"
Expand Down Expand Up @@ -4686,19 +4688,25 @@ paths:
type: object
example:
operations:
- author: 12345678d1754bb4afa2c2cb7369d244@auth.local
- id: 245
dtable_uuid: 12345678-7e27-46a8-8b18-6cc6f3db2057
author: 12345678d1754bb4afa2c2cb7369d244@auth.local
app: null
op_time: 1610981745927
operation: >-
{"op_type":"delete_column","table_id":"0000","column_key":"iJB4","old_column":{"rowType":"header","key":"iJB4","type":null,"name":null,"editable":true,"width":200,"resizable":true,"draggable":true,"data":null,"permission_type":"","permitted_users":[],"editor":{"key":null,"ref":null,"props":{},"_owner":null},"formatter":null,"left":1058,"idx":5},"upper_column_key":"LfGJ"}
op_id: 118
- author: 12345678d1754bb4afa2c2cb7369d244@auth.local
- id: 244
dtable_uuid: 12345678-7e27-46a8-8b18-6cc6f3db2057
author: 12345678d1754bb4afa2c2cb7369d244@auth.local
app: null
op_time: 1610981742518
operation: >-
{"op_type":"delete_column","table_id":"0000","column_key":"J2mq","old_column":{"rowType":"header","key":"J2mq","type":null,"name":null,"editable":true,"width":200,"resizable":true,"draggable":true,"data":null,"permission_type":"","permitted_users":[],"editor":{"key":null,"ref":null,"props":{},"_owner":null},"formatter":null,"left":280,"idx":2},"upper_column_key":"0000"}
op_id: 117
- author: 12345678d1754bb4afa2c2cb7369d244@auth.local
- id: 243
dtable_uuid: 12345678-7e27-46a8-8b18-6cc6f3db2057
author: 12345678d1754bb4afa2c2cb7369d244@auth.local
app: null
op_time: 1610981739830
operation: >-
Expand Down Expand Up @@ -4729,8 +4737,10 @@ paths:
activities:
- id: 6782
dtable_uuid: a57b56d3-1cc5-4ebd-8a6c-a1b28ac3dbdf
row_count: 1
row_id: YMIviMeERQCUiQhPPqo6Gw
op_user: 0ef256cb715841dd81b147b2530c2904@auth.local
op_app: ""
op_type: modify_row
op_time: "2021-01-14T09:01:57.000Z"
detail:
Expand All @@ -4747,8 +4757,10 @@ paths:
old_value: "2020-08-16"
- id: 6778
dtable_uuid: a57b56d3-1cc5-4ebd-8a6c-a1b28ac3dbdf
row_count: 1
row_id: YMIviMeERQCUiQhPPqo6Gw
op_user: 0ef256cb715841dd81b147b2530c2904@auth.local
op_app: ""
op_type: modify_row
op_time: "2021-01-14T08:56:53.000Z"
detail:
Expand All @@ -4771,8 +4783,10 @@ paths:
old_value: ""
- id: 5960
dtable_uuid: a57b56d3-1cc5-4ebd-8a6c-a1b28ac3dbdf
row_count: 1
row_id: YMIviMeERQCUiQhPPqo6Gw
op_user: 0ef256cb715841dd81b147b2530c2904@auth.local
op_app: ""
op_type: insert_row
op_time: "2020-11-18T12:42:14.000Z"
detail:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
{
"app": "",
"author": "str",
"dtable_uuid": "str",
"id": "int",
"op_id": "int",
"op_time": "int",
"operation": "str"
},
{
"app": null,
"author": "str",
"dtable_uuid": "str",
"id": "int",
"op_id": "int",
"op_time": "int",
"operation": "str"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
},
"dtable_uuid": "str",
"id": "int",
"op_app": "",
"op_time": "str",
"op_type": "insert_row",
"op_user": "str",
"row_count": 1,
"row_id": "str"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"app_user_list": [],
"user_list": [
{
"avatar_url": "str",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"row_id": "str",
"table_id": "str"
},
"dtable_uuid": "str",
"id": "int",
"msg_type": "selected_collaborator",
"seen": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"row_id": "str",
"table_id": "str"
},
"dtable_uuid": "str",
"id": "int",
"msg_type": "selected_collaborator",
"seen": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"row_id": "str",
"table_id": "str"
},
"dtable_uuid": "str",
"id": "int",
"msg_type": "selected_collaborator",
"seen": 1,
Expand Down
5 changes: 4 additions & 1 deletion tests/test_activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ def test_getBaseActivityLog(base: Base, snapshot_json: SnapshotAssertion):
if table_id in (operation.get('table_id'), operation.get('table_data', {}).get('_id'))
]

# dtable_uuid is masked in the snapshot, so check its format (with dashes) here
assert all(op['dtable_uuid'] == base.uuid for op in data['operations'])

matcher = path_type({
r'operations\.\d+\.(author|op_id|op_time|operation)': (str, int),
r'operations\.\d+\.(author|dtable_uuid|id|op_id|op_time|operation)': (str, int),
}, regex=True)

assert snapshot_json(matcher=matcher) == data
Expand Down
3 changes: 3 additions & 0 deletions tests/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def _create_selected_collaborator_notification(base: Base, admin_base: Base, adm
assert response.status_code == 200
data = response.json()
if data['notification_list'] or time.monotonic() > deadline:
# dtable_uuid is masked in the snapshot, so check its format (with dashes) here
assert all(n['dtable_uuid'] == base.uuid for n in data['notification_list'])
return data
time.sleep(0.5)

Expand All @@ -130,6 +132,7 @@ def _list_notifications(base: Base) -> dict:

NOTIFICATION_MATCHER = path_type({
r'notification_list\..*\.id': (int,),
r'notification_list\..*\.dtable_uuid': (str,),
r'notification_list\..*\.username': (str,),
r'notification_list\..*\.created_at': (str,),
r'notification_list\..*\.detail\.author': (str,),
Expand Down
Loading