Compare commits
2 Commits
4a4813ae17
...
7312ab632c
| Author | SHA1 | Date | |
|---|---|---|---|
| 7312ab632c | |||
| e0377aeb00 |
@ -141,19 +141,9 @@ export async function tryCreateAttachment(request: Request) {
|
|||||||
export async function tryFetchAttachments(request: Request) {
|
export async function tryFetchAttachments(request: Request) {
|
||||||
await Post.sync();
|
await Post.sync();
|
||||||
|
|
||||||
const foundPosts = await Post.findAll({
|
const foundAttachments = await Attachment.findAll();
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: Post.associations.user,
|
|
||||||
attributes: { exclude: ["password", "createdAt", "updatedAt"] },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: Post.associations.postTags,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Response(JSON.stringify(foundPosts), { status: 200 });
|
return new Response(JSON.stringify(foundAttachments), { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
|
|||||||
@ -111,10 +111,10 @@ async function seedPosts(qif: SqliteQueryInterface<SqliteDialect>) {
|
|||||||
where: {
|
where: {
|
||||||
readableIdentifier: "blog",
|
readableIdentifier: "blog",
|
||||||
},
|
},
|
||||||
}).then((e) =>
|
}).then(
|
||||||
e
|
(project) =>
|
||||||
? e
|
project ||
|
||||||
: Project.create({
|
Project.create({
|
||||||
name: "General Blog",
|
name: "General Blog",
|
||||||
readableIdentifier: "blog",
|
readableIdentifier: "blog",
|
||||||
})
|
})
|
||||||
@ -174,9 +174,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
test: await queryInterface
|
test: await queryInterface.describeTable("Posts").then((t) => t),
|
||||||
.describeTable("Posts")
|
|
||||||
.then((t) => t),
|
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|||||||
@ -38,9 +38,9 @@ export async function getPostsWithBucketsAndProject(): Promise<ActionResult<GetP
|
|||||||
{association: Post.associations.project}],
|
{association: Post.associations.project}],
|
||||||
nest: false
|
nest: false
|
||||||
});
|
});
|
||||||
return {result:JSON.parse(JSON.stringify(posts.map((e:Post)=>{
|
return {result:posts.map((post:Post)=>{
|
||||||
return inspect(e)
|
return JSON.parse(JSON.stringify(post))
|
||||||
})))};
|
})};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPosts(): Promise<ActionResult<Attributes<Post>[]>> {
|
export async function getPosts(): Promise<ActionResult<Attributes<Post>[]>> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user