diff --git a/src/api/routes/applications/#application_id/storefront/product.ts b/src/api/routes/applications/#application_id/storefront/product.ts
new file mode 100644
index 000000000..104025673
--- /dev/null
+++ b/src/api/routes/applications/#application_id/storefront/product.ts
@@ -0,0 +1,30 @@
+import { Router, Request, Response } from "express";
+import { route } from "@spacebar/api";
+import { CreateApplicationSKUSchema, CreateApplicationSKUResponseSchema } from "@spacebar/schemas";
+
+const router = Router({ mergeParams: true });
+
+// this is the route the developer portal seems to use to create a sku for an app
+router.post(
+ "/",
+ route({
+ description: "Create a new SKU for an application",
+ requestBody: "CreateApplicationSKUSchema",
+ responses: {
+ 200: {
+ body: "CreateApplicationSKUResponseSchema",
+ },
+ },
+ }),
+ async (req: Request, res: Response) => {
+ const { application_id } = req.params;
+ const { name, sku_type, product_line } = req.body as CreateApplicationSKUSchema;
+ // TODO:
+ res.json({
+ skus: [],
+ store_listings: [],
+ } as CreateApplicationSKUResponseSchema);
+ },
+);
+
+export default router;
diff --git a/src/api/routes/store/published-listings/skus.ts b/src/api/routes/store/published-listings/skus.ts
index 01bbc8b27..068a947b1 100644
--- a/src/api/routes/store/published-listings/skus.ts
+++ b/src/api/routes/store/published-listings/skus.ts
@@ -21,77 +21,77 @@ import { route } from "@spacebar/api";
const router: Router = Router({ mergeParams: true });
-router.get("/:sku_id", route({}), (req: Request, res: Response) => {
- //TODO
- // const id = req.params.id;
- res.json({
- id: "",
- summary: "",
- sku: {
- id: "",
- type: 1,
- dependent_sku_id: null,
- application_id: "",
- manifets_labels: [],
- access_type: 2,
- name: "",
- features: [],
- release_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);
-});
+// router.get("/:sku_id", route({}), (req: Request, res: Response) => {
+// //TODO
+// // const id = req.params.id;
+// res.json({
+// id: "",
+// summary: "",
+// sku: {
+// id: "",
+// type: 1,
+// dependent_sku_id: null,
+// application_id: "",
+// manifets_labels: [],
+// access_type: 2,
+// name: "",
+// features: [],
+// release_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/src/api/routes/store/published-listings/skus/#sku_id/index.ts b/src/api/routes/store/published-listings/skus/#sku_id/index.ts
new file mode 100644
index 000000000..1635c6dfb
--- /dev/null
+++ b/src/api/routes/store/published-listings/skus/#sku_id/index.ts
@@ -0,0 +1,96 @@
+/*
+ Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
+ Copyright (C) 2023 Spacebar and Spacebar Contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+import { Request, Response, Router } from "express";
+import { route } from "@spacebar/api";
+
+const router: Router = Router({ mergeParams: true });
+
+router.get("/", route({}), (req: Request, res: Response) => {
+ //TODO
+ // const id = req.params.id;
+ res.json({
+ id: "",
+ summary: "",
+ sku: {
+ id: "",
+ type: 1,
+ dependent_sku_id: null,
+ application_id: "",
+ manifets_labels: [],
+ access_type: 2,
+ name: "",
+ features: [],
+ release_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/src/api/routes/store/skus.ts b/src/api/routes/store/skus.ts
new file mode 100644
index 000000000..bd794dd22
--- /dev/null
+++ b/src/api/routes/store/skus.ts
@@ -0,0 +1,42 @@
+/*
+ Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
+ Copyright (C) 2023 Spacebar and Spacebar Contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+import { Request, Response, Router } from "express";
+import { route } from "@spacebar/api";
+import { CreateSKUSchema } from "@spacebar/schemas";
+import { SKU } from "@spacebar/util";
+
+const router: Router = Router({ mergeParams: true });
+
+router.post(
+ "/",
+ route({
+ description:
+ "Creates a new SKU. Returns the created SKU object on success. Requires an application with access to the store or monetization. User must be the owner of the application or member of the owning team.",
+ requestBody: "CreateSKUSchema",
+ }),
+ async (req: Request, res: Response) => {
+ const body = req.body as CreateSKUSchema;
+
+ const sku = await SKU.createSku(body);
+
+ res.json(sku).status(200);
+ },
+);
+
+export default router;
|