diff options
| author | Ruin0x11 <ipickering2@gmail.com> | 2020-05-04 19:45:09 -0700 |
|---|---|---|
| committer | Ruin0x11 <ipickering2@gmail.com> | 2020-05-04 19:45:09 -0700 |
| commit | 7bcefeb347cb2969142fbab49a06ac2055be5c02 (patch) | |
| tree | b067325dd2655c948317b8713dc3b06a2f5d359f /server | |
| parent | 5ca21f9e7f5447a2c7841c1317dbe8df01b04e97 (diff) | |
Add pool information to API.md
Diffstat (limited to 'server')
| -rw-r--r-- | server/szurubooru/func/pools.py | 10 | ||||
| -rw-r--r-- | server/szurubooru/tests/func/test_posts.py | 14 |
2 files changed, 16 insertions, 8 deletions
diff --git a/server/szurubooru/func/pools.py b/server/szurubooru/func/pools.py index 27574ee..1d27929 100644 --- a/server/szurubooru/func/pools.py +++ b/server/szurubooru/func/pools.py @@ -3,7 +3,7 @@ from typing import Any, Optional, Tuple, List, Dict, Callable from datetime import datetime import sqlalchemy as sa from szurubooru import config, db, model, errors, rest -from szurubooru.func import util, pool_categories, serialization, posts +from szurubooru.func import util, pool_categories, posts, serialization class PoolNotFoundError(errors.NotFoundError): @@ -130,11 +130,9 @@ class PoolSerializer(serialization.BaseSerializer): return self.pool.post_count def serialize_posts(self) -> Any: - return [ - { - 'id': post.post_id - } - for post in self.pool.posts] + return [post for post in + [posts.serialize_micro_post(rel, None) + for rel in self.pool.posts]] def serialize_pool( diff --git a/server/szurubooru/tests/func/test_posts.py b/server/szurubooru/tests/func/test_posts.py index e785ea5..b429491 100644 --- a/server/szurubooru/tests/func/test_posts.py +++ b/server/szurubooru/tests/func/test_posts.py @@ -209,7 +209,12 @@ def test_serialize_post( 'description': 'desc', 'category': 'test-cat1', 'postCount': 1, - 'posts': [{'id': 1}], + 'posts': [ + { + 'id': 1, + 'thumbnailUrl': 'http://example.com/generated-thumbnails/1_244c8840887984c4.jpg', + } + ], 'version': 1, 'creationTime': datetime(1996, 1, 1), 'lastEditTime': datetime(1998, 1, 1), @@ -220,7 +225,12 @@ def test_serialize_post( 'description': 'desc2', 'category': 'test-cat2', 'postCount': 1, - 'posts': [{'id': 1}], + 'posts': [ + { + 'id': 1, + 'thumbnailUrl': 'http://example.com/generated-thumbnails/1_244c8840887984c4.jpg', + } + ], 'version': 1, 'creationTime': datetime(1996, 1, 1), 'lastEditTime': datetime(1998, 1, 1), |