MCPcopy Create free account
hub / github.com/SOS-RS/backend / ServerResponse

Class ServerResponse

src/utils/utils.ts:4–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import { GeolocationFilter } from 'src/shelter/types/search.types';
3
4class ServerResponse<T> {
5 readonly message: string;
6 private readonly statusCode: number;
7 private readonly respData?: T;
8
9 constructor(statusCode: number, message: string, data?: T) {
10 this.statusCode = statusCode;
11 this.message = message;
12 this.respData = data;
13 }
14
15 public get data(): { statusCode: number; message: string; data?: T } {
16 const resp = {
17 statusCode: this.statusCode,
18 message: this.message,
19 data: this.respData,
20 };
21 if (!resp?.data) delete resp.data;
22 return resp;
23 }
24}
25
26function removeNotNumbers(input: string): string {
27 return input.replace(/[^0-9]/g, '');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected