Skip to content

a-pyro/sugar-daddy-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sugar Daddy 🍭 (DTOs)

Sweet

A Sweet object represents the data that is sent to the server when creating or updating a sweet.

export interface Sweet {
  name: string
  price: number
  description: string
  ingredients: Ingredient[]
}

Ingredient

An Ingredient object represents the data that is sent to the server when creating or updating an ingredient.

export interface Ingredient {
  name: string
  quantity: number
  unit: string
}

SweetResponse

A SweetResponse object is a view of a Sweet object that can be returned to client, it can contains additional information like the id of the object, the timestamp of the creation and update.

export interface SweetResponse extends Omit<Sweet, 'ingredients'>, Document {
  ingredients: IngredientResponse[]
}

IngredientResponse

An IngredientResponse object is a view of an Ingredient object that can be returned to client, it can contains additional information like the id of the object, the timestamp of the creation and update.

export interface IngredientResponse extends Ingredient, Document {}

Document

Mongo document

{
    _id: string
    createdAt: string
    updatedAt: string
    ...
}