---
# System prepended metadata

title: Requerimientos de datos

---

# Requerimientos de datos
Esta documentacion es estrictamente para definir que datos y que tipo de operaciones CRUD requiere el front-end de la aplicacion cliente Raudo.

Este documento fue escrito en editor de MarkDown por lo que puede y tendra errores ortograficos.

## Data Models

#### Address
```
id: String,
description: String,
streetAddress: String,
type: String
```

#### User
```
id: String,
avatar: String,
firstName: String,
lastName: String,
email: String,
phoneNumber: String,
addresses: <Address>[],
defaultAddress: Address,
isFirstLogging: bool
```

#### Category
```
id: String,
name: String,
thumbnail: String,
parent: String,
```

#### StoreListItem
```
id: String,
name: String,
avgReview: number, // from 1 to 5
stimatedTime: String,
distance: String,
lowestPrice: number,
isFavorite: bool,
thumbnail: String,
```

#### Store
```
id: String,
banners: <String>[],
logo: String,
name: String,
```

#### StoreFilters
```
price: {
    min: number,
    max: number,
},
openHours: String, // "now-open" || "mon-fri" || "mon-sun" || "fri-sun"
others: String, // "close-me" || "most-popular"
sort: ASC || DESC
```

#### StoreProduct
```
id: String,
name: String,
thumbnail: String,
avgReview: number, // from 1 to 5
isFavorite: bool,
isCustomizable: bool,
addons: <Addon>[], // List of all possible Addons
stimatedTime: String,
```

#### Addon
```
id: String,
name: String,
price: number,
```

#### PromoBanner
```
image: String,
path: String,
```

#### Coupon
```
code: String,
image: String,
description: String,
```

#### RaudoPaymentAccount
```
id: String,
title: String,
description: String,
```

#### Cart
```
products: <CartProduct>[],
deliveryCost: number,
discount: number,
tip: number,
tax: number
subtotal: number,
total: number,
```

#### CartProduct
```
id: String,
name: String,
thumbnail: String,
addons: <Addon>[] // List of Addons selected by the user
price: number,
qty: number,
```

#### OrderListItem
```
id: String,
description: String,
date: String,
currentStep: number,
totalStep: number,
currentStepDescription: String,
price: number,
rauderId: String,
```

#### OrderStatus
```
arrivalTime: String,
currentStepTitle: String,
steps: <Step>[],
```

#### Step
```
time: String,
title: String,
description: String,
```

#### ChatMessage
```
userId: String,
content: String,
time: String,
avatar: String,
```

### Por definir:

#### Order
Para la vista de single de orden aun no definida a nivel de UI.

#### Notification
Se necesita saber como funcionaran las notificaciones a nivel de UI.

#### FavProduct
Se necesita definir si se necesita este modelo o no, dependere de si es necesario tener la fecha en la que se agrego el producto a favoritos o no.

## Operaciones CRUD
* Las estructura de las respuestas no son un modelo a seguir solo indican que datos son necesarios en las mismas.
* No estan considerados los datos necesarios para la paginacion.
* No se considero que sera un *urlParam* o *bodyParam*.

### Home

#### Obtener *banners promocionales*
params: streetAddress,

json response:
```
{
    data: <PromoBanner>[]
}
```

### Category List

#### Obtener *categorias*
params: streetAddress,

json response:
```
{
    data: <Category>[]
}
```

### Subcategory List

#### Obtener *Subcategorias*
params: streetAddress, categoryId

json response:
```
{
    data: <Category>[]
}
```

### Store List

#### Obtener *tiendas*
params: streetAddress, subcategoryId, storeFilters

json response:
```
{
    data: <StoreListItem>[]
}
```

#### Agregar *tienda a favoritos*
params: storeId

json response:
```
{
    status: number
}
```

### Store Single

#### Obtener *tienda*
params: storeId

json response:
```
{
    data: Store
}
```

#### Obtener *productos*
params: storeId

json response:
```
{
    data: <StoreProduct>[]
}
```

#### Agregar *producto al carrito*
params: productId, qty, addonIds

json response:
```
{
    status: number
}
```

#### Agregar *Agregar a favoritos*
params: productId

json response:
```
{
    status: number
}
```

### Search Page

#### Realizar *busqueda*
params: streetAddress, query

json response:
```
{
    data: {
        stores: <StoreListItem>[],
        produtcs: <StoreProduct>[]
    }
}
```

#### Agregar *producto al carrito (repetido)*

### Cart

#### Obtener *carrito*
params: NONE

json response:
```
{
    data: Cart,
}
```

#### Eliminar *producto del carrito*
params: reference

json response:
```
{
    status: number
}
```

#### Actualizar *cantidad de producto en carrito*
params: reference, newQty

json response:
```
{
    status: number
}
```

#### Procesar *orden*
params: streetAddress, beDeliveredAt, tip, paymentMethod, contactPhone, paymentProof

json response:
```
{
    status: number
}
```

### MyOrders

#### Obtener *ordenes*
params: type (active || completed)

json response:
```
{
    data: <orderListItem>[]
}
```

### Order Timeline

#### Obtener *timeline*
params: orderId,

json response:
```
{
    data: {
        stimatedTime: String,
        steps: <Step>[],
        geoTrackingId: String,
        chatId: String,
    }
}
```

### Order Single

#### Obtener *datos de orden*
params: orderId,

json response:
```
{
    data: {
        order: Order,
        chatId: String,
    }
}
```

### Re-order

#### Obtener *orden antigua*
params: orderId

json response:
```
{
    data: {
        date: String,
        cart: Cart,
    }
}
```
#### Agregar *producto al carrito (repetido)*

### Chat Page

#### Obtener *chat*
params: chatId

json response:
```
{
    data: {
        messages: <ChatMessage>[],
        disabled: bool,
    }
}
```

#### Enviar *mensaje*
params: chatId, message

json response:
```
{
    status: number,
}
```

### Payment Methods Page

#### Obtener *metodos de pago*
params: NONE

json response:
```
{
    data: <RaudoPaymentAccount>[]
}
```

### My Addresses Page

#### Crear *direccion*
params: description, streetAddress, type

json response:
```
{
    status: number
}
```

#### Editar *direccion*
params: addressId, description, streetAddress, type

json response:
```
{
    status: number
}
```

#### Borrar *direccion*
params: addressId

json response:
```
{
    status: number
}
```

#### Obtener *usuario*
params: NONE

json response:
```
{
    data: User
}
```

### Promos Page
#### Obtener *cupones*
params: NONE

json response:
```
{
    data: <PromoCoupon>[]
}
```

#### Aplicar *cupon*
params: couponCode,

json response:
```
{
    status: number
}
```

### User Settings
#### Obtener *usuario (repetido)*

#### Actualizar *usuario*
params: firstName, lastName, email, phoneNumber, imageBase64

json response:
```
{
    status: number
}
```
