@@ -177,6 +177,7 @@ export class AdminCategoryController extends BaseController {
|
|||||||
@ApiOperation("Update a theme ==> need to login as admin")
|
@ApiOperation("Update a theme ==> need to login as admin")
|
||||||
@ApiResponse("theme updated successfully", HttpStatus.Ok)
|
@ApiResponse("theme updated successfully", HttpStatus.Ok)
|
||||||
@ApiAuth()
|
@ApiAuth()
|
||||||
|
@ApiModel(UpdateThemeDTO)
|
||||||
@httpPut(
|
@httpPut(
|
||||||
"/theme",
|
"/theme",
|
||||||
Guard.authAdmin(),
|
Guard.authAdmin(),
|
||||||
@@ -243,6 +244,7 @@ export class AdminCategoryController extends BaseController {
|
|||||||
@ApiOperation("Update a theme value ==> need to login as admin")
|
@ApiOperation("Update a theme value ==> need to login as admin")
|
||||||
@ApiResponse("theme value updated successfully", HttpStatus.Ok)
|
@ApiResponse("theme value updated successfully", HttpStatus.Ok)
|
||||||
@ApiAuth()
|
@ApiAuth()
|
||||||
|
@ApiModel(UpdateThemeValueDTO)
|
||||||
@httpPut(
|
@httpPut(
|
||||||
"/theme-value",
|
"/theme-value",
|
||||||
Guard.authAdmin(),
|
Guard.authAdmin(),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Expose } from "class-transformer";
|
import { Expose } from "class-transformer";
|
||||||
import { IsNotEmpty, IsString } from "class-validator";
|
import { IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||||
|
|
||||||
import { ApiProperty } from "../../../common/decorator/swggerDocs";
|
import { ApiProperty } from "../../../common/decorator/swggerDocs";
|
||||||
import { IsValidId } from "../../../common/decorator/validation.decorator";
|
import { IsValidId } from "../../../common/decorator/validation.decorator";
|
||||||
@@ -14,10 +14,10 @@ export class CreateThemeValueDTO {
|
|||||||
theme: string;
|
theme: string;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@IsNotEmpty()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
@ApiProperty({ type: "string", description: "the name of theme value", example: "Red" })
|
@ApiProperty({ type: "string", description: "the name of theme value", example: "Red", required: false })
|
||||||
name: string;
|
name?: string;
|
||||||
|
|
||||||
@Expose()
|
@Expose()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ import { Types } from "mongoose";
|
|||||||
export interface IThemeValue {
|
export interface IThemeValue {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
theme: Types.ObjectId;
|
theme: Types.ObjectId;
|
||||||
name: string;
|
name?: string;
|
||||||
value: string;
|
value: string | number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { IThemeValue } from "./Abstraction/IThemeValue";
|
|||||||
const themeValueSchema = new Schema<IThemeValue>(
|
const themeValueSchema = new Schema<IThemeValue>(
|
||||||
{
|
{
|
||||||
theme: { type: Schema.Types.ObjectId, ref: "Theme", required: true },
|
theme: { type: Schema.Types.ObjectId, ref: "Theme", required: true },
|
||||||
name: { type: String, required: true },
|
name: { type: String, required: false },
|
||||||
value: { type: Schema.Types.Mixed, required: true },
|
value: { type: Schema.Types.Mixed, required: true },
|
||||||
},
|
},
|
||||||
{ timestamps: true, toJSON: { virtuals: true, versionKey: false }, id: false },
|
{ timestamps: true, toJSON: { virtuals: true, versionKey: false }, id: false },
|
||||||
|
|||||||
Reference in New Issue
Block a user