@driveup/schema 0.3.4 → 0.3.6

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/index.d.ts CHANGED
@@ -47,6 +47,9 @@ export * from './profile/student/program/training/lesson.entity';
47
47
  export * from './profile/student/program/training/request.entity';
48
48
  export * from './profile/student/program/training/topic.entity';
49
49
  export * from './profile/student/program/training/training.entity';
50
+ export * from './profile/student/program/training/training-balance.view';
51
+ export * from './profile/student/program/training/training-cost.view';
52
+ export * from './profile/student/program/training/training-sessions.view';
50
53
  export * from './profile/student/program/training/transaction.entity';
51
54
  export * from './profile/student/program/program.entity';
52
55
  export * from './profile/student/student.entity';
package/lib/index.js CHANGED
@@ -68,6 +68,9 @@ __exportStar(require("./profile/student/program/training/lesson.entity"), export
68
68
  __exportStar(require("./profile/student/program/training/request.entity"), exports);
69
69
  __exportStar(require("./profile/student/program/training/topic.entity"), exports);
70
70
  __exportStar(require("./profile/student/program/training/training.entity"), exports);
71
+ __exportStar(require("./profile/student/program/training/training-balance.view"), exports);
72
+ __exportStar(require("./profile/student/program/training/training-cost.view"), exports);
73
+ __exportStar(require("./profile/student/program/training/training-sessions.view"), exports);
71
74
  __exportStar(require("./profile/student/program/training/transaction.entity"), exports);
72
75
  __exportStar(require("./profile/student/program/program.entity"), exports);
73
76
  __exportStar(require("./profile/student/student.entity"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,UAAU;AACV,+DAA6C;AAC7C,iEAA+C;AAC/C,uEAAqD;AACrD,mEAAiD;AACjD,qEAAmD;AACnD,mEAAiD;AACjD,mEAAiD;AACjD,qEAAmD;AACnD,uEAAqD;AACrD,uEAAqD;AACrD,sEAAoD;AACpD,yEAAuD;AACvD,iBAAiB;AACjB,+DAA6C;AAC7C,+DAA6C;AAC7C,gEAA8C;AAC9C,mEAAiD;AACjD,mBAAmB;AACnB,2EAAyD;AACzD,yEAAuD;AACvD,yEAAuD;AACvD,wEAAsD;AACtD,iFAA+D;AAC/D,iFAA+D;AAC/D,wFAAsE;AACtE,qFAAmE;AACnE,oFAAkE;AAClE,sFAAoE;AACpE,oFAAkE;AAClE,iFAA+D;AAC/D,mFAAiE;AACjE,+EAA6D;AAC7D,iFAA+D;AAC/D,2EAAyD;AACzD,+EAA6D;AAC7D,2EAAyD;AACzD,yEAAuD;AACvD,6EAA2D;AAC3D,2EAAyD;AACzD,2EAAyD;AACzD,mEAAiD;AACjD,sBAAsB;AACtB,yEAAuD;AACvD,oBAAoB;AACpB,mFAAiE;AACjE,uFAAqE;AACrE,uFAAqE;AACrE,wFAAsE;AACtE,iFAA+D;AAC/D,mFAAiE;AACjE,oFAAkE;AAClE,kFAAgE;AAChE,qFAAmE;AACnE,wFAAsE;AACtE,2EAAyD;AACzD,mEAAiD;AACjD,SAAS;AACT,sDAAoC;AACpC,0DAAwC;AACxC,+DAA6C;AAC7C,+DAA6C;AAC7C,8DAA4C;AAC5C,SAAS;AACT,oEAAkD;AAClD,mEAAiD;AACjD,kEAAgD;AAChD,oEAAkD;AAClD,mEAAiD;AACjD,kEAAgD;AAChD,8DAA4C;AAC5C,4DAA0C;AAC1C,4DAA0C;AAC1C,gEAA8C;AAC9C,8DAA4C;AAC5C,sDAAoC;AACpC,wDAAsC;AACtC,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC;AACrC,qDAAmC;AACnC,6DAA2C;AAC3C,QAAQ;AACR,0DAAwC;AACxC,4DAA0C;AAC1C,4DAA0C;AAC1C,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,UAAU;AACV,+DAA6C;AAC7C,iEAA+C;AAC/C,uEAAqD;AACrD,mEAAiD;AACjD,qEAAmD;AACnD,mEAAiD;AACjD,mEAAiD;AACjD,qEAAmD;AACnD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) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TrainingBalanceView = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
+ // training balance = (training cost) + (total paid) - (sum of refunds)
15
+ // training cost = (administration fee) + (total sessions costs) - (sum of discounts)
14
16
  let TrainingBalanceView = class TrainingBalanceView {
15
17
  };
16
18
  exports.TrainingBalanceView = TrainingBalanceView;
@@ -25,12 +27,20 @@ __decorate([
25
27
  exports.TrainingBalanceView = TrainingBalanceView = __decorate([
26
28
  (0, typeorm_1.ViewEntity)({
27
29
  name: 'training_balance_view',
28
- dependsOn: ['training_sessions_view'],
30
+ dependsOn: ['training_sessions_view', 'training_cost_view'],
29
31
  expression: `
30
32
  SELECT
31
-
32
- FROM studentTrainings t
33
- INNER JOIN
33
+ t.id AS trainingId,
34
+ (
35
+ COALESCE(tcv.cost, 0)
36
+ + COALESCE(t.paid, 0)
37
+ - COALESCE(t.refund, 0)
38
+ ) AS balance
39
+ FROM
40
+ studentTrainings t
41
+ LEFT JOIN
42
+ training_cost_view tcv
43
+ ON t.id = tcv.trainingId
34
44
  `
35
45
  })
36
46
  ], TrainingBalanceView);
@@ -1 +1 @@
1
- {"version":3,"file":"training-balance.view.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/training-balance.view.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiD;AAY1C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAO/B,CAAA;AAPY,kDAAmB;AAG/B;IADC,IAAA,oBAAU,GAAE;;uDACM;AAGnB;IADC,IAAA,oBAAU,GAAE;;oDACG;8BANJ,mBAAmB;IAV/B,IAAA,oBAAU,EAAC;QACX,IAAI,EAAE,uBAAuB;QAC7B,SAAS,EAAE,CAAC,wBAAwB,CAAC;QACrC,UAAU,EAAE;;;;;EAKX;KACD,CAAC;GACW,mBAAmB,CAO/B"}
1
+ {"version":3,"file":"training-balance.view.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/training-balance.view.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiD;AAEjD,uEAAuE;AACvE,qFAAqF;AAoB9E,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAO/B,CAAA;AAPY,kDAAmB;AAG/B;IADC,IAAA,oBAAU,GAAE;;uDACM;AAGnB;IADC,IAAA,oBAAU,GAAE;;oDACG;8BANJ,mBAAmB;IAlB/B,IAAA,oBAAU,EAAC;QACX,IAAI,EAAE,uBAAuB;QAC7B,SAAS,EAAE,CAAC,wBAAwB,EAAE,oBAAoB,CAAC;QAC3D,UAAU,EAAE;;;;;;;;;;;;;EAaX;KACD,CAAC;GACW,mBAAmB,CAO/B"}