feat(life): add Life Post detail page and endpoint
Implement GET /api/life-posts/:id with moderation and visibility rules Add /life/:id route and LifePostDetail view Update feeds and user profiles to link to the new detail page
This commit is contained in:
@@ -68,6 +68,7 @@ import {
|
||||
getAncientArtifact,
|
||||
getHabitat,
|
||||
getItem,
|
||||
getLifePost,
|
||||
getOptions,
|
||||
getPokemon,
|
||||
getPublicUserProfile,
|
||||
@@ -1198,6 +1199,16 @@ app.get('/api/life-posts', async (request) => {
|
||||
);
|
||||
});
|
||||
|
||||
app.get('/api/life-posts/:id', async (request, reply) => {
|
||||
const { id } = request.params as { id: string };
|
||||
const user = await optionalUser(request);
|
||||
const canViewAll = user
|
||||
? userHasPermission(user, 'life.posts.update-any') || userHasPermission(user, 'life.posts.delete-any')
|
||||
: false;
|
||||
const post = await getLifePost(Number(id), user?.id ?? null, requestLocale(request), canViewAll);
|
||||
return post ? post : notFound(reply, request);
|
||||
});
|
||||
|
||||
app.get('/api/life-posts/:postId/comments', async (request, reply) => {
|
||||
const { postId } = request.params as { postId: string };
|
||||
const user = await optionalUser(request);
|
||||
|
||||
Reference in New Issue
Block a user