Add pool information to API.md

This commit is contained in:
Ruin0x11
2020-05-04 19:45:09 -07:00
parent 5ca21f9e7f
commit 7bcefeb347
4 changed files with 474 additions and 9 deletions

View File

@ -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(

View File

@ -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),