Skip to content

Commit

Permalink
style(entities): enforce naming convention for all interfaces (ITypeN…
Browse files Browse the repository at this point in the history
…ame)
  • Loading branch information
vitorsanc-beuni committed Oct 19, 2021
1 parent 54a3a79 commit ed37024
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/core/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AxiosInstance } from 'axios'
import * as qs from 'querystring'
import * as xml2js from 'xml2js'

export interface BlingBaseResponse<T> {
export interface IBlingBaseResponse<T> {
retorno: T
}

Expand Down
28 changes: 14 additions & 14 deletions src/entities/orders.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable camelcase */
import BlingEntity, { BlingBaseResponse } from '../core/entity'
import { AxiosInstance } from 'axios'
import BlingEntity, { IBlingBaseResponse } from '../core/entity'
import { AxiosInstance as IAxiosInstance } from 'axios'

export interface Order {
export interface IOrder {
data?: Date
data_saida?: Date
data_prevista?: Date
Expand Down Expand Up @@ -88,34 +88,34 @@ export interface Order {
}
}

export interface OrderInfos {
export interface IOrderInfos {
historico: 'true' | 'false'
}

export interface OrderFilters {
export interface IOrderFilters {
dataEmissao: string
dataAlteracao: string
dataPrevista: string
idSituacao: string
idContato: string
}

export interface OrderResponse {
export interface IOrderResponse {
pedidos: {
pedido: Order
pedido: IOrder
}[]
}

export interface OrderError {}
export interface IOrderError {}

export default class Orders extends BlingEntity<
Order,
OrderFilters,
OrderInfos,
BlingBaseResponse<OrderResponse>,
OrderError
IOrder,
IOrderFilters,
IOrderInfos,
IBlingBaseResponse<IOrderResponse>,
IOrderError
> {
constructor (api: AxiosInstance) {
constructor (api: IAxiosInstance) {
super(api)

this.singularName = 'pedido'
Expand Down
30 changes: 15 additions & 15 deletions src/entities/products.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable camelcase */
import BlingEntity, { BlingBaseResponse } from '../core/entity'
import { AxiosInstance } from 'axios'
import BlingEntity, { IBlingBaseResponse } from '../core/entity'
import { AxiosInstance as IAxiosInstance } from 'axios'

export interface Product {
export interface IProduct {
codigo?: string
codigoItem?: '06' | '21' | '22'
descricao: string
Expand Down Expand Up @@ -89,13 +89,13 @@ export interface Product {
}
}

export interface ProductInfos {
export interface IProductInfos {
estoque?: 'S'
loja?: string
imagem?: 'S'
}

export interface ProductFilters {
export interface IProductFilters {
dataInclusao?: string
dataAlteracao?: string
dataAlteracaoLoja?: string
Expand All @@ -104,13 +104,13 @@ export interface ProductFilters {
situacao?: 'A' | 'I'
}

export interface ProductResponse {
export interface IProductResponse {
produtos: {
produto: Product
produto: IProduct
}[]
}

export interface ProductError {
export interface IProductError {
code:
| '40'
| '41'
Expand All @@ -128,13 +128,13 @@ export interface ProductError {
}

export default class Products extends BlingEntity<
Product,
ProductFilters,
ProductInfos,
BlingBaseResponse<ProductResponse>,
ProductError
IProduct,
IProductFilters,
IProductInfos,
IBlingBaseResponse<IProductResponse>,
IProductError
> {
constructor (api: AxiosInstance) {
constructor (api: IAxiosInstance) {
super(api)

this.singularName = 'produto'
Expand All @@ -144,7 +144,7 @@ export default class Products extends BlingEntity<
async findBySupplierCode (
code: string,
supplierId: number,
params: ProductInfos
params: IProductInfos
) {
return await this._getOne(String(supplierId), `produto/${code}`, params)
}
Expand Down

0 comments on commit ed37024

Please sign in to comment.