Fixed error when including buckets on post query
This commit is contained in:
parent
7fd4b8d3e2
commit
39f3c02e7c
@ -23,7 +23,7 @@ export async function deletePost(postID: number): Promise<ActionResult<boolean>>
|
||||
export async function getPosts(): Promise<ActionResult<Attributes<Post>[]>> {
|
||||
await dbSync;
|
||||
if(! await userIsAdmin()) return {error:"Unauthorized, not fetching Posts."}
|
||||
const posts = await Post.findAll({include: {association: Post.associations.postBuckets, include: Bucket.associations.attachments}},);
|
||||
const posts = await Post.findAll({include: {association: Post.associations.buckets, include: Bucket.associations.attachments}},);
|
||||
return {result:JSON.parse(JSON.stringify(posts))};
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ export class Post extends Model<InferAttributes<Post>, InferCreationAttributes<P
|
||||
declare static associations: {
|
||||
user: Association<User, Post>;
|
||||
project: Association<Project, Post>;
|
||||
postBuckets: Association<Bucket, Post>
|
||||
buckets: Association<Bucket, Post>
|
||||
postTags: Association<Tag, Post>;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user