From 0b167dabb7ce7cbdf989aee35d322c3b647d5c78 Mon Sep 17 00:00:00 2001 From: Sweets Sweetman Date: Fri, 14 Nov 2025 14:54:37 -0500 Subject: [PATCH 1/3] API - /api/artists/pro - simple GET endpoint --- routes.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes.ts b/routes.ts index a634cf7..87df328 100644 --- a/routes.ts +++ b/routes.ts @@ -3,6 +3,7 @@ import * as SegmentsController from "./controllers/SegmentsController"; import * as GlobalController from "./controllers/GlobalController"; import { PilotController } from "./controllers/PilotController"; import { getArtistProfileHandler } from "./controllers/ArtistProfileController"; +import { getArtistsProHandler } from "./controllers/ArtistsProController"; import { generateImageHandler } from "./controllers/ImageGenerationController"; import { getCommentsHandler } from "./controllers/CommentsController"; import { getArtistSegmentsHandler } from "./controllers/ArtistSegmentsController"; @@ -95,6 +96,7 @@ routes.get("/image-generation", generateImageHandler as any); routes.get("/comments", getCommentsHandler as any); +routes.get("/artists/pro", getArtistsProHandler); routes.get("/artist/segments", getArtistSegmentsHandler as any); routes.get("/segment/fans", getSegmentFansHandler as any); routes.get("/artist/socials", getArtistSocialsHandler); From 349aa709b63cf390cc75250361b2a29c86e39db1 Mon Sep 17 00:00:00 2001 From: Sweets Sweetman Date: Fri, 14 Nov 2025 14:56:31 -0500 Subject: [PATCH 2/3] ArtistProController --- .../getArtistsProHandler.ts | 30 +++++++++++++++++++ controllers/ArtistsProController/index.ts | 1 + 2 files changed, 31 insertions(+) create mode 100644 controllers/ArtistsProController/getArtistsProHandler.ts create mode 100644 controllers/ArtistsProController/index.ts diff --git a/controllers/ArtistsProController/getArtistsProHandler.ts b/controllers/ArtistsProController/getArtistsProHandler.ts new file mode 100644 index 0000000..7f431a8 --- /dev/null +++ b/controllers/ArtistsProController/getArtistsProHandler.ts @@ -0,0 +1,30 @@ +import { Request, Response } from "express"; +import { getArtists } from "../../lib/artists/getArtists"; + +/** + * Handles GET requests for artists list + * Returns all artists from the accounts table + */ +export const getArtistsProHandler = async ( + req: Request, + res: Response +): Promise => { + try { + const response = await getArtists(); + + if (response.status === "error") { + res.status(500).json(response); + return; + } + + res.status(200).json(response); + } catch (error) { + console.error("[ERROR] Error in getArtistsProHandler:", error); + res.status(500).json({ + status: "error", + artists: [], + error: + error instanceof Error ? error.message : "An unexpected error occurred", + }); + } +}; diff --git a/controllers/ArtistsProController/index.ts b/controllers/ArtistsProController/index.ts new file mode 100644 index 0000000..5fc551f --- /dev/null +++ b/controllers/ArtistsProController/index.ts @@ -0,0 +1 @@ +export { getArtistsProHandler } from "./getArtistsProHandler"; From 639dae5b34b1afc3df1bc124206f2333f6e42276 Mon Sep 17 00:00:00 2001 From: Sweets Sweetman Date: Fri, 14 Nov 2025 14:56:51 -0500 Subject: [PATCH 3/3] mock response --- .../getArtistsProHandler.ts | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/controllers/ArtistsProController/getArtistsProHandler.ts b/controllers/ArtistsProController/getArtistsProHandler.ts index 7f431a8..1cb6cef 100644 --- a/controllers/ArtistsProController/getArtistsProHandler.ts +++ b/controllers/ArtistsProController/getArtistsProHandler.ts @@ -1,30 +1,33 @@ import { Request, Response } from "express"; -import { getArtists } from "../../lib/artists/getArtists"; /** * Handles GET requests for artists list - * Returns all artists from the accounts table + * Returns mock artists data */ export const getArtistsProHandler = async ( req: Request, res: Response ): Promise => { - try { - const response = await getArtists(); + const mockResponse = { + status: "success", + artists: [ + { + id: "1", + name: "Artist One", + timestamp: 1234567890, + }, + { + id: "2", + name: "Artist Two", + timestamp: 1234567891, + }, + { + id: "3", + name: "Artist Three", + timestamp: 1234567892, + }, + ], + }; - if (response.status === "error") { - res.status(500).json(response); - return; - } - - res.status(200).json(response); - } catch (error) { - console.error("[ERROR] Error in getArtistsProHandler:", error); - res.status(500).json({ - status: "error", - artists: [], - error: - error instanceof Error ? error.message : "An unexpected error occurred", - }); - } + res.status(200).json(mockResponse); };