summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2023-03-23 13:51:29 -0400
committerPuyodead1 <puyodead@proton.me>2023-04-13 15:06:21 -0400
commit777e7208dccb3e28f6c2fe85abb5a6d7aaa99ed2 (patch)
treeeaaec58da7cad27f75191172c35540ef5b8c5516 /src
parentgateway (diff)
downloadserver-777e7208dccb3e28f6c2fe85abb5a6d7aaa99ed2.tar.xz
AAA
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/gateway/bot.ts11
-rw-r--r--src/api/routes/gateway/index.ts4
-rw-r--r--src/api/routes/users/#id/profile.ts14
-rw-r--r--src/api/routes/users/#id/relationships.ts6
-rw-r--r--src/util/schemas/responses/GatewayBotResponse.ts10
-rw-r--r--src/util/schemas/responses/GatewayResponse.ts3
-rw-r--r--src/util/schemas/responses/UserProfileResponse.ts8
-rw-r--r--src/util/schemas/responses/UserRelationsResponse.ts9
-rw-r--r--src/util/schemas/responses/index.ts4
9 files changed, 44 insertions, 25 deletions
diff --git a/src/api/routes/gateway/bot.ts b/src/api/routes/gateway/bot.ts
index 7e6bd04a..d9101159 100644
--- a/src/api/routes/gateway/bot.ts
+++ b/src/api/routes/gateway/bot.ts
@@ -22,17 +22,6 @@ import { Request, Response, Router } from "express";
 
 const router = Router();
 
-export interface GatewayBotResponse {
-	url: string;
-	shards: number;
-	session_start_limit: {
-		total: number;
-		remaining: number;
-		reset_after: number;
-		max_concurrency: number;
-	};
-}
-
 router.get(
 	"/",
 	route({
diff --git a/src/api/routes/gateway/index.ts b/src/api/routes/gateway/index.ts
index 877b6efa..9100d5ee 100644
--- a/src/api/routes/gateway/index.ts
+++ b/src/api/routes/gateway/index.ts
@@ -22,10 +22,6 @@ import { Request, Response, Router } from "express";
 
 const router = Router();
 
-export interface GatewayResponse {
-	url: string;
-}
-
 router.get(
 	"/",
 	route({
diff --git a/src/api/routes/users/#id/profile.ts b/src/api/routes/users/#id/profile.ts
index 2836c563..650873ad 100644
--- a/src/api/routes/users/#id/profile.ts
+++ b/src/api/routes/users/#id/profile.ts
@@ -16,23 +16,23 @@
 	along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-import { Router, Request, Response } from "express";
+import { route } from "@spacebar/api";
 import {
-	User,
 	Member,
-	UserProfileModifySchema,
-	handleFile,
 	PrivateUserProjection,
-	emitEvent,
+	User,
+	UserProfileModifySchema,
 	UserUpdateEvent,
+	emitEvent,
+	handleFile,
 } from "@spacebar/util";
-import { route } from "@spacebar/api";
+import { Request, Response, Router } from "express";
 
 const router: Router = Router();
 
 router.get(
 	"/",
-	route({ test: { response: { body: "UserProfileResponse" } } }),
+	route({ responses: { 200: { body: "UserProfileResponse" } } }),
 	async (req: Request, res: Response) => {
 		if (req.params.id === "@me") req.params.id = req.user_id;
 
diff --git a/src/api/routes/users/#id/relationships.ts b/src/api/routes/users/#id/relationships.ts
index dfe52a5e..f18672b1 100644
--- a/src/api/routes/users/#id/relationships.ts
+++ b/src/api/routes/users/#id/relationships.ts
@@ -16,15 +16,15 @@
 	along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-import { Router, Request, Response } from "express";
-import { User } from "@spacebar/util";
 import { route } from "@spacebar/api";
+import { User } from "@spacebar/util";
+import { Request, Response, Router } from "express";
 
 const router: Router = Router();
 
 router.get(
 	"/",
-	route({ test: { response: { body: "UserRelationsResponse" } } }),
+	route({ responses: { 200: { body: "UserRelationsResponse" } } }),
 	async (req: Request, res: Response) => {
 		const mutual_relations: object[] = [];
 		const requested_relations = await User.findOneOrFail({
diff --git a/src/util/schemas/responses/GatewayBotResponse.ts b/src/util/schemas/responses/GatewayBotResponse.ts
new file mode 100644
index 00000000..30f1f57f
--- /dev/null
+++ b/src/util/schemas/responses/GatewayBotResponse.ts
@@ -0,0 +1,10 @@
+export interface GatewayBotResponse {
+	url: string;
+	shards: number;
+	session_start_limit: {
+		total: number;
+		remaining: number;
+		reset_after: number;
+		max_concurrency: number;
+	};
+}
diff --git a/src/util/schemas/responses/GatewayResponse.ts b/src/util/schemas/responses/GatewayResponse.ts
new file mode 100644
index 00000000..e909f7bd
--- /dev/null
+++ b/src/util/schemas/responses/GatewayResponse.ts
@@ -0,0 +1,3 @@
+export interface GatewayResponse {
+	url: string;
+}
diff --git a/src/util/schemas/responses/UserProfileResponse.ts b/src/util/schemas/responses/UserProfileResponse.ts
new file mode 100644
index 00000000..4e5cd8a6
--- /dev/null
+++ b/src/util/schemas/responses/UserProfileResponse.ts
@@ -0,0 +1,8 @@
+import { PublicConnectedAccount, UserPublic } from "../../entities";
+
+export interface UserProfileResponse {
+	user: UserPublic;
+	connected_accounts: PublicConnectedAccount;
+	premium_guild_since?: Date;
+	premium_since?: Date;
+}
diff --git a/src/util/schemas/responses/UserRelationsResponse.ts b/src/util/schemas/responses/UserRelationsResponse.ts
new file mode 100644
index 00000000..1ec15eca
--- /dev/null
+++ b/src/util/schemas/responses/UserRelationsResponse.ts
@@ -0,0 +1,9 @@
+export interface UserRelationsResponse {
+	object: {
+		id?: string;
+		username?: string;
+		avatar?: string;
+		discriminator?: string;
+		public_flags?: number;
+	};
+}
diff --git a/src/util/schemas/responses/index.ts b/src/util/schemas/responses/index.ts
index 2a1180ad..49e8053b 100644
--- a/src/util/schemas/responses/index.ts
+++ b/src/util/schemas/responses/index.ts
@@ -9,7 +9,11 @@ export * from "./CaptchaRequiredResponse";
 export * from "./ChannelInvitesResponse";
 export * from "./ChannelPinsResponse";
 export * from "./ChannelWebhooksResponse";
+export * from "./GatewayBotResponse";
+export * from "./GatewayResponse";
 export * from "./GenerateRegistrationTokensResponse";
 export * from "./LocationMetadataResponse";
 export * from "./TokenResponse";
+export * from "./UserProfileResponse";
+export * from "./UserRelationsResponse";
 export * from "./WebhookCreateResponse";