refactoring
This commit is contained in:
@@ -141,19 +141,9 @@ export async function tryCreateAttachment(request: Request) {
|
||||
export async function tryFetchAttachments(request: Request) {
|
||||
await Post.sync();
|
||||
|
||||
const foundPosts = await Post.findAll({
|
||||
include: [
|
||||
{
|
||||
association: Post.associations.user,
|
||||
attributes: { exclude: ["password", "createdAt", "updatedAt"] },
|
||||
},
|
||||
{
|
||||
association: Post.associations.postTags,
|
||||
},
|
||||
],
|
||||
});
|
||||
const foundAttachments = await Attachment.findAll();
|
||||
|
||||
return new Response(JSON.stringify(foundPosts), { status: 200 });
|
||||
return new Response(JSON.stringify(foundAttachments), { status: 200 });
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
|
||||
Reference in New Issue
Block a user