From 1f0b9600d6430eec26986a9d93fff2731a0cc246 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 24 Sep 2021 10:41:52 +0200 Subject: [PATCH 1/4] :sparkles: added User flags --- util/src/entities/User.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index f44b37b3..f6990240 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -255,7 +255,9 @@ export class UserFlags extends BitField { HOUSE_BALANCE: BigInt(1) << BigInt(8), EARLY_SUPPORTER: BigInt(1) << BigInt(9), TEAM_USER: BigInt(1) << BigInt(10), + TRUST_AND_SAFETY: BigInt(1) << BigInt(11), SYSTEM: BigInt(1) << BigInt(12), + LARGE_BOT: BigInt(1) << BigInt(13), BUGHUNTER_LEVEL_2: BigInt(1) << BigInt(14), VERIFIED_BOT: BigInt(1) << BigInt(16), EARLY_VERIFIED_BOT_DEVELOPER: BigInt(1) << BigInt(17), From 8024f2061d944df90ad412a8e1acc9cd690ad754 Mon Sep 17 00:00:00 2001 From: uurgothat Date: Wed, 29 Sep 2021 17:28:13 +0300 Subject: [PATCH 2/4] store improvements --- api/src/routes/store/applications.ts | 12 --- .../routes/store/applications/#id/index.ts | 78 +++++++++++++++++++ api/src/routes/store/skus.ts | 12 --- api/src/routes/store/skus/#id/index.ts | 78 +++++++++++++++++++ 4 files changed, 156 insertions(+), 24 deletions(-) delete mode 100644 api/src/routes/store/applications.ts create mode 100644 api/src/routes/store/applications/#id/index.ts delete mode 100644 api/src/routes/store/skus.ts create mode 100644 api/src/routes/store/skus/#id/index.ts diff --git a/api/src/routes/store/applications.ts b/api/src/routes/store/applications.ts deleted file mode 100644 index 352c1752..00000000 --- a/api/src/routes/store/applications.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Request, Response, Router } from "express"; -import { route } from "@fosscord/api"; - -const router: Router = Router(); - -router.get("/applications/:id", route({}), async (req: Request, res: Response) => { - //TODO - const { id } = req.params; - res.json([]).status(200); -}); - -export default router; diff --git a/api/src/routes/store/applications/#id/index.ts b/api/src/routes/store/applications/#id/index.ts new file mode 100644 index 00000000..53b61c29 --- /dev/null +++ b/api/src/routes/store/applications/#id/index.ts @@ -0,0 +1,78 @@ +import { Request, Response, Router } from "express"; +import { route } from "@fosscord/api"; + +const router: Router = Router(); + +router.get("/", route({}), async (req: Request, res: Response) => { + //TODO + res.json({ + id: "", + summary: "", + sku: { + id: "", + type: 1, + dependent_sku_id: null, + application_id: "", + manifets_labels: [], + access_type: 2, + name: "", + features: [], + relase_date: "", + premium: false, + slug: "", + flags: 4, + genres: [], + legal_notice: "", + application: { + id: "", + name: "", + icon: "", + description: "", + summary: "", + cover_image: "", + primary_sku_id: "", + hook: true, + slug: "", + guild_id: "", + bot_public: "", + bot_require_code_grant: false, + verify_key: "", + publishers: [ + { + id: "", + name: "" + } + ], + developers: [ + { + id: "", + name: "" + } + ], + system_requirements: {}, + show_age_gate: false, + price: { + amount: 0, + currency: "EUR" + }, + locales: [] + }, + tagline: "", + description: "", + carousel_items: [ + { + asset_id: "" + } + ], + header_logo_dark_theme: {}, //{id: "", size: 4665, mime_type: "image/gif", width 160, height: 160} + header_logo_light_theme: {}, + box_art: {}, + thumbnail: {}, + header_background: {}, + hero_background: {}, + assets: [] + } + }).status(200); +}); + +export default router; diff --git a/api/src/routes/store/skus.ts b/api/src/routes/store/skus.ts deleted file mode 100644 index 7d0e12eb..00000000 --- a/api/src/routes/store/skus.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Request, Response, Router } from "express"; -import { route } from "@fosscord/api"; - -const router: Router = Router(); - -router.get("/skus/:id", route({}), async (req: Request, res: Response) => { - //TODO - const { id } = req.params; - res.json([]).status(200); -}); - -export default router; diff --git a/api/src/routes/store/skus/#id/index.ts b/api/src/routes/store/skus/#id/index.ts new file mode 100644 index 00000000..53b61c29 --- /dev/null +++ b/api/src/routes/store/skus/#id/index.ts @@ -0,0 +1,78 @@ +import { Request, Response, Router } from "express"; +import { route } from "@fosscord/api"; + +const router: Router = Router(); + +router.get("/", route({}), async (req: Request, res: Response) => { + //TODO + res.json({ + id: "", + summary: "", + sku: { + id: "", + type: 1, + dependent_sku_id: null, + application_id: "", + manifets_labels: [], + access_type: 2, + name: "", + features: [], + relase_date: "", + premium: false, + slug: "", + flags: 4, + genres: [], + legal_notice: "", + application: { + id: "", + name: "", + icon: "", + description: "", + summary: "", + cover_image: "", + primary_sku_id: "", + hook: true, + slug: "", + guild_id: "", + bot_public: "", + bot_require_code_grant: false, + verify_key: "", + publishers: [ + { + id: "", + name: "" + } + ], + developers: [ + { + id: "", + name: "" + } + ], + system_requirements: {}, + show_age_gate: false, + price: { + amount: 0, + currency: "EUR" + }, + locales: [] + }, + tagline: "", + description: "", + carousel_items: [ + { + asset_id: "" + } + ], + header_logo_dark_theme: {}, //{id: "", size: 4665, mime_type: "image/gif", width 160, height: 160} + header_logo_light_theme: {}, + box_art: {}, + thumbnail: {}, + header_background: {}, + hero_background: {}, + assets: [] + } + }).status(200); +}); + +export default router; From d4a216ab2e4a97d866ddd464598d6c9f0debf341 Mon Sep 17 00:00:00 2001 From: uurgothat Date: Thu, 30 Sep 2021 17:57:51 +0300 Subject: [PATCH 3/4] Add misc routes --- .../routes/applications/#id/entitlements.ts | 12 +++++++++ .../messages/#message_id/crosspost.ts | 27 +++++++++++++++++-- api/src/routes/discovery.ts | 12 +++++++++ api/src/routes/stage-instances.ts | 11 ++++++++ .../applications.ts} | 0 .../applications/#id/subscription-plans.ts | 24 +++++++++++++++++ .../index.ts => published-listings/skus.ts} | 0 .../skus/#id/subscription-plans.ts | 24 +++++++++++++++++ .../@me/activities/statistics/applications.ts | 11 ++++++++ .../users/@me/billing/payment-sources.ts | 11 ++++++++ api/src/routes/users/@me/email-settings.ts | 19 +++++++++++++ api/src/routes/users/@me/entitlements.ts | 12 +++++++++ .../@me/guilds/premium/subscription-slots.ts | 11 ++++++++ api/src/routes/users/@me/notes.ts | 11 ++++++++ 14 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 api/src/routes/applications/#id/entitlements.ts create mode 100644 api/src/routes/discovery.ts create mode 100644 api/src/routes/stage-instances.ts rename api/src/routes/store/{applications/#id/index.ts => published-listings/applications.ts} (100%) create mode 100644 api/src/routes/store/published-listings/applications/#id/subscription-plans.ts rename api/src/routes/store/{skus/#id/index.ts => published-listings/skus.ts} (100%) create mode 100644 api/src/routes/store/published-listings/skus/#id/subscription-plans.ts create mode 100644 api/src/routes/users/@me/activities/statistics/applications.ts create mode 100644 api/src/routes/users/@me/billing/payment-sources.ts create mode 100644 api/src/routes/users/@me/email-settings.ts create mode 100644 api/src/routes/users/@me/entitlements.ts create mode 100644 api/src/routes/users/@me/guilds/premium/subscription-slots.ts create mode 100644 api/src/routes/users/@me/notes.ts diff --git a/api/src/routes/applications/#id/entitlements.ts b/api/src/routes/applications/#id/entitlements.ts new file mode 100644 index 00000000..1152e500 --- /dev/null +++ b/api/src/routes/applications/#id/entitlements.ts @@ -0,0 +1,12 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; + +const router = Router(); + +router.get("/", route({}), (req: Request, res: Response) => { + // TODO: + //const { exclude_consumed } = req.query; + res.status(200).send([]); +}); + +export default router; diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts b/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts index 6753e832..8174a61f 100644 --- a/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts +++ b/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts @@ -1,8 +1,31 @@ import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; const router = Router(); -// TODO: -// router.post("/", (req: Request, res: Response) => {}); +router.post("/", route({ permission: "MANAGE_MESSAGES" }), (req: Request, res: Response) => { + // TODO: + //const { locale, primary_only } = req.query; + res.json({ + id: "", + type: 0, + content: "", + channel_id: "", + author: {id: "", + username: "", + avatar: "", + discriminator: "", public_flags: 64}, + attachments: [], + embeds: [], + mentions: [], + mention_roles: [], + pinned: false, + mention_everyone: false, + tts: false, + timestamp: "", + edited_timestamp: null, + flags: 1, components: []}).status(200); +}); export default router; + diff --git a/api/src/routes/discovery.ts b/api/src/routes/discovery.ts new file mode 100644 index 00000000..9e6e0164 --- /dev/null +++ b/api/src/routes/discovery.ts @@ -0,0 +1,12 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; + +const router = Router(); + +router.get("/categories", route({}), (req: Request, res: Response) => { + // TODO: + //const { locale, primary_only } = req.query; + res.json([]).status(200); +}); + +export default router; diff --git a/api/src/routes/stage-instances.ts b/api/src/routes/stage-instances.ts new file mode 100644 index 00000000..411e95bf --- /dev/null +++ b/api/src/routes/stage-instances.ts @@ -0,0 +1,11 @@ +import { Request, Response, Router } from "express"; +import { route } from "@fosscord/api"; + +const router: Router = Router(); + +router.get("/", route({}), async (req: Request, res: Response) => { + //TODO + res.json([]).status(200); +}); + +export default router; diff --git a/api/src/routes/store/applications/#id/index.ts b/api/src/routes/store/published-listings/applications.ts similarity index 100% rename from api/src/routes/store/applications/#id/index.ts rename to api/src/routes/store/published-listings/applications.ts diff --git a/api/src/routes/store/published-listings/applications/#id/subscription-plans.ts b/api/src/routes/store/published-listings/applications/#id/subscription-plans.ts new file mode 100644 index 00000000..77f949d9 --- /dev/null +++ b/api/src/routes/store/published-listings/applications/#id/subscription-plans.ts @@ -0,0 +1,24 @@ +import { Request, Response, Router } from "express"; +import { route } from "@fosscord/api"; + +const router: Router = Router(); + +router.get("/", route({}), async (req: Request, res: Response) => { + //TODO + res.json([ + { + id: "", + name: "", + interval: 1, + interval_count: 1, + tax_inclusive: true, + sku_id: "", + fallback_price: 499, + fallback_currency: "eur", + currency: "eur", + price: 4199, + price_tier: null + }]).status(200); +}); + +export default router; diff --git a/api/src/routes/store/skus/#id/index.ts b/api/src/routes/store/published-listings/skus.ts similarity index 100% rename from api/src/routes/store/skus/#id/index.ts rename to api/src/routes/store/published-listings/skus.ts diff --git a/api/src/routes/store/published-listings/skus/#id/subscription-plans.ts b/api/src/routes/store/published-listings/skus/#id/subscription-plans.ts new file mode 100644 index 00000000..77f949d9 --- /dev/null +++ b/api/src/routes/store/published-listings/skus/#id/subscription-plans.ts @@ -0,0 +1,24 @@ +import { Request, Response, Router } from "express"; +import { route } from "@fosscord/api"; + +const router: Router = Router(); + +router.get("/", route({}), async (req: Request, res: Response) => { + //TODO + res.json([ + { + id: "", + name: "", + interval: 1, + interval_count: 1, + tax_inclusive: true, + sku_id: "", + fallback_price: 499, + fallback_currency: "eur", + currency: "eur", + price: 4199, + price_tier: null + }]).status(200); +}); + +export default router; diff --git a/api/src/routes/users/@me/activities/statistics/applications.ts b/api/src/routes/users/@me/activities/statistics/applications.ts new file mode 100644 index 00000000..834be35c --- /dev/null +++ b/api/src/routes/users/@me/activities/statistics/applications.ts @@ -0,0 +1,11 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; + +const router = Router(); + +router.get("/", route({}), (req: Request, res: Response) => { + // TODO: + res.json([]).status(200) +}); + +export default router; diff --git a/api/src/routes/users/@me/billing/payment-sources.ts b/api/src/routes/users/@me/billing/payment-sources.ts new file mode 100644 index 00000000..834be35c --- /dev/null +++ b/api/src/routes/users/@me/billing/payment-sources.ts @@ -0,0 +1,11 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; + +const router = Router(); + +router.get("/", route({}), (req: Request, res: Response) => { + // TODO: + res.json([]).status(200) +}); + +export default router; diff --git a/api/src/routes/users/@me/email-settings.ts b/api/src/routes/users/@me/email-settings.ts new file mode 100644 index 00000000..2d961a0e --- /dev/null +++ b/api/src/routes/users/@me/email-settings.ts @@ -0,0 +1,19 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; + +const router = Router(); + +router.get("/", route({}), (req: Request, res: Response) => { + // TODO: + res.json({ + categories: { + social: true, + communication: true, + tips: false, + updates_and_announcements: false, + recommendations_and_events: false }, + initialized: false + }).status(200); +}); + +export default router; diff --git a/api/src/routes/users/@me/entitlements.ts b/api/src/routes/users/@me/entitlements.ts new file mode 100644 index 00000000..7be3634b --- /dev/null +++ b/api/src/routes/users/@me/entitlements.ts @@ -0,0 +1,12 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; + +const router = Router(); + +router.get("/gifts", route({}), (req: Request, res: Response) => { + // TODO: + //const { locale, primary_only } = req.query; + res.json([]).status(200); +}); + +export default router; diff --git a/api/src/routes/users/@me/guilds/premium/subscription-slots.ts b/api/src/routes/users/@me/guilds/premium/subscription-slots.ts new file mode 100644 index 00000000..b487a2ce --- /dev/null +++ b/api/src/routes/users/@me/guilds/premium/subscription-slots.ts @@ -0,0 +1,11 @@ +import { Router, Response, Request } from "express"; +import { route } from "@fosscord/api"; + +const router = Router(); + +router.get("/", route({}), (req: Request, res: Response) => { + // TODO: + res.json([]).status(200)); +}); + +export default router; diff --git a/api/src/routes/users/@me/notes.ts b/api/src/routes/users/@me/notes.ts new file mode 100644 index 00000000..235c2baf --- /dev/null +++ b/api/src/routes/users/@me/notes.ts @@ -0,0 +1,11 @@ +import { Request, Response, Router } from "express"; +import { route } from "@fosscord/api"; + +const router: Router = Router(); + +router.put("/", route({}), async (req: Request, res: Response) => { + //TODO + res.json({code: 0}).status(400); +}); + +export default router; From d23f4bbe98bec0cdef0c1a4cce961de2c2a83ab1 Mon Sep 17 00:00:00 2001 From: uurgothat Date: Thu, 30 Sep 2021 18:57:53 +0300 Subject: [PATCH 4/4] hotfix for misc routes --- .../channels/#channel_id/messages/#message_id/crosspost.ts | 1 - api/src/routes/store/published-listings/applications.ts | 3 ++- api/src/routes/store/published-listings/skus.ts | 3 ++- api/src/routes/users/@me/entitlements.ts | 1 - .../routes/users/@me/guilds/premium/subscription-slots.ts | 2 +- api/src/routes/users/@me/notes.ts | 7 +++++-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts b/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts index 8174a61f..de0c01f1 100644 --- a/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts +++ b/api/src/routes/channels/#channel_id/messages/#message_id/crosspost.ts @@ -5,7 +5,6 @@ const router = Router(); router.post("/", route({ permission: "MANAGE_MESSAGES" }), (req: Request, res: Response) => { // TODO: - //const { locale, primary_only } = req.query; res.json({ id: "", type: 0, diff --git a/api/src/routes/store/published-listings/applications.ts b/api/src/routes/store/published-listings/applications.ts index 53b61c29..f06a01e4 100644 --- a/api/src/routes/store/published-listings/applications.ts +++ b/api/src/routes/store/published-listings/applications.ts @@ -3,8 +3,9 @@ import { route } from "@fosscord/api"; const router: Router = Router(); -router.get("/", route({}), async (req: Request, res: Response) => { +router.get("/:id", route({}), async (req: Request, res: Response) => { //TODO + const id = req.params.id; res.json({ id: "", summary: "", diff --git a/api/src/routes/store/published-listings/skus.ts b/api/src/routes/store/published-listings/skus.ts index 53b61c29..f06a01e4 100644 --- a/api/src/routes/store/published-listings/skus.ts +++ b/api/src/routes/store/published-listings/skus.ts @@ -3,8 +3,9 @@ import { route } from "@fosscord/api"; const router: Router = Router(); -router.get("/", route({}), async (req: Request, res: Response) => { +router.get("/:id", route({}), async (req: Request, res: Response) => { //TODO + const id = req.params.id; res.json({ id: "", summary: "", diff --git a/api/src/routes/users/@me/entitlements.ts b/api/src/routes/users/@me/entitlements.ts index 7be3634b..341e2b4c 100644 --- a/api/src/routes/users/@me/entitlements.ts +++ b/api/src/routes/users/@me/entitlements.ts @@ -5,7 +5,6 @@ const router = Router(); router.get("/gifts", route({}), (req: Request, res: Response) => { // TODO: - //const { locale, primary_only } = req.query; res.json([]).status(200); }); diff --git a/api/src/routes/users/@me/guilds/premium/subscription-slots.ts b/api/src/routes/users/@me/guilds/premium/subscription-slots.ts index b487a2ce..014df8af 100644 --- a/api/src/routes/users/@me/guilds/premium/subscription-slots.ts +++ b/api/src/routes/users/@me/guilds/premium/subscription-slots.ts @@ -5,7 +5,7 @@ const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { // TODO: - res.json([]).status(200)); + res.json([]).status(200); }); export default router; diff --git a/api/src/routes/users/@me/notes.ts b/api/src/routes/users/@me/notes.ts index 235c2baf..2ef27bc0 100644 --- a/api/src/routes/users/@me/notes.ts +++ b/api/src/routes/users/@me/notes.ts @@ -3,9 +3,12 @@ import { route } from "@fosscord/api"; const router: Router = Router(); -router.put("/", route({}), async (req: Request, res: Response) => { +router.put("/:id", route({}), async (req: Request, res: Response) => { //TODO - res.json({code: 0}).status(400); + res.json({ + message: "400: Bad Request", + code: 0 + }).status(400); }); export default router;