flit-models 2.1.6 → 2.1.9

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.
Files changed (23) hide show
  1. package/lib/models/contas/feriado/feriado-fire-convert.d.ts +1 -1
  2. package/lib/models/contas/feriado/feriado-fire-convert.js +4 -2
  3. package/lib/models/contas/feriado/index.js +5 -1
  4. package/lib/models/contas/lancamento/index.d.ts +68 -0
  5. package/lib/models/contas/lancamento/index.js +54 -0
  6. package/lib/models/contas/lancamento/lancamento-fire-convert.d.ts +27 -0
  7. package/lib/models/contas/lancamento/lancamento-fire-convert.js +77 -0
  8. package/lib/models/contas/lancamento/lancamento-json-convert.d.ts +28 -0
  9. package/lib/models/contas/lancamento/lancamento-json-convert.js +71 -0
  10. package/lib/models/contas/lancamento/logs/log-lancamento-fire-convert.d.ts +18 -0
  11. package/lib/models/contas/lancamento/logs/log-lancamento-fire-convert.js +53 -0
  12. package/lib/models/contas/lancamento/logs/log-lancamento.d.ts +41 -0
  13. package/lib/models/contas/lancamento/logs/log-lancamento.js +33 -0
  14. package/lib/models/contas/lancamento/usuarios/usuario-lancamento-fire-convert.d.ts +12 -0
  15. package/lib/models/contas/lancamento/usuarios/usuario-lancamento-fire-convert.js +41 -0
  16. package/lib/models/contas/lancamento/usuarios/usuario-lancamento.d.ts +27 -0
  17. package/lib/models/contas/lancamento/usuarios/usuario-lancamento.js +28 -0
  18. package/lib/models/contas/ocorrencia_frequencia/index.d.ts +12 -0
  19. package/lib/models/contas/ocorrencia_frequencia/index.js +16 -0
  20. package/lib/models/index.d.ts +1 -0
  21. package/lib/models/index.js +6 -1
  22. package/lib/models/utils/type-guards.js +4 -6
  23. package/package.json +11 -11
@@ -12,5 +12,5 @@ export declare class FeriadoFirestoreData implements FeriadoBase {
12
12
  }
13
13
  export declare abstract class FeriadoFireConvert {
14
14
  static fromFirestore(doc: DocumentSnapshot<FeriadoFirestoreData> | QueryDocumentSnapshot<FeriadoFirestoreData>): Feriado;
15
- static toFirestore(feriado: Feriado): Partial<FeriadoFirestoreData>;
15
+ static toFirestore(feriado: Feriado, timestampfromDate?: (date: Date) => any): Partial<FeriadoFirestoreData>;
16
16
  }
