flit-models 2.1.46 → 3.0.0
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.
- package/lib/models/contas/cargo/cargo-fire-convert.d.ts +13 -0
- package/lib/models/contas/cargo/cargo-fire-convert.js +42 -0
- package/lib/models/contas/cargo/index.d.ts +29 -0
- package/lib/models/contas/cargo/index.js +43 -0
- package/lib/models/contas/departamento/departamento-fire-convert.d.ts +12 -0
- package/lib/models/contas/departamento/departamento-fire-convert.js +40 -0
- package/lib/models/contas/departamento/index.d.ts +27 -0
- package/lib/models/contas/departamento/index.js +43 -0
- package/lib/models/contas/escala/escala-fire-convert.d.ts +31 -0
- package/lib/models/contas/escala/escala-fire-convert.js +84 -0
- package/lib/models/contas/escala/index.d.ts +65 -0
- package/lib/models/contas/escala/index.js +43 -0
- package/lib/models/contas/excecoes.d.ts +21 -21
- package/lib/models/contas/feriado/empresa-feriado-fire-convert.d.ts +4 -4
- package/lib/models/contas/feriado/empresa-feriado-fire-convert.js +3 -2
- package/lib/models/contas/feriado/empresa-feriado.js +1 -1
- package/lib/models/contas/feriado/feriado-fire-convert.d.ts +4 -4
- package/lib/models/contas/feriado/feriado-fire-convert.js +3 -5
- package/lib/models/contas/lancamento/index.d.ts +8 -0
- package/lib/models/contas/lancamento/index.js +1 -1
- package/lib/models/contas/lancamento/lancamento-fire-convert.d.ts +12 -8
- package/lib/models/contas/lancamento/lancamento-fire-convert.js +23 -50
- package/lib/models/contas/lancamento/lancamento-json-convert.d.ts +4 -0
- package/lib/models/contas/lancamento/lancamento-json-convert.js +6 -0
- package/lib/models/contas/lancamento/verificacoes/verificacao-lancamento-fire-convert.d.ts +7 -7
- package/lib/models/contas/lancamento/verificacoes/verificacao-lancamento-fire-convert.js +8 -6
- package/lib/models/utils/type-guards.d.ts +4 -4
- package/lib/models/utils/type-guards.js +4 -4
- package/lib/shared/flitCalcularJornadaDependencyInjection.d.ts +22 -0
- package/lib/shared/flitCalcularJornadaDependencyInjection.js +61 -0
- package/lib/shared/flitModelsDependencyInjection.d.ts +24 -0
- package/lib/shared/flitModelsDependencyInjection.js +61 -0
- package/package.json +9 -8
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Cargo, CargoBase } from '.';
|
|
2
|
+
import { FirebaseDocumentSnapshotGeneric, FirebaseTimestampGeneric } from '../../../shared/flitModelsDependencyInjection';
|
|
3
|
+
export declare class CargoFirestoreData implements CargoBase {
|
|
4
|
+
cbo: string;
|
|
5
|
+
data_atualizacao_doc: FirebaseTimestampGeneric;
|
|
6
|
+
data_criacao_doc: FirebaseTimestampGeneric;
|
|
7
|
+
excluido: boolean;
|
|
8
|
+
nome: string;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class CargoFireConvert {
|
|
11
|
+
static fromFirestore(doc: FirebaseDocumentSnapshotGeneric | FirebaseDocumentSnapshotGeneric): Cargo;
|
|
12
|
+
static toFirestore(cargo: Cargo): Partial<CargoFirestoreData>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CargoFireConvert = exports.CargoFirestoreData = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var _1 = require(".");
|
|
6
|
+
var flitModelsDependencyInjection_1 = require("../../../shared/flitModelsDependencyInjection");
|
|
7
|
+
var CargoFirestoreData = /** @class */ (function () {
|
|
8
|
+
function CargoFirestoreData() {
|
|
9
|
+
}
|
|
10
|
+
return CargoFirestoreData;
|
|
11
|
+
}());
|
|
12
|
+
exports.CargoFirestoreData = CargoFirestoreData;
|
|
13
|
+
var CargoFireConvert = /** @class */ (function () {
|
|
14
|
+
function CargoFireConvert() {
|
|
15
|
+
}
|
|
16
|
+
CargoFireConvert.fromFirestore = function (doc) {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
18
|
+
var docData = ((_a = doc.data()) !== null && _a !== void 0 ? _a : {});
|
|
19
|
+
return new _1.Cargo({
|
|
20
|
+
_id: (_b = doc.id) !== null && _b !== void 0 ? _b : null,
|
|
21
|
+
_path: (_c = doc.ref.path) !== null && _c !== void 0 ? _c : null,
|
|
22
|
+
cbo: (_d = docData.cbo) !== null && _d !== void 0 ? _d : null,
|
|
23
|
+
data_atualizacao_doc: (_f = (_e = docData.data_atualizacao_doc) === null || _e === void 0 ? void 0 : _e.toDate()) !== null && _f !== void 0 ? _f : null,
|
|
24
|
+
data_criacao_doc: (_h = (_g = docData.data_criacao_doc) === null || _g === void 0 ? void 0 : _g.toDate()) !== null && _h !== void 0 ? _h : null,
|
|
25
|
+
excluido: (_j = docData.excluido) !== null && _j !== void 0 ? _j : false,
|
|
26
|
+
nome: (_k = docData.nome) !== null && _k !== void 0 ? _k : null,
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
CargoFireConvert.toFirestore = function (cargo) {
|
|
30
|
+
var _a, _b, _c, _d, _e;
|
|
31
|
+
var cargoFire = {
|
|
32
|
+
cbo: (_a = cargo.cbo) !== null && _a !== void 0 ? _a : null,
|
|
33
|
+
data_atualizacao_doc: (_b = flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(cargo.data_atualizacao_doc)) !== null && _b !== void 0 ? _b : null,
|
|
34
|
+
data_criacao_doc: (_c = flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(cargo.data_criacao_doc)) !== null && _c !== void 0 ? _c : null,
|
|
35
|
+
excluido: (_d = cargo.excluido) !== null && _d !== void 0 ? _d : false,
|
|
36
|
+
nome: (_e = cargo.nome) !== null && _e !== void 0 ? _e : null,
|
|
37
|
+
};
|
|
38
|
+
return (0, lodash_1.omitBy)(cargoFire, lodash_1.isUndefined);
|
|
39
|
+
};
|
|
40
|
+
return CargoFireConvert;
|
|
41
|
+
}());
|
|
42
|
+
exports.CargoFireConvert = CargoFireConvert;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from './cargo-fire-convert';
|
|
2
|
+
export interface CargoBase {
|
|
3
|
+
cbo: string;
|
|
4
|
+
data_atualizacao_doc: any;
|
|
5
|
+
data_criacao_doc: any;
|
|
6
|
+
excluido: boolean;
|
|
7
|
+
nome: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Internal class col contas/${contaId}/cargo/${cargoId}.
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @class Lancamento
|
|
14
|
+
*/
|
|
15
|
+
export declare class Cargo implements CargoBase {
|
|
16
|
+
_id: string;
|
|
17
|
+
_path: string;
|
|
18
|
+
cbo: string;
|
|
19
|
+
data_atualizacao_doc: Date;
|
|
20
|
+
data_criacao_doc: Date;
|
|
21
|
+
excluido: boolean;
|
|
22
|
+
nome: string;
|
|
23
|
+
/**
|
|
24
|
+
* Creates an instance of Lancamento.
|
|
25
|
+
* @param {Partial<Lancamento>} lancamentoPayload
|
|
26
|
+
* @memberof Lancamento
|
|
27
|
+
*/
|
|
28
|
+
constructor(lancamentoPayload: Partial<Cargo>);
|
|
29
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Cargo = void 0;
|
|
18
|
+
__exportStar(require("./cargo-fire-convert"), exports);
|
|
19
|
+
/**
|
|
20
|
+
* Internal class col contas/${contaId}/cargo/${cargoId}.
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @class Lancamento
|
|
24
|
+
*/
|
|
25
|
+
var Cargo = /** @class */ (function () {
|
|
26
|
+
// #endregion
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of Lancamento.
|
|
29
|
+
* @param {Partial<Lancamento>} lancamentoPayload
|
|
30
|
+
* @memberof Lancamento
|
|
31
|
+
*/
|
|
32
|
+
function Cargo(lancamentoPayload) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
var keysOfProps = ["_id", "_path", "nome", "excluido", "cbo", "data_atualizacao_doc", "data_criacao_doc"];
|
|
35
|
+
keysOfProps.forEach(function (key) {
|
|
36
|
+
_this[key] = lancamentoPayload
|
|
37
|
+
? lancamentoPayload[key]
|
|
38
|
+
: undefined;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return Cargo;
|
|
42
|
+
}());
|
|
43
|
+
exports.Cargo = Cargo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Departamento, DepartamentoBase } from '.';
|
|
2
|
+
import { FirebaseDocumentSnapshotGeneric, FirebaseQueryDocumentSnapshotGeneric, FirebaseTimestampGeneric } from '../../../shared/flitModelsDependencyInjection';
|
|
3
|
+
export declare class DepartamentoFirestoreData implements DepartamentoBase {
|
|
4
|
+
data_atualizacao_doc: FirebaseTimestampGeneric;
|
|
5
|
+
data_criacao_doc: FirebaseTimestampGeneric;
|
|
6
|
+
descricao: string;
|
|
7
|
+
excluido: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class DepartamentoFireConvert {
|
|
10
|
+
static fromFirestore(doc: FirebaseDocumentSnapshotGeneric | FirebaseQueryDocumentSnapshotGeneric): Departamento;
|
|
11
|
+
static toFirestore(departamento: Departamento): Partial<DepartamentoFirestoreData>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DepartamentoFireConvert = exports.DepartamentoFirestoreData = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var _1 = require(".");
|
|
6
|
+
var flitModelsDependencyInjection_1 = require("../../../shared/flitModelsDependencyInjection");
|
|
7
|
+
var DepartamentoFirestoreData = /** @class */ (function () {
|
|
8
|
+
function DepartamentoFirestoreData() {
|
|
9
|
+
}
|
|
10
|
+
return DepartamentoFirestoreData;
|
|
11
|
+
}());
|
|
12
|
+
exports.DepartamentoFirestoreData = DepartamentoFirestoreData;
|
|
13
|
+
var DepartamentoFireConvert = /** @class */ (function () {
|
|
14
|
+
function DepartamentoFireConvert() {
|
|
15
|
+
}
|
|
16
|
+
DepartamentoFireConvert.fromFirestore = function (doc) {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
18
|
+
var docData = ((_a = doc.data()) !== null && _a !== void 0 ? _a : {});
|
|
19
|
+
return new _1.Departamento({
|
|
20
|
+
_id: (_b = doc.id) !== null && _b !== void 0 ? _b : null,
|
|
21
|
+
_path: (_c = doc.ref.path) !== null && _c !== void 0 ? _c : null,
|
|
22
|
+
data_atualizacao_doc: (_e = (_d = docData.data_atualizacao_doc) === null || _d === void 0 ? void 0 : _d.toDate()) !== null && _e !== void 0 ? _e : null,
|
|
23
|
+
data_criacao_doc: (_g = (_f = docData.data_criacao_doc) === null || _f === void 0 ? void 0 : _f.toDate()) !== null && _g !== void 0 ? _g : null,
|
|
24
|
+
descricao: (_h = docData.descricao) !== null && _h !== void 0 ? _h : null,
|
|
25
|
+
excluido: (_j = docData.excluido) !== null && _j !== void 0 ? _j : false,
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
DepartamentoFireConvert.toFirestore = function (departamento) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
var departamentoFire = {
|
|
31
|
+
data_atualizacao_doc: (_a = flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(departamento.data_atualizacao_doc)) !== null && _a !== void 0 ? _a : null,
|
|
32
|
+
data_criacao_doc: (_b = flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(departamento.data_criacao_doc)) !== null && _b !== void 0 ? _b : null,
|
|
33
|
+
descricao: (_c = departamento.descricao) !== null && _c !== void 0 ? _c : null,
|
|
34
|
+
excluido: (_d = departamento.excluido) !== null && _d !== void 0 ? _d : false,
|
|
35
|
+
};
|
|
36
|
+
return (0, lodash_1.omitBy)(departamentoFire, lodash_1.isUndefined);
|
|
37
|
+
};
|
|
38
|
+
return DepartamentoFireConvert;
|
|
39
|
+
}());
|
|
40
|
+
exports.DepartamentoFireConvert = DepartamentoFireConvert;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from './departamento-fire-convert';
|
|
2
|
+
export interface DepartamentoBase {
|
|
3
|
+
data_atualizacao_doc: any;
|
|
4
|
+
data_criacao_doc: any;
|
|
5
|
+
descricao: string;
|
|
6
|
+
excluido: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Internal class col contas/${contaId}/cargo/${cargoId}.
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
* @class Lancamento
|
|
13
|
+
*/
|
|
14
|
+
export declare class Departamento implements DepartamentoBase {
|
|
15
|
+
_id: string;
|
|
16
|
+
_path: string;
|
|
17
|
+
data_atualizacao_doc: Date;
|
|
18
|
+
data_criacao_doc: Date;
|
|
19
|
+
descricao: string;
|
|
20
|
+
excluido: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of Lancamento.
|
|
23
|
+
* @param {Partial<Lancamento>} lancamentoPayload
|
|
24
|
+
* @memberof Lancamento
|
|
25
|
+
*/
|
|
26
|
+
constructor(lancamentoPayload: Partial<Departamento>);
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Departamento = void 0;
|
|
18
|
+
__exportStar(require("./departamento-fire-convert"), exports);
|
|
19
|
+
/**
|
|
20
|
+
* Internal class col contas/${contaId}/cargo/${cargoId}.
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @class Lancamento
|
|
24
|
+
*/
|
|
25
|
+
var Departamento = /** @class */ (function () {
|
|
26
|
+
// #endregion
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of Lancamento.
|
|
29
|
+
* @param {Partial<Lancamento>} lancamentoPayload
|
|
30
|
+
* @memberof Lancamento
|
|
31
|
+
*/
|
|
32
|
+
function Departamento(lancamentoPayload) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
var keysOfProps = ["_id", "_path", "descricao", "excluido", "data_atualizacao_doc", "data_criacao_doc"];
|
|
35
|
+
keysOfProps.forEach(function (key) {
|
|
36
|
+
_this[key] = lancamentoPayload
|
|
37
|
+
? lancamentoPayload[key]
|
|
38
|
+
: undefined;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return Departamento;
|
|
42
|
+
}());
|
|
43
|
+
exports.Departamento = Departamento;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Escala, EscalaBase } from '.';
|
|
2
|
+
import { FirebaseDocumentReferenceGeneric, FirebaseDocumentSnapshotGeneric, FirebaseQueryDocumentSnapshotGeneric, FirebaseTimestampGeneric } from '../../../shared/flitModelsDependencyInjection';
|
|
3
|
+
export declare class EscalaFirestoreData implements EscalaBase {
|
|
4
|
+
data_atualizacao_doc: FirebaseTimestampGeneric;
|
|
5
|
+
data_criacao_doc: FirebaseTimestampGeneric;
|
|
6
|
+
data_inicial: FirebaseTimestampGeneric;
|
|
7
|
+
descricao: string;
|
|
8
|
+
excluido: boolean;
|
|
9
|
+
jornadas: {
|
|
10
|
+
repetir: number;
|
|
11
|
+
ocorrencia_frequencia_ref: FirebaseDocumentReferenceGeneric;
|
|
12
|
+
periodos: {
|
|
13
|
+
entrada: {
|
|
14
|
+
data_relativa: FirebaseTimestampGeneric;
|
|
15
|
+
hora: string;
|
|
16
|
+
timezone_value: string;
|
|
17
|
+
};
|
|
18
|
+
saida: {
|
|
19
|
+
data_relativa: FirebaseTimestampGeneric;
|
|
20
|
+
hora: string;
|
|
21
|
+
timezone_value: string;
|
|
22
|
+
};
|
|
23
|
+
duracao: string;
|
|
24
|
+
descanso: string;
|
|
25
|
+
}[];
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
export declare abstract class EscalaFireConvert {
|
|
29
|
+
static fromFirestore(doc: FirebaseDocumentSnapshotGeneric | FirebaseQueryDocumentSnapshotGeneric): Escala;
|
|
30
|
+
static toFirestore(escala: Escala): Partial<EscalaFirestoreData>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EscalaFireConvert = exports.EscalaFirestoreData = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var _1 = require(".");
|
|
6
|
+
var flitModelsDependencyInjection_1 = require("../../../shared/flitModelsDependencyInjection");
|
|
7
|
+
var EscalaFirestoreData = /** @class */ (function () {
|
|
8
|
+
function EscalaFirestoreData() {
|
|
9
|
+
}
|
|
10
|
+
return EscalaFirestoreData;
|
|
11
|
+
}());
|
|
12
|
+
exports.EscalaFirestoreData = EscalaFirestoreData;
|
|
13
|
+
var EscalaFireConvert = /** @class */ (function () {
|
|
14
|
+
function EscalaFireConvert() {
|
|
15
|
+
}
|
|
16
|
+
EscalaFireConvert.fromFirestore = function (doc) {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
18
|
+
var docData = ((_a = doc.data()) !== null && _a !== void 0 ? _a : {});
|
|
19
|
+
return new _1.Escala({
|
|
20
|
+
_id: (_b = doc.id) !== null && _b !== void 0 ? _b : null,
|
|
21
|
+
_path: (_c = doc.ref.path) !== null && _c !== void 0 ? _c : null,
|
|
22
|
+
data_atualizacao_doc: ((_d = docData.data_atualizacao_doc) === null || _d === void 0 ? void 0 : _d.toDate()) || null,
|
|
23
|
+
data_criacao_doc: ((_e = docData.data_criacao_doc) === null || _e === void 0 ? void 0 : _e.toDate()) || null,
|
|
24
|
+
data_inicial: ((_f = docData.data_inicial) === null || _f === void 0 ? void 0 : _f.toDate()) || null,
|
|
25
|
+
descricao: (_g = docData.descricao) !== null && _g !== void 0 ? _g : null,
|
|
26
|
+
excluido: (_h = docData.excluido) !== null && _h !== void 0 ? _h : false,
|
|
27
|
+
jornadas: docData.jornadas.map(function (jornada) {
|
|
28
|
+
var _a;
|
|
29
|
+
return ({
|
|
30
|
+
ocorrencia_frequencia_ref: ((_a = jornada.ocorrencia_frequencia_ref) === null || _a === void 0 ? void 0 : _a.path) || null,
|
|
31
|
+
periodos: jornada.periodos.map(function (periodo) {
|
|
32
|
+
var _a;
|
|
33
|
+
return ({
|
|
34
|
+
entrada: {
|
|
35
|
+
data_relativa: ((_a = periodo.entrada.data_relativa) === null || _a === void 0 ? void 0 : _a.toDate()) || null,
|
|
36
|
+
hora: periodo.entrada.hora,
|
|
37
|
+
timezone_value: periodo.entrada.timezone_value,
|
|
38
|
+
},
|
|
39
|
+
saida: {
|
|
40
|
+
data_relativa: periodo.saida.data_relativa.toDate() || null,
|
|
41
|
+
hora: periodo.saida.hora,
|
|
42
|
+
timezone_value: periodo.saida.timezone_value,
|
|
43
|
+
},
|
|
44
|
+
duracao: periodo.duracao,
|
|
45
|
+
descanso: periodo.descanso,
|
|
46
|
+
});
|
|
47
|
+
}),
|
|
48
|
+
repetir: jornada.repetir,
|
|
49
|
+
});
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
EscalaFireConvert.toFirestore = function (escala) {
|
|
54
|
+
var _a;
|
|
55
|
+
var escalaFire = {
|
|
56
|
+
data_atualizacao_doc: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(escala.data_atualizacao_doc),
|
|
57
|
+
data_criacao_doc: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(escala.data_criacao_doc),
|
|
58
|
+
data_inicial: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(escala.data_criacao_doc),
|
|
59
|
+
descricao: escala.descricao,
|
|
60
|
+
excluido: (_a = escala.excluido) !== null && _a !== void 0 ? _a : false,
|
|
61
|
+
jornadas: escala.jornadas.map(function (jornada) { return ({
|
|
62
|
+
ocorrencia_frequencia_ref: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.DocumentReferenceFromPath(jornada.ocorrencia_frequencia_ref) || null,
|
|
63
|
+
periodos: jornada.periodos.map(function (periodo) { return ({
|
|
64
|
+
entrada: {
|
|
65
|
+
data_relativa: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(periodo.entrada.data_relativa) || null,
|
|
66
|
+
hora: periodo.entrada.hora,
|
|
67
|
+
timezone_value: periodo.entrada.timezone_value,
|
|
68
|
+
},
|
|
69
|
+
saida: {
|
|
70
|
+
data_relativa: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(periodo.saida.data_relativa) || null,
|
|
71
|
+
hora: periodo.saida.hora,
|
|
72
|
+
timezone_value: periodo.saida.timezone_value,
|
|
73
|
+
},
|
|
74
|
+
duracao: periodo.duracao,
|
|
75
|
+
descanso: periodo.descanso,
|
|
76
|
+
}); }),
|
|
77
|
+
repetir: jornada.repetir,
|
|
78
|
+
}); }),
|
|
79
|
+
};
|
|
80
|
+
return (0, lodash_1.omitBy)(escalaFire, lodash_1.isUndefined);
|
|
81
|
+
};
|
|
82
|
+
return EscalaFireConvert;
|
|
83
|
+
}());
|
|
84
|
+
exports.EscalaFireConvert = EscalaFireConvert;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export * from './escala-fire-convert';
|
|
2
|
+
export interface EscalaBase {
|
|
3
|
+
data_atualizacao_doc: any;
|
|
4
|
+
data_criacao_doc: any;
|
|
5
|
+
data_inicial: any;
|
|
6
|
+
descricao: string;
|
|
7
|
+
excluido: boolean;
|
|
8
|
+
jornadas: {
|
|
9
|
+
repetir: number;
|
|
10
|
+
ocorrencia_frequencia_ref: any;
|
|
11
|
+
periodos: {
|
|
12
|
+
entrada: {
|
|
13
|
+
data_relativa: any;
|
|
14
|
+
hora: string;
|
|
15
|
+
timezone_value: string;
|
|
16
|
+
};
|
|
17
|
+
saida: {
|
|
18
|
+
data_relativa: any;
|
|
19
|
+
hora: string;
|
|
20
|
+
timezone_value: string;
|
|
21
|
+
};
|
|
22
|
+
duracao: string;
|
|
23
|
+
descanso: string;
|
|
24
|
+
}[];
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Internal class col contas/${contaId}/cargo/${cargoId}.
|
|
29
|
+
*
|
|
30
|
+
* @export
|
|
31
|
+
* @class Lancamento
|
|
32
|
+
*/
|
|
33
|
+
export declare class Escala implements EscalaBase {
|
|
34
|
+
_id: string;
|
|
35
|
+
_path: string;
|
|
36
|
+
data_atualizacao_doc: Date;
|
|
37
|
+
data_criacao_doc: Date;
|
|
38
|
+
data_inicial: Date;
|
|
39
|
+
descricao: string;
|
|
40
|
+
excluido: boolean;
|
|
41
|
+
jornadas: {
|
|
42
|
+
repetir: number;
|
|
43
|
+
ocorrencia_frequencia_ref: string;
|
|
44
|
+
periodos: {
|
|
45
|
+
entrada: {
|
|
46
|
+
data_relativa: Date;
|
|
47
|
+
hora: string;
|
|
48
|
+
timezone_value: string;
|
|
49
|
+
};
|
|
50
|
+
saida: {
|
|
51
|
+
data_relativa: Date;
|
|
52
|
+
hora: string;
|
|
53
|
+
timezone_value: string;
|
|
54
|
+
};
|
|
55
|
+
duracao: string;
|
|
56
|
+
descanso: string;
|
|
57
|
+
}[];
|
|
58
|
+
}[];
|
|
59
|
+
/**
|
|
60
|
+
* Creates an instance of Lancamento.
|
|
61
|
+
* @param {Partial<Lancamento>} lancamentoPayload
|
|
62
|
+
* @memberof Lancamento
|
|
63
|
+
*/
|
|
64
|
+
constructor(lancamentoPayload: Partial<Escala>);
|
|
65
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Escala = void 0;
|
|
18
|
+
__exportStar(require("./escala-fire-convert"), exports);
|
|
19
|
+
/**
|
|
20
|
+
* Internal class col contas/${contaId}/cargo/${cargoId}.
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @class Lancamento
|
|
24
|
+
*/
|
|
25
|
+
var Escala = /** @class */ (function () {
|
|
26
|
+
// #endregion
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of Lancamento.
|
|
29
|
+
* @param {Partial<Lancamento>} lancamentoPayload
|
|
30
|
+
* @memberof Lancamento
|
|
31
|
+
*/
|
|
32
|
+
function Escala(lancamentoPayload) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
var keysOfProps = ["_id", "_path", "descricao", "excluido", "data_inicial", "data_atualizacao_doc", "data_criacao_doc", "jornadas"];
|
|
35
|
+
keysOfProps.forEach(function (key) {
|
|
36
|
+
_this[key] = lancamentoPayload
|
|
37
|
+
? lancamentoPayload[key]
|
|
38
|
+
: undefined;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return Escala;
|
|
42
|
+
}());
|
|
43
|
+
exports.Escala = Escala;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FirebaseDocumentReferenceGeneric, FirebaseTimestampGeneric } from '../../shared/flitModelsDependencyInjection';
|
|
2
2
|
export declare enum EnumExcecaoTipo {
|
|
3
3
|
ATRASO = "ATRASO",
|
|
4
4
|
FALTA = "FALTA",
|
|
@@ -12,28 +12,28 @@ export declare enum EnumExcecaoStatus {
|
|
|
12
12
|
RETIFICADO = "RETIFICADO"
|
|
13
13
|
}
|
|
14
14
|
export interface IExcecao {
|
|
15
|
-
data_cancelamento?:
|
|
16
|
-
data_criacao:
|
|
17
|
-
data_lancamento_manual_horas_extras?:
|
|
18
|
-
data_parecer?:
|
|
19
|
-
data_referencia:
|
|
15
|
+
data_cancelamento?: FirebaseTimestampGeneric;
|
|
16
|
+
data_criacao: FirebaseTimestampGeneric;
|
|
17
|
+
data_lancamento_manual_horas_extras?: FirebaseTimestampGeneric;
|
|
18
|
+
data_parecer?: FirebaseTimestampGeneric;
|
|
19
|
+
data_referencia: FirebaseTimestampGeneric;
|
|
20
20
|
gestor: {
|
|
21
21
|
nome: string;
|
|
22
22
|
email: string;
|
|
23
|
-
ref:
|
|
23
|
+
ref: FirebaseDocumentReferenceGeneric;
|
|
24
24
|
};
|
|
25
25
|
observacao: string;
|
|
26
26
|
parecer?: string;
|
|
27
27
|
periodo?: {
|
|
28
|
-
inicio:
|
|
29
|
-
fim:
|
|
28
|
+
inicio: FirebaseTimestampGeneric;
|
|
29
|
+
fim: FirebaseTimestampGeneric;
|
|
30
30
|
};
|
|
31
|
-
retificacao_ref:
|
|
31
|
+
retificacao_ref: FirebaseDocumentReferenceGeneric;
|
|
32
32
|
status: EnumExcecaoStatus;
|
|
33
33
|
tempo?: number;
|
|
34
34
|
timezone: string;
|
|
35
35
|
tipo: EnumExcecaoTipo;
|
|
36
|
-
usuario_ref:
|
|
36
|
+
usuario_ref: FirebaseDocumentReferenceGeneric;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Classe construtora dos dos documento da coleção de Exceções.
|
|
@@ -46,28 +46,28 @@ export declare class Excecao implements IExcecao {
|
|
|
46
46
|
uid: string;
|
|
47
47
|
path: string;
|
|
48
48
|
usuario: any;
|
|
49
|
-
data_cancelamento?:
|
|
50
|
-
data_criacao:
|
|
51
|
-
data_lancamento_manual_horas_extras?:
|
|
52
|
-
data_parecer?:
|
|
53
|
-
data_referencia:
|
|
49
|
+
data_cancelamento?: FirebaseTimestampGeneric;
|
|
50
|
+
data_criacao: FirebaseTimestampGeneric;
|
|
51
|
+
data_lancamento_manual_horas_extras?: FirebaseTimestampGeneric;
|
|
52
|
+
data_parecer?: FirebaseTimestampGeneric;
|
|
53
|
+
data_referencia: FirebaseTimestampGeneric;
|
|
54
54
|
gestor: {
|
|
55
55
|
nome: string;
|
|
56
56
|
email: string;
|
|
57
|
-
ref:
|
|
57
|
+
ref: FirebaseDocumentReferenceGeneric;
|
|
58
58
|
};
|
|
59
59
|
observacao: string;
|
|
60
60
|
parecer?: string | undefined;
|
|
61
61
|
periodo?: {
|
|
62
|
-
inicio:
|
|
63
|
-
fim:
|
|
62
|
+
inicio: FirebaseTimestampGeneric;
|
|
63
|
+
fim: FirebaseTimestampGeneric;
|
|
64
64
|
} | undefined;
|
|
65
|
-
retificacao_ref:
|
|
65
|
+
retificacao_ref: FirebaseDocumentReferenceGeneric;
|
|
66
66
|
status: EnumExcecaoStatus;
|
|
67
67
|
tempo?: number | undefined;
|
|
68
68
|
timezone: string;
|
|
69
69
|
tipo: EnumExcecaoTipo;
|
|
70
|
-
usuario_ref:
|
|
70
|
+
usuario_ref: FirebaseDocumentReferenceGeneric;
|
|
71
71
|
/**
|
|
72
72
|
* Creates an instance of Excecao.
|
|
73
73
|
* @param {Partial<Excecao>} excecaoPayload
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FirebaseDocumentReferenceGeneric, FirebaseDocumentSnapshotGeneric, FirebaseQueryDocumentSnapshotGeneric } from '../../../shared/flitModelsDependencyInjection';
|
|
2
2
|
import { EmpresaFeriado, EmpresaFeriadoBase } from './empresa-feriado';
|
|
3
3
|
export declare class EmpresaFeriadoFirestoreData implements EmpresaFeriadoBase {
|
|
4
|
-
ref:
|
|
4
|
+
ref: FirebaseDocumentReferenceGeneric;
|
|
5
5
|
documento: string;
|
|
6
6
|
municipio: string;
|
|
7
7
|
nome: string;
|
|
8
8
|
uf: string;
|
|
9
9
|
}
|
|
10
10
|
export declare abstract class EmpresaFeriadoFireConvert {
|
|
11
|
-
static fromFirestore(doc:
|
|
12
|
-
static toFirestore(empresaFeriado: EmpresaFeriado
|
|
11
|
+
static fromFirestore(doc: FirebaseDocumentSnapshotGeneric | FirebaseQueryDocumentSnapshotGeneric): EmpresaFeriado;
|
|
12
|
+
static toFirestore(empresaFeriado: EmpresaFeriado): Partial<EmpresaFeriadoFirestoreData>;
|
|
13
13
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmpresaFeriadoFireConvert = exports.EmpresaFeriadoFirestoreData = void 0;
|
|
4
4
|
var lodash_1 = require("lodash");
|
|
5
|
+
var flitModelsDependencyInjection_1 = require("../../../shared/flitModelsDependencyInjection");
|
|
5
6
|
var string_helper_1 = require("../../utils/string-helper");
|
|
6
7
|
var type_guards_1 = require("../../utils/type-guards");
|
|
7
8
|
var empresa_feriado_1 = require("./empresa-feriado");
|
|
@@ -28,12 +29,12 @@ var EmpresaFeriadoFireConvert = /** @class */ (function () {
|
|
|
28
29
|
uf: string_helper_1.StringHelper.trim(doc.get('uf'), null),
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
|
-
EmpresaFeriadoFireConvert.toFirestore = function (empresaFeriado
|
|
32
|
+
EmpresaFeriadoFireConvert.toFirestore = function (empresaFeriado) {
|
|
32
33
|
return (0, lodash_1.omitBy)({
|
|
33
34
|
documento: empresaFeriado.documento,
|
|
34
35
|
municipio: empresaFeriado.municipio,
|
|
35
36
|
nome: empresaFeriado.nome,
|
|
36
|
-
ref:
|
|
37
|
+
ref: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.DocumentReferenceFromPath(empresaFeriado.ref),
|
|
37
38
|
uf: empresaFeriado.uf,
|
|
38
39
|
}, lodash_1.isUndefined);
|
|
39
40
|
};
|
|
@@ -16,7 +16,7 @@ var EmpresaFeriado = /** @class */ (function () {
|
|
|
16
16
|
*/
|
|
17
17
|
function EmpresaFeriado(feriadoEmpresaPayload) {
|
|
18
18
|
var _this = this;
|
|
19
|
-
var keysOfProps = ["_id", "_path", "documento", "municipio", "nome", "
|
|
19
|
+
var keysOfProps = ["ref", "_id", "_path", "documento", "municipio", "nome", "uf"];
|
|
20
20
|
keysOfProps.forEach(function (key) {
|
|
21
21
|
_this[key] = feriadoEmpresaPayload
|
|
22
22
|
? feriadoEmpresaPayload[key]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DocumentSnapshot, QueryDocumentSnapshot, Timestamp } from 'firebase/firestore';
|
|
2
1
|
import { Feriado, FeriadoBase, FeriadoTipoEnum } from '.';
|
|
2
|
+
import { FirebaseDocumentSnapshotGeneric, FirebaseQueryDocumentSnapshotGeneric, FirebaseTimestampGeneric } from '../../../shared/flitModelsDependencyInjection';
|
|
3
3
|
export declare class FeriadoFirestoreData implements FeriadoBase {
|
|
4
|
-
data:
|
|
4
|
+
data: FirebaseTimestampGeneric;
|
|
5
5
|
descricao: string;
|
|
6
6
|
excluido: boolean;
|
|
7
7
|
importacao_id: string;
|
|
@@ -11,6 +11,6 @@ export declare class FeriadoFirestoreData implements FeriadoBase {
|
|
|
11
11
|
uf: string;
|
|
12
12
|
}
|
|
13
13
|
export declare abstract class FeriadoFireConvert {
|
|
14
|
-
static fromFirestore(doc:
|
|
15
|
-
static toFirestore(feriado: Feriado
|
|
14
|
+
static fromFirestore(doc: FirebaseDocumentSnapshotGeneric | FirebaseQueryDocumentSnapshotGeneric): Feriado;
|
|
15
|
+
static toFirestore(feriado: Feriado): Partial<FeriadoFirestoreData>;
|
|
16
16
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FeriadoFireConvert = exports.FeriadoFirestoreData = void 0;
|
|
4
|
-
var firestore_1 = require("firebase/firestore");
|
|
5
4
|
var lodash_1 = require("lodash");
|
|
6
5
|
var _1 = require(".");
|
|
6
|
+
var flitModelsDependencyInjection_1 = require("../../../shared/flitModelsDependencyInjection");
|
|
7
7
|
var boolean_helper_1 = require("../../utils/boolean-helper");
|
|
8
8
|
var string_helper_1 = require("../../utils/string-helper");
|
|
9
9
|
var type_guards_1 = require("../../utils/type-guards");
|
|
@@ -33,11 +33,9 @@ var FeriadoFireConvert = /** @class */ (function () {
|
|
|
33
33
|
uf: string_helper_1.StringHelper.trim(doc.get('uf'), null),
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
|
-
FeriadoFireConvert.toFirestore = function (feriado
|
|
36
|
+
FeriadoFireConvert.toFirestore = function (feriado) {
|
|
37
37
|
return (0, lodash_1.omitBy)({
|
|
38
|
-
data:
|
|
39
|
-
? timestampfromDate(feriado.data)
|
|
40
|
-
: firestore_1.Timestamp.fromDate(feriado.data),
|
|
38
|
+
data: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(feriado.data),
|
|
41
39
|
descricao: string_helper_1.StringHelper.trim(feriado.descricao, null),
|
|
42
40
|
excluido: boolean_helper_1.BooleanHelper.check(feriado.excluido, false),
|
|
43
41
|
importacao_id: string_helper_1.StringHelper.trim(feriado.importacao_id, null),
|
|
@@ -52,6 +52,10 @@ export interface LancamentoBase {
|
|
|
52
52
|
fantasia: any;
|
|
53
53
|
documento: any;
|
|
54
54
|
};
|
|
55
|
+
integracao?: {
|
|
56
|
+
id: string;
|
|
57
|
+
tipo: string;
|
|
58
|
+
};
|
|
55
59
|
status: any;
|
|
56
60
|
todos_colaboradores: any;
|
|
57
61
|
colaboradores_ids: any[];
|
|
@@ -100,6 +104,10 @@ export declare class Lancamento implements LancamentoBase {
|
|
|
100
104
|
status: LancamentoStatusEnum;
|
|
101
105
|
todos_colaboradores: boolean;
|
|
102
106
|
colaboradores_ids: string[];
|
|
107
|
+
integracao?: {
|
|
108
|
+
id: string;
|
|
109
|
+
tipo: string;
|
|
110
|
+
};
|
|
103
111
|
/**
|
|
104
112
|
* Creates an instance of Lancamento.
|
|
105
113
|
* @param {Partial<Lancamento>} lancamentoPayload
|
|
@@ -64,7 +64,7 @@ var Lancamento = /** @class */ (function () {
|
|
|
64
64
|
*/
|
|
65
65
|
function Lancamento(lancamentoPayload) {
|
|
66
66
|
var _this = this;
|
|
67
|
-
var keysOfProps = ["status", "data_criacao", "_id", "_path", "descricao", "excluido", "data_atualizacao", "acao_tipo", "data_final", "data_inicial", "data_intervalo", "empresa", "ocorrencia", "periodos", "todos_colaboradores", "colaboradores_ids"];
|
|
67
|
+
var keysOfProps = ["status", "data_criacao", "_id", "_path", "descricao", "excluido", "data_atualizacao", "acao_tipo", "data_final", "data_inicial", "data_intervalo", "empresa", "ocorrencia", "periodos", "todos_colaboradores", "colaboradores_ids", "integracao"];
|
|
68
68
|
keysOfProps.forEach(function (key) {
|
|
69
69
|
_this[key] = lancamentoPayload
|
|
70
70
|
? lancamentoPayload[key]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, Timestamp } from 'firebase/firestore';
|
|
2
1
|
import { Lancamento, LancamentoBase, LancamentoPeriodo, LancamentoStatusEnum, TipoAcaoLancamentoEnum } from '.';
|
|
2
|
+
import { FirebaseDocumentReferenceGeneric, FirebaseDocumentSnapshotGeneric, FirebaseQueryDocumentSnapshotGeneric, FirebaseTimestampGeneric } from '../../../shared/flitModelsDependencyInjection';
|
|
3
3
|
import { TipoOcorrenciaFrequenciaEnum } from '../ocorrencia_frequencia';
|
|
4
4
|
export declare class LancamentoFirestoreData implements LancamentoBase {
|
|
5
|
-
data_criacao:
|
|
6
|
-
data_atualizacao:
|
|
5
|
+
data_criacao: FirebaseTimestampGeneric;
|
|
6
|
+
data_atualizacao: FirebaseTimestampGeneric;
|
|
7
7
|
data_intervalo: string[];
|
|
8
|
-
data_inicial:
|
|
9
|
-
data_final:
|
|
8
|
+
data_inicial: FirebaseTimestampGeneric;
|
|
9
|
+
data_final: FirebaseTimestampGeneric;
|
|
10
10
|
descricao: string;
|
|
11
11
|
excluido: boolean;
|
|
12
12
|
acao_tipo: TipoAcaoLancamentoEnum;
|
|
@@ -17,16 +17,20 @@ export declare class LancamentoFirestoreData implements LancamentoBase {
|
|
|
17
17
|
};
|
|
18
18
|
periodos?: LancamentoPeriodo[];
|
|
19
19
|
empresa: {
|
|
20
|
-
ref:
|
|
20
|
+
ref: FirebaseDocumentReferenceGeneric;
|
|
21
21
|
razao: string;
|
|
22
22
|
fantasia: string;
|
|
23
23
|
documento: string;
|
|
24
24
|
};
|
|
25
|
+
integracao?: {
|
|
26
|
+
id: string;
|
|
27
|
+
tipo: string;
|
|
28
|
+
};
|
|
25
29
|
status: LancamentoStatusEnum;
|
|
26
30
|
todos_colaboradores: boolean;
|
|
27
31
|
colaboradores_ids: string[];
|
|
28
32
|
}
|
|
29
33
|
export declare abstract class LancamentoFireConvert {
|
|
30
|
-
static fromFirestore(doc:
|
|
31
|
-
static toFirestore(lancamento: Lancamento
|
|
34
|
+
static fromFirestore(doc: FirebaseDocumentSnapshotGeneric | FirebaseQueryDocumentSnapshotGeneric): Lancamento;
|
|
35
|
+
static toFirestore(lancamento: Lancamento): Partial<LancamentoFirestoreData>;
|
|
32
36
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LancamentoFireConvert = exports.LancamentoFirestoreData = void 0;
|
|
4
|
-
var firestore_1 = require("firebase/firestore");
|
|
5
4
|
var lodash_1 = require("lodash");
|
|
6
5
|
var _1 = require(".");
|
|
6
|
+
var flitModelsDependencyInjection_1 = require("../../../shared/flitModelsDependencyInjection");
|
|
7
7
|
var array_helpers_1 = require("../../utils/array-helpers");
|
|
8
8
|
var boolean_helper_1 = require("../../utils/boolean-helper");
|
|
9
9
|
var string_helper_1 = require("../../utils/string-helper");
|
|
10
|
-
var type_guards_1 = require("../../utils/type-guards");
|
|
11
10
|
var LancamentoFirestoreData = /** @class */ (function () {
|
|
12
11
|
function LancamentoFirestoreData() {
|
|
13
12
|
}
|
|
@@ -18,26 +17,22 @@ var LancamentoFireConvert = /** @class */ (function () {
|
|
|
18
17
|
function LancamentoFireConvert() {
|
|
19
18
|
}
|
|
20
19
|
LancamentoFireConvert.fromFirestore = function (doc) {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
22
21
|
var docData = ((_a = doc.data()) !== null && _a !== void 0 ? _a : {});
|
|
23
22
|
return new _1.Lancamento({
|
|
24
23
|
_id: (_b = doc.id) !== null && _b !== void 0 ? _b : null,
|
|
25
24
|
_path: (_c = doc.ref.path) !== null && _c !== void 0 ? _c : null,
|
|
26
|
-
data_inicial: (
|
|
27
|
-
|
|
28
|
-
: null,
|
|
29
|
-
data_final: (0, type_guards_1.TipoTimestampFirestore)(docData.data_final)
|
|
30
|
-
? docData.data_final.toDate()
|
|
31
|
-
: null,
|
|
25
|
+
data_inicial: ((_d = docData.data_inicial) === null || _d === void 0 ? void 0 : _d.toDate()) || null,
|
|
26
|
+
data_final: ((_e = docData.data_final) === null || _e === void 0 ? void 0 : _e.toDate()) || null,
|
|
32
27
|
descricao: string_helper_1.StringHelper.trim(docData.descricao, null),
|
|
33
28
|
excluido: boolean_helper_1.BooleanHelper.check(docData.excluido, false),
|
|
34
29
|
acao_tipo: string_helper_1.StringHelper.trim(docData.acao_tipo, null),
|
|
35
30
|
status: string_helper_1.StringHelper.trim(docData.status, null),
|
|
36
31
|
empresa: {
|
|
37
|
-
documento: string_helper_1.StringHelper.trim((
|
|
38
|
-
fantasia: string_helper_1.StringHelper.trim((
|
|
39
|
-
razao: string_helper_1.StringHelper.trim((
|
|
40
|
-
path: string_helper_1.StringHelper.trim((
|
|
32
|
+
documento: string_helper_1.StringHelper.trim((_f = docData.empresa) === null || _f === void 0 ? void 0 : _f.documento, null),
|
|
33
|
+
fantasia: string_helper_1.StringHelper.trim((_g = docData.empresa) === null || _g === void 0 ? void 0 : _g.fantasia, null),
|
|
34
|
+
razao: string_helper_1.StringHelper.trim((_h = docData.empresa) === null || _h === void 0 ? void 0 : _h.razao, null),
|
|
35
|
+
path: string_helper_1.StringHelper.trim((_j = docData.empresa) === null || _j === void 0 ? void 0 : _j.ref.path, null),
|
|
41
36
|
},
|
|
42
37
|
ocorrencia: docData.ocorrencia
|
|
43
38
|
? {
|
|
@@ -47,34 +42,21 @@ var LancamentoFireConvert = /** @class */ (function () {
|
|
|
47
42
|
}
|
|
48
43
|
: null,
|
|
49
44
|
todos_colaboradores: boolean_helper_1.BooleanHelper.check(docData.todos_colaboradores, true),
|
|
50
|
-
periodos: ((
|
|
51
|
-
data_atualizacao: (
|
|
52
|
-
|
|
53
|
-
: undefined,
|
|
54
|
-
data_criacao: (0, type_guards_1.TipoTimestampFirestore)(docData.data_criacao)
|
|
55
|
-
? docData.data_criacao.toDate()
|
|
56
|
-
: undefined,
|
|
45
|
+
periodos: ((_k = docData.periodos) === null || _k === void 0 ? void 0 : _k.length) ? docData.periodos : null,
|
|
46
|
+
data_atualizacao: (_m = (_l = docData.data_atualizacao) === null || _l === void 0 ? void 0 : _l.toDate()) !== null && _m !== void 0 ? _m : undefined,
|
|
47
|
+
data_criacao: (_p = (_o = docData.data_criacao) === null || _o === void 0 ? void 0 : _o.toDate()) !== null && _p !== void 0 ? _p : undefined,
|
|
57
48
|
data_intervalo: array_helpers_1.ArrayHelper.checkStringArray(docData.data_intervalo, undefined),
|
|
58
49
|
colaboradores_ids: array_helpers_1.ArrayHelper.checkStringArray(docData.colaboradores_ids, null),
|
|
50
|
+
integracao: docData.integracao
|
|
51
|
+
? { id: docData.integracao.id, tipo: docData.integracao.tipo }
|
|
52
|
+
: undefined,
|
|
59
53
|
});
|
|
60
54
|
};
|
|
61
|
-
LancamentoFireConvert.toFirestore = function (lancamento
|
|
55
|
+
LancamentoFireConvert.toFirestore = function (lancamento) {
|
|
62
56
|
var _a;
|
|
63
57
|
var lancamentoFire = {
|
|
64
|
-
data_inicial:
|
|
65
|
-
|
|
66
|
-
? timestampfromDate(lancamento.data_inicial)
|
|
67
|
-
: null
|
|
68
|
-
: lancamento.data_inicial
|
|
69
|
-
? firestore_1.Timestamp.fromDate(lancamento.data_inicial)
|
|
70
|
-
: null,
|
|
71
|
-
data_final: timestampfromDate
|
|
72
|
-
? lancamento.data_final
|
|
73
|
-
? timestampfromDate(lancamento.data_final)
|
|
74
|
-
: null
|
|
75
|
-
: lancamento.data_final
|
|
76
|
-
? firestore_1.Timestamp.fromDate(lancamento.data_final)
|
|
77
|
-
: null,
|
|
58
|
+
data_inicial: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(lancamento.data_inicial),
|
|
59
|
+
data_final: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(lancamento.data_final),
|
|
78
60
|
data_intervalo: array_helpers_1.ArrayHelper.checkStringArray(lancamento.data_intervalo, null),
|
|
79
61
|
colaboradores_ids: array_helpers_1.ArrayHelper.checkStringArray(lancamento.colaboradores_ids, null),
|
|
80
62
|
descricao: string_helper_1.StringHelper.trim(lancamento.descricao, null),
|
|
@@ -82,7 +64,7 @@ var LancamentoFireConvert = /** @class */ (function () {
|
|
|
82
64
|
acao_tipo: string_helper_1.StringHelper.trim(lancamento.acao_tipo, null),
|
|
83
65
|
status: string_helper_1.StringHelper.trim(lancamento.status, null),
|
|
84
66
|
empresa: {
|
|
85
|
-
ref:
|
|
67
|
+
ref: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.DocumentReferenceFromPath(lancamento.empresa.path),
|
|
86
68
|
documento: string_helper_1.StringHelper.trim(lancamento.empresa.documento, null),
|
|
87
69
|
fantasia: string_helper_1.StringHelper.trim(lancamento.empresa.fantasia, null),
|
|
88
70
|
razao: string_helper_1.StringHelper.trim(lancamento.empresa.razao, null),
|
|
@@ -96,20 +78,11 @@ var LancamentoFireConvert = /** @class */ (function () {
|
|
|
96
78
|
: null,
|
|
97
79
|
todos_colaboradores: boolean_helper_1.BooleanHelper.check(lancamento.todos_colaboradores, true),
|
|
98
80
|
periodos: ((_a = lancamento.periodos) === null || _a === void 0 ? void 0 : _a.length) ? lancamento.periodos : null,
|
|
99
|
-
data_atualizacao:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
:
|
|
104
|
-
? firestore_1.Timestamp.fromDate(lancamento.data_atualizacao)
|
|
105
|
-
: undefined,
|
|
106
|
-
data_criacao: timestampfromDate
|
|
107
|
-
? lancamento.data_criacao
|
|
108
|
-
? timestampfromDate(lancamento.data_criacao)
|
|
109
|
-
: undefined
|
|
110
|
-
: lancamento.data_criacao
|
|
111
|
-
? firestore_1.Timestamp.fromDate(lancamento.data_criacao)
|
|
112
|
-
: undefined,
|
|
81
|
+
data_atualizacao: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(lancamento.data_atualizacao),
|
|
82
|
+
data_criacao: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(lancamento.data_criacao),
|
|
83
|
+
integracao: lancamento.integracao
|
|
84
|
+
? { id: lancamento.integracao.id, tipo: lancamento.integracao.tipo }
|
|
85
|
+
: undefined,
|
|
113
86
|
};
|
|
114
87
|
return (0, lodash_1.omitBy)(lancamentoFire, lodash_1.isUndefined);
|
|
115
88
|
};
|
|
@@ -26,6 +26,10 @@ export declare class LancamentoJsonData implements LancamentoBase {
|
|
|
26
26
|
};
|
|
27
27
|
status: LancamentoStatusEnum;
|
|
28
28
|
todos_colaboradores: boolean;
|
|
29
|
+
integracao?: {
|
|
30
|
+
id: string;
|
|
31
|
+
tipo: string;
|
|
32
|
+
};
|
|
29
33
|
}
|
|
30
34
|
export declare abstract class LancamentoJsonConvert {
|
|
31
35
|
static fromJson(obj: LancamentoJsonData): Lancamento;
|
|
@@ -46,6 +46,9 @@ var LancamentoJsonConvert = /** @class */ (function () {
|
|
|
46
46
|
data_criacao: date_helper_1.DateHelper.fromString(obj.data_criacao, null),
|
|
47
47
|
data_intervalo: array_helpers_1.ArrayHelper.checkStringArray(obj.data_intervalo, null),
|
|
48
48
|
colaboradores_ids: array_helpers_1.ArrayHelper.checkStringArray(obj.colaboradores_ids, null),
|
|
49
|
+
integracao: obj.integracao
|
|
50
|
+
? { id: obj.integracao.id, tipo: obj.integracao.tipo }
|
|
51
|
+
: undefined,
|
|
49
52
|
});
|
|
50
53
|
};
|
|
51
54
|
LancamentoJsonConvert.toJson = function (lancamento) {
|
|
@@ -78,6 +81,9 @@ var LancamentoJsonConvert = /** @class */ (function () {
|
|
|
78
81
|
data_atualizacao: (_g = lancamento.data_atualizacao) === null || _g === void 0 ? void 0 : _g.toISOString(),
|
|
79
82
|
data_intervalo: array_helpers_1.ArrayHelper.checkStringArray(lancamento.data_intervalo, undefined),
|
|
80
83
|
colaboradores_ids: array_helpers_1.ArrayHelper.checkStringArray(lancamento.colaboradores_ids, undefined),
|
|
84
|
+
integracao: lancamento.integracao
|
|
85
|
+
? { id: lancamento.integracao.id, tipo: lancamento.integracao.tipo }
|
|
86
|
+
: undefined,
|
|
81
87
|
};
|
|
82
88
|
return (0, lodash_1.omitBy)(lancamentoJson, lodash_1.isUndefined);
|
|
83
89
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FirebaseDocumentReferenceGeneric, FirebaseDocumentSnapshotGeneric, FirebaseQueryDocumentSnapshotGeneric, FirebaseTimestampGeneric } from '../../../../shared/flitModelsDependencyInjection';
|
|
2
2
|
import { VerificacaoLancamento, VerificacaoLancamentoBase, TipoReferenciaVerificacaoLancamento } from './verificacao-lancamento';
|
|
3
3
|
export declare class VerificacaoLancamentoFirestoreData implements VerificacaoLancamentoBase {
|
|
4
4
|
detalhes?: {
|
|
@@ -6,19 +6,19 @@ export declare class VerificacaoLancamentoFirestoreData implements VerificacaoLa
|
|
|
6
6
|
usuario?: {
|
|
7
7
|
documento: string;
|
|
8
8
|
nome: string;
|
|
9
|
-
ref:
|
|
9
|
+
ref: FirebaseDocumentReferenceGeneric;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
referencia: {
|
|
13
13
|
tipo: TipoReferenciaVerificacaoLancamento;
|
|
14
|
-
data?:
|
|
15
|
-
ref:
|
|
14
|
+
data?: FirebaseTimestampGeneric;
|
|
15
|
+
ref: FirebaseDocumentReferenceGeneric;
|
|
16
16
|
};
|
|
17
17
|
visto: boolean;
|
|
18
|
-
data_criacao:
|
|
18
|
+
data_criacao: FirebaseTimestampGeneric;
|
|
19
19
|
mensagem: string;
|
|
20
20
|
}
|
|
21
21
|
export declare abstract class VerificacaoLancamentoFireConvert {
|
|
22
|
-
static fromFirestore(doc:
|
|
23
|
-
static toFirestore(logLancamento: VerificacaoLancamento
|
|
22
|
+
static fromFirestore(doc: FirebaseDocumentSnapshotGeneric | FirebaseQueryDocumentSnapshotGeneric): VerificacaoLancamento;
|
|
23
|
+
static toFirestore(logLancamento: VerificacaoLancamento): Partial<VerificacaoLancamentoFirestoreData>;
|
|
24
24
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VerificacaoLancamentoFireConvert = exports.VerificacaoLancamentoFirestoreData = void 0;
|
|
4
4
|
var lodash_1 = require("lodash");
|
|
5
|
+
var flitModelsDependencyInjection_1 = require("../../../../shared/flitModelsDependencyInjection");
|
|
5
6
|
var boolean_helper_1 = require("../../../utils/boolean-helper");
|
|
6
7
|
var string_helper_1 = require("../../../utils/string-helper");
|
|
7
8
|
var type_guards_1 = require("../../../utils/type-guards");
|
|
@@ -26,7 +27,8 @@ var VerificacaoLancamentoFireConvert = /** @class */ (function () {
|
|
|
26
27
|
: null,
|
|
27
28
|
referencia: {
|
|
28
29
|
ref: (0, type_guards_1.TipoDocumentReference)((_c = fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.referencia) === null || _c === void 0 ? void 0 : _c.ref)
|
|
29
|
-
? fireDocument.referencia.ref
|
|
30
|
+
? fireDocument.referencia.ref
|
|
31
|
+
.path
|
|
30
32
|
: null,
|
|
31
33
|
data: (0, type_guards_1.TipoTimestampFirestore)((_d = fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.referencia) === null || _d === void 0 ? void 0 : _d.data)
|
|
32
34
|
? fireDocument.referencia.data.toDate()
|
|
@@ -48,7 +50,7 @@ var VerificacaoLancamentoFireConvert = /** @class */ (function () {
|
|
|
48
50
|
visto: (_g = fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.visto) !== null && _g !== void 0 ? _g : false,
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
|
-
VerificacaoLancamentoFireConvert.toFirestore = function (logLancamento
|
|
53
|
+
VerificacaoLancamentoFireConvert.toFirestore = function (logLancamento) {
|
|
52
54
|
var _a;
|
|
53
55
|
var logLancamentoFirestore = {
|
|
54
56
|
mensagem: logLancamento.mensagem,
|
|
@@ -58,15 +60,15 @@ var VerificacaoLancamentoFireConvert = /** @class */ (function () {
|
|
|
58
60
|
? {
|
|
59
61
|
documento: string_helper_1.StringHelper.check(logLancamento.detalhes.usuario.documento, null),
|
|
60
62
|
nome: string_helper_1.StringHelper.check(logLancamento.detalhes.usuario.nome, null),
|
|
61
|
-
ref:
|
|
63
|
+
ref: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.DocumentReferenceFromPath(logLancamento.detalhes.usuario.ref),
|
|
62
64
|
}
|
|
63
65
|
: null,
|
|
64
66
|
}
|
|
65
67
|
: null,
|
|
66
|
-
data_criacao:
|
|
68
|
+
data_criacao: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(logLancamento.data_criacao),
|
|
67
69
|
referencia: {
|
|
68
|
-
data:
|
|
69
|
-
ref:
|
|
70
|
+
data: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.TimestampFromDate(logLancamento.referencia.data),
|
|
71
|
+
ref: flitModelsDependencyInjection_1.FlitModelsDependencyInjection.DocumentReferenceFromPath(logLancamento.referencia.ref),
|
|
70
72
|
tipo: string_helper_1.StringHelper.trim(logLancamento.referencia.tipo, null),
|
|
71
73
|
},
|
|
72
74
|
visto: boolean_helper_1.BooleanHelper.check(logLancamento.visto, false),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FirebaseDocumentReferenceGeneric, FirebaseTimestampGeneric } from '../../shared/flitModelsDependencyInjection';
|
|
2
2
|
/**
|
|
3
3
|
* Typeguard para o tipo Timestamp do firestore.
|
|
4
4
|
*
|
|
@@ -6,12 +6,12 @@ import { DocumentReference, Timestamp } from 'firebase/firestore';
|
|
|
6
6
|
* @param {(Timestamp | string | Date)} timestamp
|
|
7
7
|
* @return {*} {timestamp is Timestamp}
|
|
8
8
|
*/
|
|
9
|
-
export declare function TipoTimestampFirestore(timestamp:
|
|
9
|
+
export declare function TipoTimestampFirestore(timestamp: FirebaseTimestampGeneric | string | Date): timestamp is FirebaseTimestampGeneric;
|
|
10
10
|
/**
|
|
11
11
|
* Typeguard para o tipo DocumentReference do firestore.
|
|
12
12
|
*
|
|
13
13
|
* @export
|
|
14
|
-
* @param {(DocumentReference | string | Date)}
|
|
14
|
+
* @param {(DocumentReference | string | Date)} documentReference
|
|
15
15
|
* @return {*} {timestamp is DocumentReference}
|
|
16
16
|
*/
|
|
17
|
-
export declare function TipoDocumentReference(
|
|
17
|
+
export declare function TipoDocumentReference(documentReference: FirebaseDocumentReferenceGeneric | string | Date): documentReference is FirebaseDocumentReferenceGeneric;
|
|
@@ -17,11 +17,11 @@ exports.TipoTimestampFirestore = TipoTimestampFirestore;
|
|
|
17
17
|
* Typeguard para o tipo DocumentReference do firestore.
|
|
18
18
|
*
|
|
19
19
|
* @export
|
|
20
|
-
* @param {(DocumentReference | string | Date)}
|
|
20
|
+
* @param {(DocumentReference | string | Date)} documentReference
|
|
21
21
|
* @return {*} {timestamp is DocumentReference}
|
|
22
22
|
*/
|
|
23
|
-
function TipoDocumentReference(
|
|
24
|
-
return ((
|
|
25
|
-
(
|
|
23
|
+
function TipoDocumentReference(documentReference) {
|
|
24
|
+
return ((documentReference === null || documentReference === void 0 ? void 0 : documentReference.id) !== undefined &&
|
|
25
|
+
(documentReference === null || documentReference === void 0 ? void 0 : documentReference.path) !== undefined);
|
|
26
26
|
}
|
|
27
27
|
exports.TipoDocumentReference = TipoDocumentReference;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import 'firebase/compat/firestore';
|
|
2
|
+
import firebase from 'firebase/compat/app';
|
|
3
|
+
import { DocumentReference, FieldValue, Timestamp } from 'firebase/firestore';
|
|
4
|
+
import { DocumentReference as DocumentReferenceAdmin, Timestamp as TimestampAdmin, FieldValue as FieldValueAdmin } from '@google-cloud/firestore';
|
|
5
|
+
export declare type FirebaseTimestampGeneric = Timestamp | TimestampAdmin | firebase.firestore.Timestamp;
|
|
6
|
+
export declare type FirebaseDocumentReferenceGeneric = DocumentReference | DocumentReferenceAdmin | firebase.firestore.DocumentReference;
|
|
7
|
+
export declare type FirebaseFieldValueGeneric = FieldValue | FieldValueAdmin | firebase.firestore.FieldValue;
|
|
8
|
+
export declare abstract class FlitCalcularJornadaDependencyInjection {
|
|
9
|
+
private static _injected;
|
|
10
|
+
private static _injectCount;
|
|
11
|
+
private static _firestoreDocumentReferenceFromPath;
|
|
12
|
+
private static _firestoreTimestampFromDateConstructor;
|
|
13
|
+
private static _firestoreTimestampFromMillsConstructor;
|
|
14
|
+
static inject({ firestoreDocumentReferenceFromPath, firestoreTimestampFromDateConstructor, firestoreTimestampFromMillsConstructor, }: {
|
|
15
|
+
firestoreDocumentReferenceFromPath: (path: string) => FirebaseDocumentReferenceGeneric;
|
|
16
|
+
firestoreTimestampFromDateConstructor: (date: Date) => FirebaseTimestampGeneric;
|
|
17
|
+
firestoreTimestampFromMillsConstructor: (milliseconds: number) => FirebaseTimestampGeneric;
|
|
18
|
+
}, enableReinject?: boolean): void;
|
|
19
|
+
static DocumentReferenceFromPath(path: string): firebase.firestore.DocumentReference<firebase.firestore.DocumentData> | DocumentReference<import("@firebase/firestore").DocumentData> | DocumentReferenceAdmin<FirebaseFirestore.DocumentData>;
|
|
20
|
+
static TimestampFromDate(date: Date): FirebaseTimestampGeneric;
|
|
21
|
+
static TimestampFromMills(milliseconds: number): FirebaseTimestampGeneric;
|
|
22
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FlitCalcularJornadaDependencyInjection = void 0;
|
|
7
|
+
require("firebase/compat/firestore");
|
|
8
|
+
var app_1 = __importDefault(require("firebase/compat/app"));
|
|
9
|
+
var FlitCalcularJornadaDependencyInjection = /** @class */ (function () {
|
|
10
|
+
function FlitCalcularJornadaDependencyInjection() {
|
|
11
|
+
}
|
|
12
|
+
FlitCalcularJornadaDependencyInjection.inject = function (_a, enableReinject) {
|
|
13
|
+
var firestoreDocumentReferenceFromPath = _a.firestoreDocumentReferenceFromPath, firestoreTimestampFromDateConstructor = _a.firestoreTimestampFromDateConstructor, firestoreTimestampFromMillsConstructor = _a.firestoreTimestampFromMillsConstructor;
|
|
14
|
+
if (enableReinject === void 0) { enableReinject = false; }
|
|
15
|
+
if (!this._injected || enableReinject) {
|
|
16
|
+
this._injectCount++;
|
|
17
|
+
this._injected = true;
|
|
18
|
+
this._firestoreDocumentReferenceFromPath =
|
|
19
|
+
firestoreDocumentReferenceFromPath;
|
|
20
|
+
this._firestoreTimestampFromDateConstructor =
|
|
21
|
+
firestoreTimestampFromDateConstructor;
|
|
22
|
+
this._firestoreTimestampFromMillsConstructor =
|
|
23
|
+
firestoreTimestampFromMillsConstructor;
|
|
24
|
+
if (this._injectCount > 1) {
|
|
25
|
+
throw new Error('FlitCalcularJornadaDependencyInjection => reinject service provided in root, not recomended for production.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new Error('FlitCalcularJornadaDependencyInjection => not allowed reinject service provided in root.');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
FlitCalcularJornadaDependencyInjection.DocumentReferenceFromPath = function (path) {
|
|
33
|
+
if (this._firestoreDocumentReferenceFromPath) {
|
|
34
|
+
return this._firestoreDocumentReferenceFromPath(path);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.warn('FlitCalcularJornadaDependencyInjection => firestoreTimestampFromDateConstructor => not injected | (using default firebase sdk this may cause conflicts)');
|
|
38
|
+
return app_1.default.firestore().doc(path);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
FlitCalcularJornadaDependencyInjection.TimestampFromDate = function (date) {
|
|
42
|
+
if (this._firestoreTimestampFromDateConstructor) {
|
|
43
|
+
return this._firestoreTimestampFromDateConstructor(date);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.warn('FlitCalcularJornadaDependencyInjection => firestoreTimestampFromDateConstructor => not injected | (using default firebase sdk this may cause conflicts)');
|
|
47
|
+
return app_1.default.firestore.Timestamp.fromDate(date);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
FlitCalcularJornadaDependencyInjection.TimestampFromMills = function (milliseconds) {
|
|
51
|
+
if (this._firestoreTimestampFromMillsConstructor) {
|
|
52
|
+
return this._firestoreTimestampFromMillsConstructor(milliseconds);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.warn('FlitCalcularJornadaDependencyInjection => firestoreTimestampFromMillsConstructor => not injected | (using default firebase sdk this may cause conflicts)');
|
|
56
|
+
return app_1.default.firestore.Timestamp.fromMillis(milliseconds);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return FlitCalcularJornadaDependencyInjection;
|
|
60
|
+
}());
|
|
61
|
+
exports.FlitCalcularJornadaDependencyInjection = FlitCalcularJornadaDependencyInjection;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import 'firebase/compat/firestore';
|
|
2
|
+
import firebase from 'firebase/compat/app';
|
|
3
|
+
import { DocumentReference, DocumentSnapshot, FieldValue, QueryDocumentSnapshot, Timestamp } from 'firebase/firestore';
|
|
4
|
+
import { DocumentReference as DocumentReferenceAdmin, Timestamp as TimestampAdmin, FieldValue as FieldValueAdmin, DocumentSnapshot as DocumentSnapshotAdmin, QueryDocumentSnapshot as QueryDocumentSnapshotAdmin } from '@google-cloud/firestore';
|
|
5
|
+
export declare type FirebaseTimestampGeneric = Timestamp | TimestampAdmin | firebase.firestore.Timestamp;
|
|
6
|
+
export declare type FirebaseDocumentReferenceGeneric = DocumentReference | DocumentReferenceAdmin | firebase.firestore.DocumentReference;
|
|
7
|
+
export declare type FirebaseFieldValueGeneric = FieldValue | FieldValueAdmin | firebase.firestore.FieldValue;
|
|
8
|
+
export declare type FirebaseDocumentSnapshotGeneric = DocumentSnapshot | DocumentSnapshotAdmin | firebase.firestore.DocumentSnapshot;
|
|
9
|
+
export declare type FirebaseQueryDocumentSnapshotGeneric = QueryDocumentSnapshot | QueryDocumentSnapshotAdmin | firebase.firestore.QueryDocumentSnapshot;
|
|
10
|
+
export declare abstract class FlitModelsDependencyInjection {
|
|
11
|
+
private static _injected;
|
|
12
|
+
private static _injectCount;
|
|
13
|
+
private static _firestoreDocumentReferenceFromPath;
|
|
14
|
+
private static _firestoreTimestampFromDateConstructor;
|
|
15
|
+
private static _firestoreTimestampFromMillsConstructor;
|
|
16
|
+
static inject({ firestoreDocumentReferenceFromPath, firestoreTimestampFromDateConstructor, firestoreTimestampFromMillsConstructor, }: {
|
|
17
|
+
firestoreDocumentReferenceFromPath: (path: string) => FirebaseDocumentReferenceGeneric;
|
|
18
|
+
firestoreTimestampFromDateConstructor: (date: Date) => FirebaseTimestampGeneric;
|
|
19
|
+
firestoreTimestampFromMillsConstructor: (milliseconds: number) => FirebaseTimestampGeneric;
|
|
20
|
+
}, enableReinject?: boolean): void;
|
|
21
|
+
static DocumentReferenceFromPath(path: string): firebase.firestore.DocumentReference<firebase.firestore.DocumentData> | DocumentReference<import("@firebase/firestore").DocumentData> | DocumentReferenceAdmin<FirebaseFirestore.DocumentData>;
|
|
22
|
+
static TimestampFromDate(date: Date): FirebaseTimestampGeneric;
|
|
23
|
+
static TimestampFromMills(milliseconds: number): FirebaseTimestampGeneric;
|
|
24
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FlitModelsDependencyInjection = void 0;
|
|
7
|
+
require("firebase/compat/firestore");
|
|
8
|
+
var app_1 = __importDefault(require("firebase/compat/app"));
|
|
9
|
+
var FlitModelsDependencyInjection = /** @class */ (function () {
|
|
10
|
+
function FlitModelsDependencyInjection() {
|
|
11
|
+
}
|
|
12
|
+
FlitModelsDependencyInjection.inject = function (_a, enableReinject) {
|
|
13
|
+
var firestoreDocumentReferenceFromPath = _a.firestoreDocumentReferenceFromPath, firestoreTimestampFromDateConstructor = _a.firestoreTimestampFromDateConstructor, firestoreTimestampFromMillsConstructor = _a.firestoreTimestampFromMillsConstructor;
|
|
14
|
+
if (enableReinject === void 0) { enableReinject = false; }
|
|
15
|
+
if (!this._injected || enableReinject) {
|
|
16
|
+
this._injectCount++;
|
|
17
|
+
this._injected = true;
|
|
18
|
+
this._firestoreDocumentReferenceFromPath =
|
|
19
|
+
firestoreDocumentReferenceFromPath;
|
|
20
|
+
this._firestoreTimestampFromDateConstructor =
|
|
21
|
+
firestoreTimestampFromDateConstructor;
|
|
22
|
+
this._firestoreTimestampFromMillsConstructor =
|
|
23
|
+
firestoreTimestampFromMillsConstructor;
|
|
24
|
+
if (this._injectCount > 1) {
|
|
25
|
+
throw new Error('FlitCalcularJornadaDependencyInjection => reinject service provided in root, not recomended for production.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new Error('FlitCalcularJornadaDependencyInjection => not allowed reinject service provided in root.');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
FlitModelsDependencyInjection.DocumentReferenceFromPath = function (path) {
|
|
33
|
+
if (this._firestoreDocumentReferenceFromPath) {
|
|
34
|
+
return this._firestoreDocumentReferenceFromPath(path);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.warn('FlitCalcularJornadaDependencyInjection => firestoreTimestampFromDateConstructor => not injected | (using default firebase sdk this may cause conflicts)');
|
|
38
|
+
return app_1.default.firestore().doc(path);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
FlitModelsDependencyInjection.TimestampFromDate = function (date) {
|
|
42
|
+
if (this._firestoreTimestampFromDateConstructor) {
|
|
43
|
+
return this._firestoreTimestampFromDateConstructor(date);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.warn('FlitCalcularJornadaDependencyInjection => firestoreTimestampFromDateConstructor => not injected | (using default firebase sdk this may cause conflicts)');
|
|
47
|
+
return app_1.default.firestore.Timestamp.fromDate(date);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
FlitModelsDependencyInjection.TimestampFromMills = function (milliseconds) {
|
|
51
|
+
if (this._firestoreTimestampFromMillsConstructor) {
|
|
52
|
+
return this._firestoreTimestampFromMillsConstructor(milliseconds);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.warn('FlitCalcularJornadaDependencyInjection => firestoreTimestampFromMillsConstructor => not injected | (using default firebase sdk this may cause conflicts)');
|
|
56
|
+
return app_1.default.firestore.Timestamp.fromMillis(milliseconds);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return FlitModelsDependencyInjection;
|
|
60
|
+
}());
|
|
61
|
+
exports.FlitModelsDependencyInjection = FlitModelsDependencyInjection;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flit-models",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -23,22 +23,23 @@
|
|
|
23
23
|
"author": "gustavo_damazio",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"firebase": "^9.
|
|
26
|
+
"firebase": "^9.9.0",
|
|
27
27
|
"lodash": "^4.17.21",
|
|
28
28
|
"ts-transformer-keys": "^0.4.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@
|
|
31
|
+
"@google-cloud/firestore": "^5.0.2",
|
|
32
|
+
"@types/jest": "^28.1.4",
|
|
32
33
|
"@types/lodash": "^4.14.182",
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
34
|
-
"@typescript-eslint/parser": "^5.
|
|
35
|
-
"eslint": "^8.
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
|
35
|
+
"@typescript-eslint/parser": "^5.30.6",
|
|
36
|
+
"eslint": "^8.19.0",
|
|
36
37
|
"eslint-config-google": "^0.14.0",
|
|
37
38
|
"eslint-config-prettier": "^8.5.0",
|
|
38
39
|
"eslint-plugin-import": "^2.26.0",
|
|
39
40
|
"eslint-plugin-jest": "^26.5.3",
|
|
40
|
-
"eslint-plugin-prettier": "^4.
|
|
41
|
-
"jest": "^28.1.
|
|
41
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
42
|
+
"jest": "^28.1.2",
|
|
42
43
|
"prettier": "^2.7.1",
|
|
43
44
|
"ts-jest": "^28.0.5",
|
|
44
45
|
"ttypescript": "^1.5.13",
|