From 6875e4d4e423022c3060ab005255471158385217 Mon Sep 17 00:00:00 2001 From: skeris Date: Fri, 15 Dec 2023 18:16:14 +0300 Subject: [PATCH] feat: add description to tariff --- src/handlers/tariff/index.ts | 1 + src/models/tariff.model.ts | 4 ++++ src/swagger/tariff/models.ts | 1 + src/types/models/tariff.type.ts | 1 + 4 files changed, 7 insertions(+) diff --git a/src/handlers/tariff/index.ts b/src/handlers/tariff/index.ts index dfa6628..4b34202 100644 --- a/src/handlers/tariff/index.ts +++ b/src/handlers/tariff/index.ts @@ -77,6 +77,7 @@ export const createTariff = async (request: CreateTariffRequest, reply: FastifyR const newTariff = new TariffModel({ name: requestBody.name, + description: requestBody.description, price: requestBody.price, userId: request.user.id, isCustom: requestBody.isCustom, diff --git a/src/models/tariff.model.ts b/src/models/tariff.model.ts index 61ae31c..bfd694f 100644 --- a/src/models/tariff.model.ts +++ b/src/models/tariff.model.ts @@ -10,6 +10,10 @@ const schema: SchemaDefinition = { type: String, required: true, }, + description: { + type: String, + required: false, + }, price: { type: Number, required: false, diff --git a/src/swagger/tariff/models.ts b/src/swagger/tariff/models.ts index 9622fb0..80fa522 100644 --- a/src/swagger/tariff/models.ts +++ b/src/swagger/tariff/models.ts @@ -6,6 +6,7 @@ export const tariff: SwaggerMessage = { properties: { _id: { type: "string" }, name: { type: "string" }, + description: { type: "string" }, price: { type: "number" }, isCustom: { type: "boolean" }, privileges: { diff --git a/src/types/models/tariff.type.ts b/src/types/models/tariff.type.ts index 99825f5..c176b60 100644 --- a/src/types/models/tariff.type.ts +++ b/src/types/models/tariff.type.ts @@ -4,6 +4,7 @@ import type { Eloquent } from "./eloquent.type"; export type Tariff = Eloquent & { name: string; userId: string; + description: string; price?: number; isCustom: boolean; privileges: Array>;