From 80af79779d01fe949af84fdb43f6b82085cd4a9c Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 14 Aug 2016 20:06:49 +0200 Subject: [PATCH] server/snapshots: rewrite --- API.md | 249 ++++++++----- server/migrate-v1 | 45 --- server/szurubooru/api/post_api.py | 18 +- server/szurubooru/api/snapshot_api.py | 2 +- server/szurubooru/api/tag_api.py | 10 +- server/szurubooru/api/tag_category_api.py | 8 +- server/szurubooru/db/__init__.py | 14 +- server/szurubooru/db/session.py | 15 +- server/szurubooru/db/snapshot.py | 9 +- server/szurubooru/db/util.py | 10 +- server/szurubooru/func/diff.py | 57 +++ server/szurubooru/func/posts.py | 3 +- server/szurubooru/func/snapshots.py | 175 ++++----- server/szurubooru/func/tag_categories.py | 3 +- server/szurubooru/func/tags.py | 3 +- .../4a020f1d271a_rename_snapshot_columns.py | 54 +++ .../search/configs/snapshot_search_config.py | 2 +- .../tests/api/test_post_creating.py | 11 +- .../tests/api/test_post_deleting.py | 15 +- .../tests/api/test_post_featuring.py | 15 +- .../tests/api/test_post_updating.py | 13 +- .../tests/api/test_snapshot_retrieving.py | 4 +- .../tests/api/test_tag_category_creating.py | 23 +- .../tests/api/test_tag_category_deleting.py | 15 +- .../tests/api/test_tag_category_retrieving.py | 1 - .../tests/api/test_tag_category_updating.py | 14 +- .../szurubooru/tests/api/test_tag_creating.py | 10 +- .../szurubooru/tests/api/test_tag_deleting.py | 14 +- .../szurubooru/tests/api/test_tag_merging.py | 8 +- .../szurubooru/tests/api/test_tag_updating.py | 5 +- server/szurubooru/tests/db/test_user.py | 4 +- server/szurubooru/tests/func/test_diff.py | 275 ++++++++++++++ server/szurubooru/tests/func/test_posts.py | 8 +- .../szurubooru/tests/func/test_snapshots.py | 348 +++++++----------- .../tests/func/test_tag_categories.py | 35 +- server/szurubooru/tests/func/test_tags.py | 65 ++-- 36 files changed, 931 insertions(+), 629 deletions(-) create mode 100644 server/szurubooru/func/diff.py create mode 100644 server/szurubooru/migrations/versions/4a020f1d271a_rename_snapshot_columns.py create mode 100644 server/szurubooru/tests/func/test_diff.py diff --git a/API.md b/API.md index 44654be8..3c6bb2f5 100644 --- a/API.md +++ b/API.md @@ -943,10 +943,9 @@ data. - **Description** Retrieves the post that is currently featured on the main page in web - client. If no post is featured, `` is null and `snapshots` array is - empty. Note that this method exists mostly for compatibility with setting - featured post - most of times, you'd want to use query global info which - contains more information. + client. If no post is featured, `` is null. Note that this method + exists mostly for compatibility with setting featured post - most of times, + you'd want to use query global info which contains more information. ## Featuring post - **Request** @@ -1441,7 +1440,7 @@ data. | `id` | involving given resource id | | `date` | created at given date | | `time` | alias of `date` | - | `operation` | `changed`, `created` or `deleted` | + | `operation` | `modified`, `created`, `deleted` or `merged` | | `user` | name of the user that created given snapshot | **Sort style tokens** @@ -1573,12 +1572,7 @@ experience. "name": , "color": , "usages": - "default": , - "snapshots": [ - , - , - - ] + "default": } ``` @@ -1589,8 +1583,6 @@ experience. - ``: the category color. - ``: how many tags is the given category used with. - ``: whether the tag category is the default one. -- ``: a [snapshot resource](#snapshot) that contains the tag - category's earlier versions. ## Tag **Description** @@ -1609,12 +1601,7 @@ A single tag. Tags are used to let users search for posts. "creationTime": , "lastEditTime": , "usages": , - "description": , - "snapshots": [ - , - , - - ] + "description": } ``` @@ -1633,8 +1620,6 @@ A single tag. Tags are used to let users search for posts. - ``: the number of posts the tag was used in. - ``: the tag description (instructions how to use, history etc.) The client should render is as Markdown. -- ``: a [snapshot resource](#snapshot) that contains the tag's - earlier versions. ## Post **Description** @@ -1675,11 +1660,6 @@ One file together with its metadata posted to the site. "favoritedBy": , "hasCustomThumbnail": , "mimeType": - "snapshots": [ - , - , - - ], "comments": { , , @@ -1745,8 +1725,6 @@ One file together with its metadata posted to the site. - ``: whether the post uses custom thumbnail. - ``: subsidiary to ``, used to tell exact content format; useful for `