Updates
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import queryDSQLAPI from "../../functions/api/query-dsql-api";
|
||||
import { APIResponseObject } from "../../types";
|
||||
import { DSQL_DATASQUIREL_USER_MEDIA } from "../../types/dsql";
|
||||
import path from "path";
|
||||
import grabAPIBasePath from "../../utils/grab-api-base-path";
|
||||
|
||||
export default async function apiMediaDELETE(params: {
|
||||
mediaID?: string | number;
|
||||
}): Promise<
|
||||
APIResponseObject<
|
||||
DSQL_DATASQUIREL_USER_MEDIA | DSQL_DATASQUIREL_USER_MEDIA[]
|
||||
>
|
||||
> {
|
||||
const basePath = grabAPIBasePath({ paradigm: "media" });
|
||||
|
||||
const mediaID = params.mediaID
|
||||
? typeof params.mediaID === "number"
|
||||
? String(params.mediaID)
|
||||
: params.mediaID
|
||||
: undefined;
|
||||
|
||||
const finalPath = path.join(basePath, mediaID || "");
|
||||
|
||||
const DELETE_MEDIA_RES = await queryDSQLAPI({
|
||||
method: "DELETE",
|
||||
path: finalPath,
|
||||
});
|
||||
|
||||
return DELETE_MEDIA_RES as APIResponseObject<
|
||||
DSQL_DATASQUIREL_USER_MEDIA | DSQL_DATASQUIREL_USER_MEDIA[]
|
||||
>;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import queryDSQLAPI from "../../functions/api/query-dsql-api";
|
||||
import { APIGetMediaParams, APIResponseObject } from "../../types";
|
||||
import path from "path";
|
||||
import { DSQL_DATASQUIREL_USER_MEDIA } from "../../types/dsql";
|
||||
import grabAPIBasePath from "../../utils/grab-api-base-path";
|
||||
|
||||
export default async function apiMediaGET(
|
||||
params: APIGetMediaParams
|
||||
): Promise<
|
||||
APIResponseObject<
|
||||
DSQL_DATASQUIREL_USER_MEDIA | DSQL_DATASQUIREL_USER_MEDIA[]
|
||||
>
|
||||
> {
|
||||
const basePath = grabAPIBasePath({ paradigm: "media" });
|
||||
|
||||
const mediaID = params.mediaID
|
||||
? typeof params.mediaID === "number"
|
||||
? String(params.mediaID)
|
||||
: params.mediaID
|
||||
: undefined;
|
||||
|
||||
const finalPath = path.join(basePath, mediaID || "");
|
||||
|
||||
const GET_MEDIA_RES = await queryDSQLAPI<APIGetMediaParams>({
|
||||
method: "GET",
|
||||
path: finalPath,
|
||||
query: params,
|
||||
});
|
||||
|
||||
return GET_MEDIA_RES as APIResponseObject<
|
||||
DSQL_DATASQUIREL_USER_MEDIA | DSQL_DATASQUIREL_USER_MEDIA[]
|
||||
>;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import apiMediaGET from "./get";
|
||||
import apiMediaPOST from "./post";
|
||||
import apiMediaDELETE from "./delete";
|
||||
|
||||
const media = {
|
||||
get: apiMediaGET,
|
||||
add: apiMediaPOST,
|
||||
delete: apiMediaDELETE,
|
||||
};
|
||||
|
||||
export default media;
|
||||
@@ -0,0 +1,24 @@
|
||||
import queryDSQLAPI from "../../functions/api/query-dsql-api";
|
||||
import { AddMediaAPIBody, APIResponseObject } from "../../types";
|
||||
import { DSQL_DATASQUIREL_USER_MEDIA } from "../../types/dsql";
|
||||
import grabAPIBasePath from "../../utils/grab-api-base-path";
|
||||
|
||||
export default async function apiMediaPOST(
|
||||
params: AddMediaAPIBody
|
||||
): Promise<
|
||||
APIResponseObject<
|
||||
DSQL_DATASQUIREL_USER_MEDIA | DSQL_DATASQUIREL_USER_MEDIA[]
|
||||
>
|
||||
> {
|
||||
const basePath = grabAPIBasePath({ paradigm: "media" });
|
||||
|
||||
const POST_MEDIA_RES = await queryDSQLAPI<AddMediaAPIBody>({
|
||||
method: "POST",
|
||||
path: basePath,
|
||||
body: params,
|
||||
});
|
||||
|
||||
return POST_MEDIA_RES as APIResponseObject<
|
||||
DSQL_DATASQUIREL_USER_MEDIA | DSQL_DATASQUIREL_USER_MEDIA[]
|
||||
>;
|
||||
}
|
||||
Reference in New Issue
Block a user