@@ -33,9 +33,11 @@ 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, timestampfromDate) {
37
37
  return (0, lodash_1.omitBy)({
38
- data: firestore_1.Timestamp.fromDate(feriado.data),
38
+ data: timestampfromDate
39
+ ? timestampfromDate(feriado.data)
40
+ : firestore_1.Timestamp.fromDate(feriado.data),
39
41
  descricao: string_helper_1.StringHelper.trim(feriado.descricao, null),
40
42
  excluido: boolean_helper_1.BooleanHelper.check(feriado.excluido, false),
41
43
  importacao_id: string_helper_1.StringHelper.trim(feriado.importacao_id, null),
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -0,0 +1,68 @@
1
+ import { TiposOcorrenciaFrequenciaEnum } from '../ocorrencia_frequencia';
2
+ export * from './lancamento-fire-convert';
3
+ export * from './lancamento-json-convert';
4
+ export * from './logs/log-lancamento-fire-convert';
5
+ export * from './logs/log-lancamento';
6
+ export * from './usuarios/usuario-lancamento-fire-convert';
7
+ export * from './usuarios/usuario-lancamento';
8
+ export declare enum LancamentoStatusEnum {
9
+ COMPLETO = "COMPLETO",
10
+ PENDENTE = "PENDENTE",
11
+ VERIFICAR = "VERIFICAR"
12
+ }
13
+ export interface LancamentoBase {
14
+ data_inicial: any;
15
+ data_final: any;
16
+ descricao: any;
17
+ excluido: any;
18
+ ocorrencia_tipo: any;
19
+ ocorrencia: {
20
+ ref?: any;
21
+ path?: any;
22
+ tipo: any;
23
+ descricao: any;
24
+ };
25
+ empresa: {
26
+ ref?: any;
27
+ path?: any;
28
+ razao: any;
29
+ fantasia: any;
30
+ documento: any;
31
+ };
32
+ status: any;
33
+ todos_colaboradores: any;
34
+ }
35
+ /**
36
+ * Internal class col contas/${contaId}/lancamento/${lancamentoId}.
37
+ *
38
+ * @export
39
+ * @class Lancamento
40
+ */
41
+ export declare class Lancamento implements LancamentoBase {
42
+ _id: string;
43
+ _path: string;
44
+ ocorrencia_tipo: TiposOcorrenciaFrequenciaEnum;
45
+ data_final: Date;
46
+ data_inicial: Date;
47
+ descricao: string;
48
+ empresa: {
49
+ path: string;
50
+ razao: string;
51
+ fantasia: string;
52
+ documento: string;
53
+ };
54
+ excluido: boolean;
55
+ ocorrencia: {
56
+ path: string;
57
+ tipo: TiposOcorrenciaFrequenciaEnum;
58
+ descricao: string;
59
+ };
60
+ status: LancamentoStatusEnum;
61
+ todos_colaboradores: boolean;
62
+ /**
63
+ * Creates an instance of Lancamento.
64
+ * @param {Partial<Lancamento>} lancamentoPayload
65
+ * @memberof Lancamento
66
+ */
67
+ constructor(lancamentoPayload: Partial<Lancamento>);
68
+ }
@@ -0,0 +1,54 @@
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.Lancamento = exports.LancamentoStatusEnum = void 0;
18
+ __exportStar(require("./lancamento-fire-convert"), exports);
19
+ __exportStar(require("./lancamento-json-convert"), exports);
20
+ __exportStar(require("./logs/log-lancamento-fire-convert"), exports);
21
+ __exportStar(require("./logs/log-lancamento"), exports);
22
+ __exportStar(require("./usuarios/usuario-lancamento-fire-convert"), exports);
23
+ __exportStar(require("./usuarios/usuario-lancamento"), exports);
24
+ var LancamentoStatusEnum;
25
+ (function (LancamentoStatusEnum) {
26
+ LancamentoStatusEnum["COMPLETO"] = "COMPLETO";
27
+ LancamentoStatusEnum["PENDENTE"] = "PENDENTE";
28
+ LancamentoStatusEnum["VERIFICAR"] = "VERIFICAR";
29
+ })(LancamentoStatusEnum = exports.LancamentoStatusEnum || (exports.LancamentoStatusEnum = {}));
30
+ /**
31
+ * Internal class col contas/${contaId}/lancamento/${lancamentoId}.
32
+ *
33
+ * @export
34
+ * @class Lancamento
35
+ */
36
+ var Lancamento = /** @class */ (function () {
37
+ // #endregion
38
+ /**
39
+ * Creates an instance of Lancamento.
40
+ * @param {Partial<Lancamento>} lancamentoPayload
41
+ * @memberof Lancamento
42
+ */
43
+ function Lancamento(lancamentoPayload) {
44
+ var _this = this;
45
+ var keysOfProps = ["status", "_id", "_path", "descricao", "excluido", "data_inicial", "data_final", "todos_colaboradores", "ocorrencia_tipo", "ocorrencia", "empresa"];
46
+ keysOfProps.forEach(function (key) {
47
+ _this[key] = lancamentoPayload
48
+ ? lancamentoPayload[key]
49
+ : undefined;
50
+ });
51
+ }
52
+ return Lancamento;
53
+ }());
54
+ exports.Lancamento = Lancamento;
@@ -0,0 +1,27 @@
1
+ import { DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, Timestamp } from 'firebase/firestore';
2
+ import { Lancamento, LancamentoBase, LancamentoStatusEnum } from '.';
3
+ import { TiposOcorrenciaFrequenciaEnum } from '../ocorrencia_frequencia';
4
+ export declare class LancamentoFirestoreData implements LancamentoBase {
5
+ data_inicial: Timestamp;
6
+ data_final: Timestamp;
7
+ descricao: string;
8
+ excluido: boolean;
9
+ ocorrencia_tipo: TiposOcorrenciaFrequenciaEnum;
10
+ ocorrencia: {
11
+ ref: DocumentReference;
12
+ tipo: TiposOcorrenciaFrequenciaEnum;
13
+ descricao: string;
14
+ };
15
+ empresa: {
16
+ ref: DocumentReference;
17
+ razao: string;
18
+ fantasia: string;
19
+ documento: string;
20
+ };
21
+ status: LancamentoStatusEnum;
22
+ todos_colaboradores: boolean;
23
+ }
24
+ export declare abstract class LancamentoFireConvert {
25
+ static fromFirestore(doc: DocumentSnapshot<LancamentoFirestoreData> | QueryDocumentSnapshot<LancamentoFirestoreData>): Lancamento;
26
+ static toFirestore(lancamento: Lancamento, documentReferenceFromPath: (path: string) => any, timestampfromDate?: (date: Date) => any): Partial<LancamentoFirestoreData>;
27
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LancamentoFireConvert = exports.LancamentoFirestoreData = void 0;
4
+ var firestore_1 = require("firebase/firestore");
5
+ var lodash_1 = require("lodash");
6
+ var _1 = require(".");
7
+ var boolean_helper_1 = require("../../utils/boolean-helper");
8
+ var string_helper_1 = require("../../utils/string-helper");
9
+ var type_guards_1 = require("../../utils/type-guards");
10
+ var LancamentoFirestoreData = /** @class */ (function () {
11
+ function LancamentoFirestoreData() {
12
+ }
13
+ return LancamentoFirestoreData;
14
+ }());
15
+ exports.LancamentoFirestoreData = LancamentoFirestoreData;
16
+ var LancamentoFireConvert = /** @class */ (function () {
17
+ function LancamentoFireConvert() {
18
+ }
19
+ LancamentoFireConvert.fromFirestore = function (doc) {
20
+ var _a, _b, _c;
21
+ return new _1.Lancamento({
22
+ _id: (_a = doc.id) !== null && _a !== void 0 ? _a : null,
23
+ _path: (_b = doc.ref.path) !== null && _b !== void 0 ? _b : null,
24
+ data_inicial: (0, type_guards_1.TipoTimestampFirestore)(doc.get('data'))
25
+ ? doc.get('data_inicial').toDate()
26
+ : null,
27
+ data_final: (0, type_guards_1.TipoTimestampFirestore)(doc.get('data'))
28
+ ? doc.get('data_final').toDate()
29
+ : null,
30
+ descricao: string_helper_1.StringHelper.trim(doc.get('descricao'), null),
31
+ excluido: boolean_helper_1.BooleanHelper.check(doc.get('excluido'), false),
32
+ ocorrencia_tipo: string_helper_1.StringHelper.trim(doc.get('tipo'), null),
33
+ status: string_helper_1.StringHelper.trim(doc.get('tipo'), null),
34
+ empresa: {
35
+ documento: string_helper_1.StringHelper.trim(doc.get('empresa.documento'), null),
36
+ fantasia: string_helper_1.StringHelper.trim(doc.get('empresa.fantasia'), null),
37
+ razao: string_helper_1.StringHelper.trim(doc.get('empresa.razao'), null),
38
+ path: string_helper_1.StringHelper.trim((_c = doc.ref) === null || _c === void 0 ? void 0 : _c.path, null),
39
+ },
40
+ ocorrencia: {
41
+ descricao: string_helper_1.StringHelper.trim(doc.get('ocorrencia.descricao'), null),
42
+ path: string_helper_1.StringHelper.trim(doc.get('ocorrencia.path'), null),
43
+ tipo: string_helper_1.StringHelper.trim(doc.get('ocorrencia.tipo'), null),
44
+ },
45
+ todos_colaboradores: boolean_helper_1.BooleanHelper.check(doc.get('todos_colaboradores'), true),
46
+ });
47
+ };
48
+ LancamentoFireConvert.toFirestore = function (lancamento, documentReferenceFromPath, timestampfromDate) {
49
+ var lancamentoFire = {
50
+ data_inicial: timestampfromDate
51
+ ? timestampfromDate(lancamento.data_inicial)
52
+ : firestore_1.Timestamp.fromDate(lancamento.data_inicial),
53
+ data_final: timestampfromDate
54
+ ? timestampfromDate(lancamento.data_final)
55
+ : firestore_1.Timestamp.fromDate(lancamento.data_final),
56
+ descricao: string_helper_1.StringHelper.trim(lancamento.descricao, null),
57
+ excluido: boolean_helper_1.BooleanHelper.check(lancamento.excluido, false),
58
+ ocorrencia_tipo: string_helper_1.StringHelper.trim(lancamento.ocorrencia_tipo, null),
59
+ status: string_helper_1.StringHelper.trim(lancamento.status, null),
60
+ empresa: {
61
+ ref: documentReferenceFromPath(lancamento.empresa.path),
62
+ documento: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
63
+ fantasia: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
64
+ razao: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
65
+ },
66
+ ocorrencia: {
67
+ ref: documentReferenceFromPath(lancamento.ocorrencia.path),
68
+ descricao: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
69
+ tipo: string_helper_1.StringHelper.trim(lancamento.ocorrencia_tipo, null),
70
+ },
71
+ todos_colaboradores: boolean_helper_1.BooleanHelper.check(lancamento.todos_colaboradores, true),
72
+ };
73
+ return (0, lodash_1.omitBy)(lancamentoFire, lodash_1.isUndefined);
74
+ };
75
+ return LancamentoFireConvert;
76
+ }());
77
+ exports.LancamentoFireConvert = LancamentoFireConvert;
@@ -0,0 +1,28 @@
1
+ import { Lancamento, LancamentoBase, LancamentoStatusEnum } from '.';
2
+ import { TiposOcorrenciaFrequenciaEnum } from '../ocorrencia_frequencia';
3
+ export declare class LancamentoJsonData implements LancamentoBase {
4
+ _id: string;
5
+ _path: string;
6
+ data_inicial: string;
7
+ data_final: string;
8
+ descricao: string;
9
+ excluido: boolean;
10
+ ocorrencia_tipo: TiposOcorrenciaFrequenciaEnum;
11
+ ocorrencia: {
12
+ path?: string;
13
+ tipo: TiposOcorrenciaFrequenciaEnum;
14
+ descricao: string;
15
+ };
16
+ empresa: {
17
+ path?: string;
18
+ razao: string;
19
+ fantasia: string;
20
+ documento: string;
21
+ };
22
+ status: LancamentoStatusEnum;
23
+ todos_colaboradores: boolean;
24
+ }
25
+ export declare abstract class LancamentoJsonConvert {
26
+ static fromJson(obj: LancamentoJsonData): Lancamento;
27
+ static toJson(lancamento: Lancamento): Partial<LancamentoJsonData>;
28
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LancamentoJsonConvert = exports.LancamentoJsonData = void 0;
4
+ var lodash_1 = require("lodash");
5
+ var _1 = require(".");
6
+ var boolean_helper_1 = require("../../utils/boolean-helper");
7
+ var date_helper_1 = require("../../utils/date-helper");
8
+ var string_helper_1 = require("../../utils/string-helper");
9
+ var LancamentoJsonData = /** @class */ (function () {
10
+ function LancamentoJsonData() {
11
+ }
12
+ return LancamentoJsonData;
13
+ }());
14
+ exports.LancamentoJsonData = LancamentoJsonData;
15
+ var LancamentoJsonConvert = /** @class */ (function () {
16
+ function LancamentoJsonConvert() {
17
+ }
18
+ LancamentoJsonConvert.fromJson = function (obj) {
19
+ var _a, _b;
20
+ return new _1.Lancamento({
21
+ _id: (_a = obj._id) !== null && _a !== void 0 ? _a : null,
22
+ _path: (_b = obj._path) !== null && _b !== void 0 ? _b : null,
23
+ data_inicial: date_helper_1.DateHelper.fromString(obj.data_inicial, null),
24
+ data_final: date_helper_1.DateHelper.fromString(obj.data_inicial, null),
25
+ descricao: string_helper_1.StringHelper.trim(obj.descricao, null),
26
+ excluido: boolean_helper_1.BooleanHelper.check(obj.excluido, false),
27
+ status: string_helper_1.StringHelper.trim(obj.status, null),
28
+ ocorrencia_tipo: string_helper_1.StringHelper.trim(obj.ocorrencia_tipo, null),
29
+ empresa: {
30
+ documento: string_helper_1.StringHelper.trim(obj.empresa.documento, null),
31
+ fantasia: string_helper_1.StringHelper.trim(obj.empresa.fantasia, null),
32
+ razao: string_helper_1.StringHelper.trim(obj.empresa.razao, null),
33
+ path: string_helper_1.StringHelper.trim(obj.empresa.path, null),
34
+ },
35
+ ocorrencia: {
36
+ descricao: string_helper_1.StringHelper.trim(obj.ocorrencia.descricao, null),
37
+ path: string_helper_1.StringHelper.trim(obj.ocorrencia.path, null),
38
+ tipo: string_helper_1.StringHelper.trim(obj.ocorrencia.tipo, null),
39
+ },
40
+ todos_colaboradores: boolean_helper_1.BooleanHelper.check(obj.excluido, true),
41
+ });
42
+ };
43
+ LancamentoJsonConvert.toJson = function (lancamento) {
44
+ var _a, _b;
45
+ var lancamentoJson = {
46
+ _id: (_a = lancamento._id) !== null && _a !== void 0 ? _a : null,
47
+ _path: (_b = lancamento._path) !== null && _b !== void 0 ? _b : null,
48
+ data_inicial: lancamento.data_inicial.toISOString(),
49
+ data_final: lancamento.data_final.toISOString(),
50
+ descricao: string_helper_1.StringHelper.trim(lancamento.descricao, null),
51
+ excluido: boolean_helper_1.BooleanHelper.check(lancamento.excluido, false),
52
+ status: string_helper_1.StringHelper.trim(lancamento.status, null),
53
+ ocorrencia_tipo: string_helper_1.StringHelper.trim(lancamento.ocorrencia_tipo, null),
54
+ empresa: {
55
+ documento: string_helper_1.StringHelper.trim(lancamento.empresa.documento, null),
56
+ fantasia: string_helper_1.StringHelper.trim(lancamento.empresa.fantasia, null),
57
+ razao: string_helper_1.StringHelper.trim(lancamento.empresa.razao, null),
58
+ path: string_helper_1.StringHelper.trim(lancamento.empresa.path, null),
59
+ },
60
+ ocorrencia: {
61
+ descricao: string_helper_1.StringHelper.trim(lancamento.ocorrencia.descricao, null),
62
+ path: string_helper_1.StringHelper.trim(lancamento.ocorrencia.path, null),
63
+ tipo: string_helper_1.StringHelper.trim(lancamento.ocorrencia.tipo, null),
64
+ },
65
+ todos_colaboradores: boolean_helper_1.BooleanHelper.check(lancamento.todos_colaboradores, false),
66
+ };
67
+ return (0, lodash_1.omitBy)(lancamentoJson, lodash_1.isUndefined);
68
+ };
69
+ return LancamentoJsonConvert;
70
+ }());
71
+ exports.LancamentoJsonConvert = LancamentoJsonConvert;
@@ -0,0 +1,18 @@
1
+ import { DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, Timestamp } from 'firebase/firestore';
2
+ import { LogLancamento, LogLancamentoBase, LogLancamentoStatusEnum } from './log-lancamento';
3
+ export declare class LogLancamentoFirestoreData implements LogLancamentoBase {
4
+ data: Timestamp;
5
+ mensagem: string;
6
+ detalhes: {
7
+ [key: string]: any;
8
+ };
9
+ status: LogLancamentoStatusEnum;
10
+ jornada: {
11
+ data: Timestamp;
12
+ ref: DocumentReference;
13
+ };
14
+ }
15
+ export declare abstract class LogLancamentoFireConvert {
16
+ static fromFirestore(doc: DocumentSnapshot<LogLancamentoFirestoreData> | QueryDocumentSnapshot<LogLancamentoFirestoreData>): LogLancamento;
17
+ static toFirestore(logLancamento: LogLancamento, timestampfromDate: (date: Date) => any, documentReferenceFromPath: (path: string) => DocumentReference<any>): Partial<LogLancamentoFirestoreData>;
18
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogLancamentoFireConvert = exports.LogLancamentoFirestoreData = void 0;
4
+ var lodash_1 = require("lodash");
5
+ var string_helper_1 = require("../../../utils/string-helper");
6
+ var type_guards_1 = require("../../../utils/type-guards");
7
+ var log_lancamento_1 = require("./log-lancamento");
8
+ var LogLancamentoFirestoreData = /** @class */ (function () {
9
+ function LogLancamentoFirestoreData() {
10
+ }
11
+ return LogLancamentoFirestoreData;
12
+ }());
13
+ exports.LogLancamentoFirestoreData = LogLancamentoFirestoreData;
14
+ var LogLancamentoFireConvert = /** @class */ (function () {
15
+ function LogLancamentoFireConvert() {
16
+ }
17
+ LogLancamentoFireConvert.fromFirestore = function (doc) {
18
+ var _a, _b, _c;
19
+ return new log_lancamento_1.LogLancamento({
20
+ _id: (_a = doc.id) !== null && _a !== void 0 ? _a : null,
21
+ _path: (_b = doc.ref.path) !== null && _b !== void 0 ? _b : null,
22
+ data: (0, type_guards_1.TipoTimestampFirestore)(doc.get('jornada.data'))
23
+ ? doc.get('data_inicial').toDate()
24
+ : null,
25
+ jornada: {
26
+ ref: (0, type_guards_1.TipoDocumentReference)(doc.get('ref'))
27
+ ? doc.get('ref').path
28
+ : null,
29
+ data: (0, type_guards_1.TipoTimestampFirestore)(doc.get('jornada.data'))
30
+ ? doc.get('data_inicial').toDate()
31
+ : null,
32
+ },
33
+ mensagem: string_helper_1.StringHelper.trim(doc.get('mensagem'), null),
34
+ status: string_helper_1.StringHelper.trim(doc.get('status'), null),
35
+ detalhes: (_c = doc.get('detalhes')) !== null && _c !== void 0 ? _c : null,
36
+ });
37
+ };
38
+ LogLancamentoFireConvert.toFirestore = function (logLancamento, timestampfromDate, documentReferenceFromPath) {
39
+ var logLancamentoFirestore = {
40
+ mensagem: logLancamento.mensagem,
41
+ detalhes: logLancamento.detalhes,
42
+ status: logLancamento.status,
43
+ data: timestampfromDate(logLancamento.data),
44
+ jornada: {
45
+ data: timestampfromDate(logLancamento.jornada.data),
46
+ ref: documentReferenceFromPath(logLancamento.jornada.ref),
47
+ },
48
+ };
49
+ return (0, lodash_1.omitBy)(logLancamentoFirestore, lodash_1.isUndefined);
50
+ };
51
+ return LogLancamentoFireConvert;
52
+ }());
53
+ exports.LogLancamentoFireConvert = LogLancamentoFireConvert;
@@ -0,0 +1,41 @@
1
+ export declare enum LogLancamentoStatusEnum {
2
+ SUCESSO = "SUCESSO",
3
+ ERRO = "ERRO"
4
+ }
5
+ export interface LogLancamentoBase {
6
+ data: any;
7
+ mensagem: any;
8
+ detalhes: any;
9
+ status: any;
10
+ jornada: {
11
+ data: any;
12
+ ref: any;
13
+ };
14
+ }
15
+ /**
16
+ * Internal class col contas/${contaId}/lancamento/${lancamentoId}/logs_lancamento/${usuarioId}.
17
+ *
18
+ * @export
19
+ * @class UsuarioLancamento
20
+ * @implements {LogLancamentoBase}
21
+ */
22
+ export declare class LogLancamento implements LogLancamentoBase {
23
+ _id: string;
24
+ _path: string;
25
+ data: Date;
26
+ mensagem: string;
27
+ detalhes: {
28
+ [key: string]: any;
29
+ };
30
+ status: LogLancamentoStatusEnum;
31
+ jornada: {
32
+ data: Date;
33
+ ref: string;
34
+ };
35
+ /**
36
+ * Creates an instance of UsuarioLancamento.
37
+ * @param {Partial<LogLancamento>} usuarioLancamentoPayload
38
+ * @memberof Lancamento
39
+ */
40
+ constructor(usuarioLancamentoPayload: Partial<LogLancamento>);
41
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogLancamento = exports.LogLancamentoStatusEnum = void 0;
4
+ var LogLancamentoStatusEnum;
5
+ (function (LogLancamentoStatusEnum) {
6
+ LogLancamentoStatusEnum["SUCESSO"] = "SUCESSO";
7
+ LogLancamentoStatusEnum["ERRO"] = "ERRO";
8
+ })(LogLancamentoStatusEnum = exports.LogLancamentoStatusEnum || (exports.LogLancamentoStatusEnum = {}));
9
+ /**
10
+ * Internal class col contas/${contaId}/lancamento/${lancamentoId}/logs_lancamento/${usuarioId}.
11
+ *
12
+ * @export
13
+ * @class UsuarioLancamento
14
+ * @implements {LogLancamentoBase}
15
+ */
16
+ var LogLancamento = /** @class */ (function () {
17
+ /**
18
+ * Creates an instance of UsuarioLancamento.
19
+ * @param {Partial<LogLancamento>} usuarioLancamentoPayload
20
+ * @memberof Lancamento
21
+ */
22
+ function LogLancamento(usuarioLancamentoPayload) {
23
+ var _this = this;
24
+ var keysOfProps = ["status", "_id", "_path", "data", "mensagem", "detalhes", "jornada"];
25
+ keysOfProps.forEach(function (key) {
26
+ _this[key] = usuarioLancamentoPayload
27
+ ? usuarioLancamentoPayload[key]
28
+ : undefined;
29
+ });
30
+ }
31
+ return LogLancamento;
32
+ }());
33
+ exports.LogLancamento = LogLancamento;
@@ -0,0 +1,12 @@
1
+ import { DocumentReference, DocumentSnapshot, QueryDocumentSnapshot } from 'firebase/firestore';
2
+ import { UsuarioLancamento, UsuarioLancamentoBase } from './usuario-lancamento';
3
+ export declare class UsuarioLancamentoFirestoreData implements UsuarioLancamentoBase {
4
+ documento: string;
5
+ nome_completo: string;
6
+ nome: string;
7
+ ref: DocumentReference;
8
+ }
9
+ export declare abstract class UsuarioLancamentoFireConvert {
10
+ static fromFirestore(doc: DocumentSnapshot<UsuarioLancamentoFirestoreData> | QueryDocumentSnapshot<UsuarioLancamentoFirestoreData>): UsuarioLancamento;
11
+ static toFirestore(usuarioLancamento: UsuarioLancamento, documentReferenceFromPath: (path: string) => DocumentReference<any>): Partial<UsuarioLancamentoFirestoreData>;
12
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsuarioLancamentoFireConvert = exports.UsuarioLancamentoFirestoreData = void 0;
4
+ var lodash_1 = require("lodash");
5
+ var string_helper_1 = require("../../../utils/string-helper");
6
+ var type_guards_1 = require("../../../utils/type-guards");
7
+ var usuario_lancamento_1 = require("./usuario-lancamento");
8
+ var UsuarioLancamentoFirestoreData = /** @class */ (function () {
9
+ function UsuarioLancamentoFirestoreData() {
10
+ }
11
+ return UsuarioLancamentoFirestoreData;
12
+ }());
13
+ exports.UsuarioLancamentoFirestoreData = UsuarioLancamentoFirestoreData;
14
+ var UsuarioLancamentoFireConvert = /** @class */ (function () {
15
+ function UsuarioLancamentoFireConvert() {
16
+ }
17
+ UsuarioLancamentoFireConvert.fromFirestore = function (doc) {
18
+ var _a, _b;
19
+ return new usuario_lancamento_1.UsuarioLancamento({
20
+ _id: (_a = doc.id) !== null && _a !== void 0 ? _a : null,
21
+ _path: (_b = doc.ref.path) !== null && _b !== void 0 ? _b : null,
22
+ ref: (0, type_guards_1.TipoDocumentReference)(doc.get('ref'))
23
+ ? doc.get('ref').path
24
+ : null,
25
+ documento: string_helper_1.StringHelper.trim(doc.get('documento'), null),
26
+ nome_completo: string_helper_1.StringHelper.trim(doc.get('nome_completo'), null),
27
+ nome: string_helper_1.StringHelper.trim(doc.get('nome'), null),
28
+ });
29
+ };
30
+ UsuarioLancamentoFireConvert.toFirestore = function (usuarioLancamento, documentReferenceFromPath) {
31
+ var usuarioLancamentoFirestore = {
32
+ documento: usuarioLancamento.documento,
33
+ nome_completo: usuarioLancamento.nome_completo,
34
+ nome: usuarioLancamento.nome,
35
+ ref: documentReferenceFromPath(usuarioLancamento.ref),
36
+ };
37
+ return (0, lodash_1.omitBy)(usuarioLancamentoFirestore, lodash_1.isUndefined);
38
+ };
39
+ return UsuarioLancamentoFireConvert;
40
+ }());
41
+ exports.UsuarioLancamentoFireConvert = UsuarioLancamentoFireConvert;
@@ -0,0 +1,27 @@
1
+ export interface UsuarioLancamentoBase {
2
+ documento: any;
3
+ nome_completo: any;
4
+ nome: any;
5
+ ref: any;
6
+ }
7
+ /**
8
+ * Internal class col contas/${contaId}/lancamento/${lancamentoId}/usuarios_lancamento/${usuarioId}.
9
+ *
10
+ * @export
11
+ * @class UsuarioLancamento
12
+ * @implements {UsuarioLancamentoBase}
13
+ */
14
+ export declare class UsuarioLancamento implements UsuarioLancamentoBase {
15
+ _id: string;
16
+ _path: string;
17
+ documento: string;
18
+ nome_completo: string;
19
+ nome: string;
20
+ ref: string;
21
+ /**
22
+ * Creates an instance of UsuarioLancamento.
23
+ * @param {Partial<UsuarioLancamento>} usuarioLancamentoPayload
24
+ * @memberof Lancamento
25
+ */
26
+ constructor(usuarioLancamentoPayload: Partial<UsuarioLancamento>);
27
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsuarioLancamento = void 0;
4
+ /**
5
+ * Internal class col contas/${contaId}/lancamento/${lancamentoId}/usuarios_lancamento/${usuarioId}.
6
+ *
7
+ * @export
8
+ * @class UsuarioLancamento
9
+ * @implements {UsuarioLancamentoBase}
10
+ */
11
+ var UsuarioLancamento = /** @class */ (function () {
12
+ /**
13
+ * Creates an instance of UsuarioLancamento.
14
+ * @param {Partial<UsuarioLancamento>} usuarioLancamentoPayload
15
+ * @memberof Lancamento
16
+ */
17
+ function UsuarioLancamento(usuarioLancamentoPayload) {
18
+ var _this = this;
19
+ var keysOfProps = ["_id", "_path", "documento", "nome", "ref", "nome_completo"];
20
+ keysOfProps.forEach(function (key) {
21
+ _this[key] = usuarioLancamentoPayload
22
+ ? usuarioLancamentoPayload[key]
23
+ : undefined;
24
+ });
25
+ }
26
+ return UsuarioLancamento;
27
+ }());
28
+ exports.UsuarioLancamento = UsuarioLancamento;
@@ -0,0 +1,12 @@
1
+ export declare enum TiposOcorrenciaFrequenciaEnum {
2
+ Abono = "Abono",
3
+ Afastado = "Afastado",
4
+ Atestado = "Atestado",
5
+ DiaTrabalhado = "Dia trabalhado",
6
+ Falta = "Falta",
7
+ FaltaBH = "Falta BH",
8
+ Ferias = "F\u00E9rias",
9
+ Folga = "Folga",
10
+ JornadaExterna = "Jornada externa",
11
+ Suspensao = "Suspens\u00E3o"
12
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TiposOcorrenciaFrequenciaEnum = void 0;
4
+ var TiposOcorrenciaFrequenciaEnum;
5
+ (function (TiposOcorrenciaFrequenciaEnum) {
6
+ TiposOcorrenciaFrequenciaEnum["Abono"] = "Abono";
7
+ TiposOcorrenciaFrequenciaEnum["Afastado"] = "Afastado";
8
+ TiposOcorrenciaFrequenciaEnum["Atestado"] = "Atestado";
9
+ TiposOcorrenciaFrequenciaEnum["DiaTrabalhado"] = "Dia trabalhado";
10
+ TiposOcorrenciaFrequenciaEnum["Falta"] = "Falta";
11
+ TiposOcorrenciaFrequenciaEnum["FaltaBH"] = "Falta BH";
12
+ TiposOcorrenciaFrequenciaEnum["Ferias"] = "F\u00E9rias";
13
+ TiposOcorrenciaFrequenciaEnum["Folga"] = "Folga";
14
+ TiposOcorrenciaFrequenciaEnum["JornadaExterna"] = "Jornada externa";
15
+ TiposOcorrenciaFrequenciaEnum["Suspensao"] = "Suspens\u00E3o";
16
+ })(TiposOcorrenciaFrequenciaEnum = exports.TiposOcorrenciaFrequenciaEnum || (exports.TiposOcorrenciaFrequenciaEnum = {}));
@@ -1,2 +1,3 @@
1
1
  export * from './contas/excecoes';
2
2
  export * from './contas/feriado';
3
+ export * from './contas/lancamento';
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -12,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./contas/excecoes"), exports);
14
18
  __exportStar(require("./contas/feriado"), exports);
19
+ __exportStar(require("./contas/lancamento"), exports);
@@ -9,9 +9,8 @@ exports.TipoDocumentReference = exports.TipoTimestampFirestore = void 0;
9
9
  * @return {*} {timestamp is Timestamp}
10
10
  */
11
11
  function TipoTimestampFirestore(timestamp) {
12
- var _a, _b;
13
- return (((_a = timestamp) === null || _a === void 0 ? void 0 : _a.seconds) !== undefined &&
14
- ((_b = timestamp) === null || _b === void 0 ? void 0 : _b.nanoseconds) !== undefined);
12
+ return ((timestamp === null || timestamp === void 0 ? void 0 : timestamp.seconds) !== undefined &&
13
+ (timestamp === null || timestamp === void 0 ? void 0 : timestamp.nanoseconds) !== undefined);
15
14
  }
16
15
  exports.TipoTimestampFirestore = TipoTimestampFirestore;
17
16
  /**
@@ -22,8 +21,7 @@ exports.TipoTimestampFirestore = TipoTimestampFirestore;
22
21
  * @return {*} {timestamp is DocumentReference}
23
22
  */
24
23
  function TipoDocumentReference(timestamp) {
25
- var _a, _b;
26
- return (((_a = timestamp) === null || _a === void 0 ? void 0 : _a.id) !== undefined &&
27
- ((_b = timestamp) === null || _b === void 0 ? void 0 : _b.path) !== undefined);
24
+ return ((timestamp === null || timestamp === void 0 ? void 0 : timestamp.id) !== undefined &&
25
+ (timestamp === null || timestamp === void 0 ? void 0 : timestamp.path) !== undefined);
28
26
  }
29
27
  exports.TipoDocumentReference = TipoDocumentReference;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flit-models",
3
- "version": "2.1.6",
3
+ "version": "2.1.9",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -23,25 +23,25 @@
23
23
  "author": "gustavo_damazio",
24
24
  "license": "ISC",
25
25
  "dependencies": {
26
- "firebase": "^9.6.5",
26
+ "firebase": "^9.6.8",
27
27
  "lodash": "^4.17.21",
28
28
  "ts-transformer-keys": "^0.4.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/jest": "^27.4.0",
32
- "@types/lodash": "^4.14.178",
33
- "@typescript-eslint/eslint-plugin": "^5.10.2",
34
- "@typescript-eslint/parser": "^5.10.2",
35
- "eslint": "^8.8.0",
31
+ "@types/jest": "^27.4.1",
32
+ "@types/lodash": "^4.14.179",
33
+ "@typescript-eslint/eslint-plugin": "^5.14.0",
34
+ "@typescript-eslint/parser": "^5.14.0",
35
+ "eslint": "^8.10.0",
36
36
  "eslint-config-google": "^0.14.0",
37
- "eslint-config-prettier": "^8.3.0",
37
+ "eslint-config-prettier": "^8.5.0",
38
38
  "eslint-plugin-import": "^2.25.4",
39
- "eslint-plugin-jest": "^26.0.0",
39
+ "eslint-plugin-jest": "^26.1.1",
40
40
  "eslint-plugin-prettier": "^4.0.0",
41
- "jest": "^27.4.7",
41
+ "jest": "^27.5.1",
42
42
  "prettier": "^2.5.1",
43
43
  "ts-jest": "^27.1.3",
44
44
  "ttypescript": "^1.5.13",
45
- "typescript": "^4.5.5"
45
+ "typescript": "^4.6.2"
46
46
  }
47
47
  }