Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
LarmuseauNiels committed May 5, 2023
1 parent f2b58f4 commit 3172663
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions modules/ApiFunctions/MemberEndPoints.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { jsonify, authenticateToken } from "./Helpers";
import Rank from "../../islander/profile";
import { Reward } from ".prisma/client";

export function memberEndPoints(app) {
let apiPrefix = "/members/";
Expand Down Expand Up @@ -57,30 +58,32 @@ export function memberEndPoints(app) {
});
});

app.get(apiPrefix + "shopItems", authenticateToken, function (req, res) {
global.client.prisma.reward
.findMany({
app.get(
apiPrefix + "shopItems",
authenticateToken,
async function (req, res) {
const shopItems = await global.client.prisma.reward.findMany({
where: {
visible: true,
},
select: {
RewardID: true,
Title: true,
Description: true,
Price: true,
imageurl: true,
rewardId: true,
title: true,
description: true,
price: true,
imageUrl: true,
nonSalePrice: true,
_count: {
select: {
RewardItem: {},
} as any,
RewardItem: true,
},
},
},
})
.then((shopItems) => {
return res.send(jsonify(shopItems));
} as any,
});
});

return res.send(jsonify(shopItems));
}
);

app.get("/profileTester", async function (req, res) {
const rank = new Rank()
Expand Down

0 comments on commit 3172663

Please sign in to comment.