Renamed themeId to themeID for consistency

This commit is contained in:
Rizwan Mustafa 2022-02-26 07:00:08 +05:00
parent 4cf8bec9a8
commit f80e94c244
4 changed files with 14 additions and 14 deletions

View file

@ -250,16 +250,16 @@ class UserController {
static async removeCustomTheme(req, _res) {
const { uid } = req.ctx.decodedToken;
const { themeID } = req.body;
await UsersDAO.removeTheme(uid, themeID);
const { themeId } = req.body;
await UsersDAO.removeTheme(uid, themeId);
return new MonkeyResponse("Custom theme removed");
}
static async editCustomTheme(req, _res) {
const { uid } = req.ctx.decodedToken;
const { themeID, theme } = req.body;
const { themeId, theme } = req.body;
await UsersDAO.editTheme(uid, themeID, theme);
await UsersDAO.editTheme(uid, themeId, theme);
return new MonkeyResponse("Custom theme updated");
}
}

View file

@ -52,8 +52,8 @@ const customThemeIdValidation = joi
.regex(/^[0-9a-fA-F]+$/)
.required()
.messages({
"string.length": "The themeID must be 24 characters long",
"string.pattern.base": "The themeID must be valid hexadecimal string",
"string.length": "The themeId must be 24 characters long",
"string.pattern.base": "The themeId must be valid hexadecimal string",
});
router.get(
@ -227,7 +227,7 @@ router.delete(
authenticateRequest(),
validateRequest({
body: {
themeID: customThemeIdValidation,
themeId: customThemeIdValidation,
},
}),
asyncHandler(UserController.removeCustomTheme)
@ -239,7 +239,7 @@ router.put(
authenticateRequest(),
validateRequest({
body: {
themeID: customThemeIdValidation,
themeId: customThemeIdValidation,
theme: {
name: customThemeNameValidation,
colors: customThemeColorsValidation,

View file

@ -95,11 +95,11 @@ export default function getUsersEndpoints(
// }
async function editCustomThemes(
themeID: string,
themeId: string,
newTheme: Partial<MonkeyTypes.CustomTheme>
): Ape.EndpointData {
const payload = {
themeID: themeID,
themeId: themeId,
theme: {
name: newTheme.name,
colors: newTheme.colors,
@ -108,9 +108,9 @@ export default function getUsersEndpoints(
return await apeClient.put(`${BASE_PATH}/customThemes`, { payload });
}
async function deleteCustomThemes(themeID: string): Ape.EndpointData {
async function deleteCustomThemes(themeId: string): Ape.EndpointData {
const payload = {
themeID: themeID,
themeId: themeId,
};
return await apeClient.delete(`${BASE_PATH}/customThemes`, { payload });
}

View file

@ -115,10 +115,10 @@ declare namespace Ape {
newTheme: Partial<MonkeyTypes.CustomTheme>
) => EndpointData;
editCustomThemes: (
themeID: string,
themeId: string,
newTheme: Partial<MonkeyTypes.CustomTheme>
) => EndpointData;
deleteCustomThemes: (themeID: string) => EndpointData;
deleteCustomThemes: (themeId: string) => EndpointData;
getTags: Endpoint;
createTag: (tagName: string) => EndpointData;
editTag: (tagId: string, newName: string) => EndpointData;