flit-models 2.1.14 → 2.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -56,7 +56,7 @@ var Lancamento = /** @class */ (function () {
|
|
|
56
56
|
*/
|
|
57
57
|
function Lancamento(lancamentoPayload) {
|
|
58
58
|
var _this = this;
|
|
59
|
-
var keysOfProps = ["data_criacao", "status", "_id", "_path", "descricao", "excluido", "data_inicial", "data_final", "todos_colaboradores", "periodos", "data_atualizacao", "data_intervalo", "acao_tipo", "
|
|
59
|
+
var keysOfProps = ["data_criacao", "status", "_id", "_path", "descricao", "excluido", "data_inicial", "data_final", "ocorrencia", "todos_colaboradores", "periodos", "data_atualizacao", "data_intervalo", "acao_tipo", "empresa"];
|
|
60
60
|
keysOfProps.forEach(function (key) {
|
|
61
61
|
_this[key] = lancamentoPayload
|
|
62
62
|
? lancamentoPayload[key]
|
|
@@ -38,13 +38,15 @@ var LancamentoFireConvert = /** @class */ (function () {
|
|
|
38
38
|
razao: string_helper_1.StringHelper.trim(doc.get('empresa.razao'), null),
|
|
39
39
|
path: string_helper_1.StringHelper.trim((_c = doc.ref) === null || _c === void 0 ? void 0 : _c.path, null),
|
|
40
40
|
},
|
|
41
|
-
ocorrencia:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
ocorrencia: doc.get('ocorrencia')
|
|
42
|
+
? {
|
|
43
|
+
descricao: string_helper_1.StringHelper.trim(doc.get('ocorrencia.descricao'), null),
|
|
44
|
+
path: string_helper_1.StringHelper.trim(doc.get('ocorrencia.path'), null),
|
|
45
|
+
tipo: string_helper_1.StringHelper.trim(doc.get('ocorrencia.tipo'), null),
|
|
46
|
+
}
|
|
47
|
+
: null,
|
|
46
48
|
todos_colaboradores: boolean_helper_1.BooleanHelper.check(doc.get('todos_colaboradores'), true),
|
|
47
|
-
periodos: (_d = doc.get('periodos'))
|
|
49
|
+
periodos: ((_d = doc.get('periodos')) === null || _d === void 0 ? void 0 : _d.length) ? doc.get('periodos') : null,
|
|
48
50
|
data_atualizacao: (0, type_guards_1.TipoTimestampFirestore)(doc.get('data_atualizacao'))
|
|
49
51
|
? doc.get('data_atualizacao').toDate()
|
|
50
52
|
: null,
|
|
@@ -55,6 +57,7 @@ var LancamentoFireConvert = /** @class */ (function () {
|
|
|
55
57
|
});
|
|
56
58
|
};
|
|
57
59
|
LancamentoFireConvert.toFirestore = function (lancamento, documentReferenceFromPath, timestampfromDate) {
|
|
60
|
+
var _a;
|
|
58
61
|
var lancamentoFire = {
|
|
59
62
|
data_inicial: timestampfromDate
|
|
60
63
|
? timestampfromDate(lancamento.data_inicial)
|
|
@@ -73,13 +76,15 @@ var LancamentoFireConvert = /** @class */ (function () {
|
|
|
73
76
|
fantasia: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
|
|
74
77
|
razao: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
|
|
75
78
|
},
|
|
76
|
-
ocorrencia:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
ocorrencia: lancamento.ocorrencia
|
|
80
|
+
? {
|
|
81
|
+
ref: documentReferenceFromPath(lancamento.ocorrencia.path),
|
|
82
|
+
descricao: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
|
|
83
|
+
tipo: string_helper_1.StringHelper.trim(lancamento.acao_tipo, null),
|
|
84
|
+
}
|
|
85
|
+
: null,
|
|
81
86
|
todos_colaboradores: boolean_helper_1.BooleanHelper.check(lancamento.todos_colaboradores, true),
|
|
82
|
-
periodos: lancamento.periodos,
|
|
87
|
+
periodos: ((_a = lancamento.periodos) === null || _a === void 0 ? void 0 : _a.length) ? lancamento.periodos : null,
|
|
83
88
|
data_atualizacao: timestampfromDate
|
|
84
89
|
? timestampfromDate(lancamento.data_atualizacao)
|
|
85
90
|
: firestore_1.Timestamp.fromDate(lancamento.data_atualizacao),
|
|
@@ -17,7 +17,7 @@ var LancamentoJsonConvert = /** @class */ (function () {
|
|
|
17
17
|
function LancamentoJsonConvert() {
|
|
18
18
|
}
|
|
19
19
|
LancamentoJsonConvert.fromJson = function (obj) {
|
|
20
|
-
var _a, _b
|
|
20
|
+
var _a, _b;
|
|
21
21
|
return new _1.Lancamento({
|
|
22
22
|
_id: (_a = obj._id) !== null && _a !== void 0 ? _a : null,
|
|
23
23
|
_path: (_b = obj._path) !== null && _b !== void 0 ? _b : null,
|
|
@@ -33,20 +33,22 @@ var LancamentoJsonConvert = /** @class */ (function () {
|
|
|
33
33
|
razao: string_helper_1.StringHelper.trim(obj.empresa.razao, null),
|
|
34
34
|
path: string_helper_1.StringHelper.trim(obj.empresa.path, null),
|
|
35
35
|
},
|
|
36
|
-
ocorrencia:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
ocorrencia: obj.ocorrencia
|
|
37
|
+
? {
|
|
38
|
+
descricao: string_helper_1.StringHelper.trim(obj.ocorrencia.descricao, null),
|
|
39
|
+
path: string_helper_1.StringHelper.trim(obj.ocorrencia.path, null),
|
|
40
|
+
tipo: string_helper_1.StringHelper.trim(obj.ocorrencia.tipo, null),
|
|
41
|
+
}
|
|
42
|
+
: null,
|
|
41
43
|
todos_colaboradores: boolean_helper_1.BooleanHelper.check(obj.excluido, true),
|
|
42
|
-
periodos:
|
|
44
|
+
periodos: obj.periodos.length ? obj.periodos : null,
|
|
43
45
|
data_atualizacao: date_helper_1.DateHelper.fromString(obj.data_atualizacao, null),
|
|
44
46
|
data_criacao: date_helper_1.DateHelper.fromString(obj.data_criacao, null),
|
|
45
47
|
data_intervalo: array_helpers_1.ArrayHelper.checkStringArray(obj.data_intervalo, null),
|
|
46
48
|
});
|
|
47
49
|
};
|
|
48
50
|
LancamentoJsonConvert.toJson = function (lancamento) {
|
|
49
|
-
var _a, _b, _c, _d
|
|
51
|
+
var _a, _b, _c, _d;
|
|
50
52
|
var lancamentoJson = {
|
|
51
53
|
_id: (_a = lancamento._id) !== null && _a !== void 0 ? _a : null,
|
|
52
54
|
_path: (_b = lancamento._path) !== null && _b !== void 0 ? _b : null,
|
|
@@ -62,15 +64,17 @@ var LancamentoJsonConvert = /** @class */ (function () {
|
|
|
62
64
|
razao: string_helper_1.StringHelper.trim(lancamento.empresa.razao, null),
|
|
63
65
|
path: string_helper_1.StringHelper.trim(lancamento.empresa.path, null),
|
|
64
66
|
},
|
|
65
|
-
ocorrencia:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
ocorrencia: lancamento.ocorrencia
|
|
68
|
+
? {
|
|
69
|
+
descricao: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
|
|
70
|
+
path: string_helper_1.StringHelper.trim(lancamento.ocorrencia.path, null),
|
|
71
|
+
tipo: string_helper_1.StringHelper.trim(lancamento.ocorrencia.tipo, null),
|
|
72
|
+
}
|
|
73
|
+
: null,
|
|
70
74
|
todos_colaboradores: boolean_helper_1.BooleanHelper.check(lancamento.todos_colaboradores, false),
|
|
71
|
-
periodos:
|
|
72
|
-
data_criacao: (
|
|
73
|
-
data_atualizacao: (
|
|
75
|
+
periodos: lancamento.periodos.length ? lancamento.periodos : null,
|
|
76
|
+
data_criacao: (_c = lancamento.data_criacao) === null || _c === void 0 ? void 0 : _c.toISOString(),
|
|
77
|
+
data_atualizacao: (_d = lancamento.data_atualizacao) === null || _d === void 0 ? void 0 : _d.toISOString(),
|
|
74
78
|
data_intervalo: array_helpers_1.ArrayHelper.checkStringArray(lancamento.data_intervalo, null),
|
|
75
79
|
};
|
|
76
80
|
return (0, lodash_1.omitBy)(lancamentoJson, lodash_1.isUndefined);
|