Skip to content

Commit

Permalink
fix(getSubscriptionByUserId): return slates.id instead of ownerId as id
Browse files Browse the repository at this point in the history
  • Loading branch information
Aminejvm committed Aug 4, 2021
1 parent 760653b commit 19b1c7c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions node_common/data/methods/get-subscriptions-by-user-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default async ({ ownerId }) => {
// const slateFiles = () =>
// DB.raw("json_agg(?? order by ?? asc) as ??", ["files", "slate_files.createdAt", "objects"]);

const ownerQueryFields = ["*", ...Constants.userPreviewProperties, "owner"];
const ownerQueryFields = [...Constants.userPreviewProperties, "owner"];
const ownerQuery = DB.raw(
`??, json_build_object('id', ??, 'data', ??, 'username', ??) as ??`,
`json_build_object('id', ??, 'data', ??, 'username', ??) as ??`,
ownerQueryFields
);

Expand All @@ -36,7 +36,7 @@ export default async ({ ownerId }) => {
// .orderBy("subscriptions.createdAt", "desc");
.groupBy("slates.id")
)
.select(ownerQuery)
.select(...Serializers.slateProperties, "objects", ownerQuery)
.from("slates")
.join("users", "slates.ownerId", "users.id");

Expand Down

0 comments on commit 19b1c7c

Please sign in to comment.