This commit is contained in:
syuilo
2021-12-09 23:58:30 +09:00
parent 0abe2dfee0
commit c69b72e199
573 changed files with 3318 additions and 3318 deletions

View File

@ -15,28 +15,28 @@ export const meta = {
params: {
postId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchPost: {
message: 'No such post.',
code: 'NO_SUCH_POST',
id: '56c06af3-1287-442f-9701-c93f7c4a62ff'
id: '56c06af3-1287-442f-9701-c93f7c4a62ff',
},
yourPost: {
message: 'You cannot like your post.',
code: 'YOUR_POST',
id: 'f78f1511-5ebc-4478-a888-1198d752da68'
id: 'f78f1511-5ebc-4478-a888-1198d752da68',
},
alreadyLiked: {
message: 'The post has already been liked.',
code: 'ALREADY_LIKED',
id: '40e9ed56-a59c-473a-bf3f-f289c54fb5a7'
id: '40e9ed56-a59c-473a-bf3f-f289c54fb5a7',
},
}
},
};
export default define(meta, async (ps, user) => {
@ -52,7 +52,7 @@ export default define(meta, async (ps, user) => {
// if already liked
const exist = await GalleryLikes.findOne({
postId: post.id,
userId: user.id
userId: user.id,
});
if (exist != null) {
@ -64,7 +64,7 @@ export default define(meta, async (ps, user) => {
id: genId(),
createdAt: new Date(),
postId: post.id,
userId: user.id
userId: user.id,
});
GalleryPosts.increment({ id: post.id }, 'likedCount', 1);