Skip to content

Commit

Permalink
fix: correct subscription get endpoint (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
anbraten authored Feb 1, 2023
1 parent e295ae4 commit 9d857b0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/server/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apk --no-cache add ca-certificates

WORKDIR /app

CMD ["node", "index.js"]
CMD ["node", "--enable-source-maps", "index.js"]

COPY ./packages/server/dist/ .

Expand Down
9 changes: 8 additions & 1 deletion packages/server/src/api/endpoints/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,14 @@ export function subscriptionEndpoints(server: FastifyInstance): void {
? getActiveUntilDate(subscription.lastPayment, subscription.anchorDate)
: undefined;

await reply.send({ ...subscription, activeUntil });
const _subscription = {
...subscription,
activeUntil,
changes: subscription.changes.getItems().map((change) => ({ ...change, subscription: undefined })),
invoices: subscription.invoices.getItems().map((invoice) => ({ ...invoice, subscription: undefined })),
};

await reply.send(_subscription);
},
});
}
2 changes: 1 addition & 1 deletion packages/server/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export async function init(): Promise<FastifyInstance> {
description: 'Documentation for the Gringotts api',
version: '0.1.0',
},
host: 'localhost:3000',
host: `localhost:${config.port}`,
schemes: ['http', 'https'],
consumes: ['application/json'],
produces: ['application/json'],
Expand Down

0 comments on commit 9d857b0

Please sign in to comment.