@procxo/shared 1.0.2 → 1.0.4
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/package.json +4 -2
- package/src/config/index.ts +5 -0
- package/src/config/ormconfig.factory.ts +102 -0
- package/src/config/typeorm.config.ts +22 -0
- package/src/core/constant/index.ts +1 -0
- package/src/core/constant/notification-preference.ts +113 -0
- package/src/core/json/core-data/currency.json +8 -0
- package/{dist → src}/core/json/core-data/department.json +38 -38
- package/{dist → src}/core/json/core-data/permission.json +898 -898
- package/src/core/json/core-data/role.json +30 -0
- package/src/core/json/core-data/user.json +12 -0
- package/src/core/json/geographic-data/cities.json +54693 -0
- package/src/core/json/geographic-data/countries.json +31 -0
- package/src/database/entities/activity-logs.entity.ts +31 -0
- package/src/database/entities/address.entity.ts +31 -0
- package/src/database/entities/alert.entity.ts +139 -0
- package/src/database/entities/approval-condition.entity.ts +48 -0
- package/src/database/entities/approval-hierarchy-role.entity.ts +24 -0
- package/src/database/entities/approval-hierarchy-user.entity.ts +24 -0
- package/src/database/entities/approval-hierarchy.entity.ts +59 -0
- package/src/database/entities/approval-journey.entity.ts +75 -0
- package/src/database/entities/approval-level-escalation-user.entity.ts +23 -0
- package/src/database/entities/approval-level-escalation.entity.ts +45 -0
- package/src/database/entities/approval-level-user.entity.ts +25 -0
- package/src/database/entities/approval-level.entity.ts +51 -0
- package/src/database/entities/base.entity.ts +31 -0
- package/src/database/entities/chat.entity.ts +36 -0
- package/src/database/entities/city.entity.ts +25 -0
- package/src/database/entities/client.entity.ts +91 -0
- package/src/database/entities/contact.entity.ts +27 -0
- package/src/database/entities/country.entity.ts +69 -0
- package/src/database/entities/credit-note.entity.ts +88 -0
- package/src/database/entities/currency.entity.ts +21 -0
- package/src/database/entities/department.entity.ts +21 -0
- package/src/database/entities/entitlement.entity.ts +64 -0
- package/src/database/entities/expense.entity.ts +141 -0
- package/src/database/entities/file.entity.ts +22 -0
- package/src/database/entities/fixed-invoice-item.entity.ts +29 -0
- package/src/database/entities/group.entity.ts +21 -0
- package/src/database/entities/gst.entity.ts +32 -0
- package/src/database/entities/holiday.entity.ts +51 -0
- package/{dist/database/entities/index.d.ts → src/database/entities/index.ts} +79 -78
- package/src/database/entities/invoice-template-footer.entity.ts +70 -0
- package/src/database/entities/invoice-template-header.entity.ts +34 -0
- package/src/database/entities/invoice-template-table.entity.ts +83 -0
- package/src/database/entities/invoice-template.entity.ts +119 -0
- package/src/database/entities/invoice.entity.ts +139 -0
- package/src/database/entities/invoice_item.entity.ts +69 -0
- package/src/database/entities/leave-balance.entity.ts +118 -0
- package/src/database/entities/leave-request.entity.ts +155 -0
- package/src/database/entities/leave-type.entity.ts +37 -0
- package/src/database/entities/matter-tag.entity.ts +21 -0
- package/src/database/entities/matter-task-view-filter.entity.ts +21 -0
- package/src/database/entities/matter-team-member.entity.ts +30 -0
- package/src/database/entities/matter.entity.ts +156 -0
- package/src/database/entities/payment.entity.ts +72 -0
- package/src/database/entities/permission.entity.ts +27 -0
- package/src/database/entities/quickbooks-connection.entity.ts +35 -0
- package/src/database/entities/quickbooks-sync-log.entity.ts +79 -0
- package/src/database/entities/role-permission.entity.ts +30 -0
- package/src/database/entities/role-shift.entity.ts +43 -0
- package/src/database/entities/role.entity.ts +30 -0
- package/src/database/entities/sequence-generator.entity.ts +40 -0
- package/src/database/entities/shift.entity.ts +72 -0
- package/src/database/entities/sub-task-tag.entity.ts +22 -0
- package/src/database/entities/subtask-user.entity.ts +21 -0
- package/src/database/entities/subtask.entity.ts +125 -0
- package/src/database/entities/summary-task-status.entity.ts +15 -0
- package/src/database/entities/superset.entity.ts +38 -0
- package/src/database/entities/tag.entity.ts +19 -0
- package/src/database/entities/task-comment.entity.ts +41 -0
- package/src/database/entities/task-milestone.entity.ts +14 -0
- package/src/database/entities/task-remainder.entity.ts +29 -0
- package/src/database/entities/task-tag.entity.ts +22 -0
- package/src/database/entities/task-type.entity.ts +14 -0
- package/src/database/entities/task-user.entity.ts +21 -0
- package/src/database/entities/task.entity.ts +176 -0
- package/src/database/entities/template-task.entity.ts +25 -0
- package/src/database/entities/template.entity.ts +28 -0
- package/src/database/entities/timesheet-comment.entity.ts +45 -0
- package/src/database/entities/timesheet-event.entity.ts +256 -0
- package/src/database/entities/timesheet-summary.entity.ts +101 -0
- package/src/database/entities/timesheet.entity.ts +76 -0
- package/src/database/entities/transfer-ownership.entity.ts +39 -0
- package/src/database/entities/upload-log.entity.ts +78 -0
- package/src/database/entities/user-notification-channel.entity.ts +43 -0
- package/src/database/entities/user-notification-preference.entity.ts +50 -0
- package/src/database/entities/user-role.entity.ts +25 -0
- package/src/database/entities/user-session-history.entity.ts +45 -0
- package/src/database/entities/user-shift.entity.ts +109 -0
- package/src/database/entities/user.entity.ts +198 -0
- package/src/database/index.ts +1 -0
- package/{dist/database/migrations/1770706648232-initialMigration.js → src/database/migrations/1770706648232-initialMigration.ts} +9 -9
- package/src/database/seeder/base.seed.ts +104 -0
- package/src/database/seeder/config/seeder.config.ts +26 -0
- package/src/database/seeder/errors/seeder.error.ts +20 -0
- package/src/database/seeder/seed-runner.ts +200 -0
- package/src/database/seeder/seeds/city.seed.ts +70 -0
- package/src/database/seeder/seeds/country.seed.ts +58 -0
- package/src/database/seeder/seeds/currency.seed.ts +52 -0
- package/src/database/seeder/seeds/department.seed.ts +47 -0
- package/src/database/seeder/seeds/permission.seed.ts +54 -0
- package/src/database/seeder/seeds/role-permission.seed.ts +58 -0
- package/src/database/seeder/seeds/role.seed.ts +52 -0
- package/src/database/seeder/seeds/user-role.seed.ts +72 -0
- package/src/database/seeder/seeds/user.seed.ts +87 -0
- package/{dist/index.d.ts → src/index.ts} +5 -1
- package/src/scripts/create-schema.ts +94 -0
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -7
- package/dist/config/index.js.map +0 -1
- package/dist/config/ormconfig.factory.d.ts +0 -10
- package/dist/config/ormconfig.factory.d.ts.map +0 -1
- package/dist/config/ormconfig.factory.js +0 -47
- package/dist/config/ormconfig.factory.js.map +0 -1
- package/dist/config/typeorm.config.d.ts +0 -4
- package/dist/config/typeorm.config.d.ts.map +0 -1
- package/dist/config/typeorm.config.js +0 -22
- package/dist/config/typeorm.config.js.map +0 -1
- package/dist/core/constant/index.d.ts +0 -2
- package/dist/core/constant/index.d.ts.map +0 -1
- package/dist/core/constant/index.js +0 -18
- package/dist/core/constant/index.js.map +0 -1
- package/dist/core/constant/notification-preference.d.ts +0 -29
- package/dist/core/constant/notification-preference.d.ts.map +0 -1
- package/dist/core/constant/notification-preference.js +0 -81
- package/dist/core/constant/notification-preference.js.map +0 -1
- package/dist/core/json/core-data/currency.json +0 -8
- package/dist/core/json/core-data/role.json +0 -30
- package/dist/core/json/core-data/user.json +0 -12
- package/dist/core/json/geographic-data/cities.json +0 -54693
- package/dist/core/json/geographic-data/countries.json +0 -31
- package/dist/database/entities/activity-logs.entity.d.ts +0 -11
- package/dist/database/entities/activity-logs.entity.d.ts.map +0 -1
- package/dist/database/entities/activity-logs.entity.js +0 -56
- package/dist/database/entities/activity-logs.entity.js.map +0 -1
- package/dist/database/entities/address.entity.d.ts +0 -13
- package/dist/database/entities/address.entity.d.ts.map +0 -1
- package/dist/database/entities/address.entity.js +0 -63
- package/dist/database/entities/address.entity.js.map +0 -1
- package/dist/database/entities/alert.entity.d.ts +0 -37
- package/dist/database/entities/alert.entity.d.ts.map +0 -1
- package/dist/database/entities/alert.entity.js +0 -171
- package/dist/database/entities/alert.entity.js.map +0 -1
- package/dist/database/entities/approval-condition.entity.d.ts +0 -16
- package/dist/database/entities/approval-condition.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-condition.entity.js +0 -66
- package/dist/database/entities/approval-condition.entity.js.map +0 -1
- package/dist/database/entities/approval-hierarchy-role.entity.d.ts +0 -10
- package/dist/database/entities/approval-hierarchy-role.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-hierarchy-role.entity.js +0 -47
- package/dist/database/entities/approval-hierarchy-role.entity.js.map +0 -1
- package/dist/database/entities/approval-hierarchy-user.entity.d.ts +0 -10
- package/dist/database/entities/approval-hierarchy-user.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-hierarchy-user.entity.js +0 -47
- package/dist/database/entities/approval-hierarchy-user.entity.js.map +0 -1
- package/dist/database/entities/approval-hierarchy.entity.d.ts +0 -22
- package/dist/database/entities/approval-hierarchy.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-hierarchy.entity.js +0 -80
- package/dist/database/entities/approval-hierarchy.entity.js.map +0 -1
- package/dist/database/entities/approval-journey.entity.d.ts +0 -32
- package/dist/database/entities/approval-journey.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-journey.entity.js +0 -125
- package/dist/database/entities/approval-journey.entity.js.map +0 -1
- package/dist/database/entities/approval-level-escalation-user.entity.d.ts +0 -10
- package/dist/database/entities/approval-level-escalation-user.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-level-escalation-user.entity.js +0 -47
- package/dist/database/entities/approval-level-escalation-user.entity.js.map +0 -1
- package/dist/database/entities/approval-level-escalation.entity.d.ts +0 -14
- package/dist/database/entities/approval-level-escalation.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-level-escalation.entity.js +0 -65
- package/dist/database/entities/approval-level-escalation.entity.js.map +0 -1
- package/dist/database/entities/approval-level-user.entity.d.ts +0 -10
- package/dist/database/entities/approval-level-user.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-level-user.entity.js +0 -49
- package/dist/database/entities/approval-level-user.entity.js.map +0 -1
- package/dist/database/entities/approval-level.entity.d.ts +0 -17
- package/dist/database/entities/approval-level.entity.d.ts.map +0 -1
- package/dist/database/entities/approval-level.entity.js +0 -76
- package/dist/database/entities/approval-level.entity.js.map +0 -1
- package/dist/database/entities/base.entity.d.ts +0 -12
- package/dist/database/entities/base.entity.d.ts.map +0 -1
- package/dist/database/entities/base.entity.js +0 -63
- package/dist/database/entities/base.entity.js.map +0 -1
- package/dist/database/entities/chat.entity.d.ts +0 -13
- package/dist/database/entities/chat.entity.d.ts.map +0 -1
- package/dist/database/entities/chat.entity.js +0 -67
- package/dist/database/entities/chat.entity.js.map +0 -1
- package/dist/database/entities/city.entity.d.ts +0 -11
- package/dist/database/entities/city.entity.d.ts.map +0 -1
- package/dist/database/entities/city.entity.js +0 -53
- package/dist/database/entities/city.entity.js.map +0 -1
- package/dist/database/entities/client.entity.d.ts +0 -40
- package/dist/database/entities/client.entity.d.ts.map +0 -1
- package/dist/database/entities/client.entity.js +0 -146
- package/dist/database/entities/client.entity.js.map +0 -1
- package/dist/database/entities/contact.entity.d.ts +0 -12
- package/dist/database/entities/contact.entity.d.ts.map +0 -1
- package/dist/database/entities/contact.entity.js +0 -57
- package/dist/database/entities/contact.entity.js.map +0 -1
- package/dist/database/entities/country.entity.d.ts +0 -26
- package/dist/database/entities/country.entity.d.ts.map +0 -1
- package/dist/database/entities/country.entity.js +0 -127
- package/dist/database/entities/country.entity.js.map +0 -1
- package/dist/database/entities/credit-note.entity.d.ts +0 -35
- package/dist/database/entities/credit-note.entity.d.ts.map +0 -1
- package/dist/database/entities/credit-note.entity.js +0 -144
- package/dist/database/entities/credit-note.entity.js.map +0 -1
- package/dist/database/entities/currency.entity.d.ts +0 -10
- package/dist/database/entities/currency.entity.d.ts.map +0 -1
- package/dist/database/entities/currency.entity.js +0 -47
- package/dist/database/entities/currency.entity.js.map +0 -1
- package/dist/database/entities/department.entity.d.ts +0 -10
- package/dist/database/entities/department.entity.d.ts.map +0 -1
- package/dist/database/entities/department.entity.js +0 -47
- package/dist/database/entities/department.entity.js.map +0 -1
- package/dist/database/entities/entitlement.entity.d.ts +0 -24
- package/dist/database/entities/entitlement.entity.d.ts.map +0 -1
- package/dist/database/entities/entitlement.entity.js +0 -106
- package/dist/database/entities/entitlement.entity.js.map +0 -1
- package/dist/database/entities/expense.entity.d.ts +0 -47
- package/dist/database/entities/expense.entity.d.ts.map +0 -1
- package/dist/database/entities/expense.entity.js +0 -221
- package/dist/database/entities/expense.entity.js.map +0 -1
- package/dist/database/entities/file.entity.d.ts +0 -9
- package/dist/database/entities/file.entity.d.ts.map +0 -1
- package/dist/database/entities/file.entity.js +0 -46
- package/dist/database/entities/file.entity.js.map +0 -1
- package/dist/database/entities/fixed-invoice-item.entity.d.ts +0 -9
- package/dist/database/entities/fixed-invoice-item.entity.d.ts.map +0 -1
- package/dist/database/entities/fixed-invoice-item.entity.js +0 -52
- package/dist/database/entities/fixed-invoice-item.entity.js.map +0 -1
- package/dist/database/entities/group.entity.d.ts +0 -9
- package/dist/database/entities/group.entity.d.ts.map +0 -1
- package/dist/database/entities/group.entity.js +0 -45
- package/dist/database/entities/group.entity.js.map +0 -1
- package/dist/database/entities/gst.entity.d.ts +0 -6
- package/dist/database/entities/gst.entity.d.ts.map +0 -1
- package/dist/database/entities/gst.entity.js +0 -44
- package/dist/database/entities/gst.entity.js.map +0 -1
- package/dist/database/entities/holiday.entity.d.ts +0 -14
- package/dist/database/entities/holiday.entity.d.ts.map +0 -1
- package/dist/database/entities/holiday.entity.js +0 -79
- package/dist/database/entities/holiday.entity.js.map +0 -1
- package/dist/database/entities/index.d.ts.map +0 -1
- package/dist/database/entities/index.js +0 -94
- package/dist/database/entities/index.js.map +0 -1
- package/dist/database/entities/invoice-template-footer.entity.d.ts +0 -24
- package/dist/database/entities/invoice-template-footer.entity.d.ts.map +0 -1
- package/dist/database/entities/invoice-template-footer.entity.js +0 -118
- package/dist/database/entities/invoice-template-footer.entity.js.map +0 -1
- package/dist/database/entities/invoice-template-header.entity.d.ts +0 -14
- package/dist/database/entities/invoice-template-header.entity.d.ts.map +0 -1
- package/dist/database/entities/invoice-template-header.entity.js +0 -68
- package/dist/database/entities/invoice-template-header.entity.js.map +0 -1
- package/dist/database/entities/invoice-template-table.entity.d.ts +0 -35
- package/dist/database/entities/invoice-template-table.entity.d.ts.map +0 -1
- package/dist/database/entities/invoice-template-table.entity.js +0 -143
- package/dist/database/entities/invoice-template-table.entity.js.map +0 -1
- package/dist/database/entities/invoice-template.entity.d.ts +0 -39
- package/dist/database/entities/invoice-template.entity.d.ts.map +0 -1
- package/dist/database/entities/invoice-template.entity.js +0 -157
- package/dist/database/entities/invoice-template.entity.js.map +0 -1
- package/dist/database/entities/invoice.entity.d.ts +0 -46
- package/dist/database/entities/invoice.entity.d.ts.map +0 -1
- package/dist/database/entities/invoice.entity.js +0 -212
- package/dist/database/entities/invoice.entity.js.map +0 -1
- package/dist/database/entities/invoice_item.entity.d.ts +0 -22
- package/dist/database/entities/invoice_item.entity.d.ts.map +0 -1
- package/dist/database/entities/invoice_item.entity.js +0 -89
- package/dist/database/entities/invoice_item.entity.js.map +0 -1
- package/dist/database/entities/leave-balance.entity.d.ts +0 -38
- package/dist/database/entities/leave-balance.entity.d.ts.map +0 -1
- package/dist/database/entities/leave-balance.entity.js +0 -166
- package/dist/database/entities/leave-balance.entity.js.map +0 -1
- package/dist/database/entities/leave-request.entity.d.ts +0 -64
- package/dist/database/entities/leave-request.entity.d.ts.map +0 -1
- package/dist/database/entities/leave-request.entity.js +0 -219
- package/dist/database/entities/leave-request.entity.js.map +0 -1
- package/dist/database/entities/leave-type.entity.d.ts +0 -15
- package/dist/database/entities/leave-type.entity.d.ts.map +0 -1
- package/dist/database/entities/leave-type.entity.js +0 -72
- package/dist/database/entities/leave-type.entity.js.map +0 -1
- package/dist/database/entities/matter-tag.entity.d.ts +0 -10
- package/dist/database/entities/matter-tag.entity.d.ts.map +0 -1
- package/dist/database/entities/matter-tag.entity.js +0 -45
- package/dist/database/entities/matter-tag.entity.js.map +0 -1
- package/dist/database/entities/matter-task-view-filter.entity.d.ts +0 -11
- package/dist/database/entities/matter-task-view-filter.entity.d.ts.map +0 -1
- package/dist/database/entities/matter-task-view-filter.entity.js +0 -42
- package/dist/database/entities/matter-task-view-filter.entity.js.map +0 -1
- package/dist/database/entities/matter-team-member.entity.d.ts +0 -11
- package/dist/database/entities/matter-team-member.entity.d.ts.map +0 -1
- package/dist/database/entities/matter-team-member.entity.js +0 -56
- package/dist/database/entities/matter-team-member.entity.js.map +0 -1
- package/dist/database/entities/matter.entity.d.ts +0 -62
- package/dist/database/entities/matter.entity.d.ts.map +0 -1
- package/dist/database/entities/matter.entity.js +0 -249
- package/dist/database/entities/matter.entity.js.map +0 -1
- package/dist/database/entities/payment.entity.d.ts +0 -26
- package/dist/database/entities/payment.entity.d.ts.map +0 -1
- package/dist/database/entities/payment.entity.js +0 -127
- package/dist/database/entities/payment.entity.js.map +0 -1
- package/dist/database/entities/permission.entity.d.ts +0 -11
- package/dist/database/entities/permission.entity.d.ts.map +0 -1
- package/dist/database/entities/permission.entity.js +0 -52
- package/dist/database/entities/permission.entity.js.map +0 -1
- package/dist/database/entities/quickbooks-connection.entity.d.ts +0 -14
- package/dist/database/entities/quickbooks-connection.entity.d.ts.map +0 -1
- package/dist/database/entities/quickbooks-connection.entity.js +0 -71
- package/dist/database/entities/quickbooks-connection.entity.js.map +0 -1
- package/dist/database/entities/quickbooks-sync-log.entity.d.ts +0 -34
- package/dist/database/entities/quickbooks-sync-log.entity.d.ts.map +0 -1
- package/dist/database/entities/quickbooks-sync-log.entity.js +0 -116
- package/dist/database/entities/quickbooks-sync-log.entity.js.map +0 -1
- package/dist/database/entities/role-permission.entity.d.ts +0 -10
- package/dist/database/entities/role-permission.entity.d.ts.map +0 -1
- package/dist/database/entities/role-permission.entity.js +0 -49
- package/dist/database/entities/role-permission.entity.js.map +0 -1
- package/dist/database/entities/role-shift.entity.d.ts +0 -8
- package/dist/database/entities/role-shift.entity.d.ts.map +0 -1
- package/dist/database/entities/role-shift.entity.js +0 -48
- package/dist/database/entities/role-shift.entity.js.map +0 -1
- package/dist/database/entities/role.entity.d.ts +0 -13
- package/dist/database/entities/role.entity.d.ts.map +0 -1
- package/dist/database/entities/role.entity.js +0 -58
- package/dist/database/entities/role.entity.js.map +0 -1
- package/dist/database/entities/sequence-generator.entity.d.ts +0 -8
- package/dist/database/entities/sequence-generator.entity.d.ts.map +0 -1
- package/dist/database/entities/sequence-generator.entity.js +0 -64
- package/dist/database/entities/sequence-generator.entity.js.map +0 -1
- package/dist/database/entities/shift.entity.d.ts +0 -18
- package/dist/database/entities/shift.entity.d.ts.map +0 -1
- package/dist/database/entities/shift.entity.js +0 -110
- package/dist/database/entities/shift.entity.js.map +0 -1
- package/dist/database/entities/sub-task-tag.entity.d.ts +0 -10
- package/dist/database/entities/sub-task-tag.entity.d.ts.map +0 -1
- package/dist/database/entities/sub-task-tag.entity.js +0 -45
- package/dist/database/entities/sub-task-tag.entity.js.map +0 -1
- package/dist/database/entities/subtask-user.entity.d.ts +0 -10
- package/dist/database/entities/subtask-user.entity.d.ts.map +0 -1
- package/dist/database/entities/subtask-user.entity.js +0 -45
- package/dist/database/entities/subtask-user.entity.js.map +0 -1
- package/dist/database/entities/subtask.entity.d.ts +0 -47
- package/dist/database/entities/subtask.entity.d.ts.map +0 -1
- package/dist/database/entities/subtask.entity.js +0 -185
- package/dist/database/entities/subtask.entity.js.map +0 -1
- package/dist/database/entities/summary-task-status.entity.d.ts +0 -7
- package/dist/database/entities/summary-task-status.entity.d.ts.map +0 -1
- package/dist/database/entities/summary-task-status.entity.js +0 -37
- package/dist/database/entities/summary-task-status.entity.js.map +0 -1
- package/dist/database/entities/superset.entity.d.ts +0 -15
- package/dist/database/entities/superset.entity.d.ts.map +0 -1
- package/dist/database/entities/superset.entity.js +0 -73
- package/dist/database/entities/superset.entity.js.map +0 -1
- package/dist/database/entities/tag.entity.d.ts +0 -10
- package/dist/database/entities/tag.entity.d.ts.map +0 -1
- package/dist/database/entities/tag.entity.js +0 -43
- package/dist/database/entities/tag.entity.js.map +0 -1
- package/dist/database/entities/task-comment.entity.d.ts +0 -15
- package/dist/database/entities/task-comment.entity.d.ts.map +0 -1
- package/dist/database/entities/task-comment.entity.js +0 -67
- package/dist/database/entities/task-comment.entity.js.map +0 -1
- package/dist/database/entities/task-milestone.entity.d.ts +0 -7
- package/dist/database/entities/task-milestone.entity.d.ts.map +0 -1
- package/dist/database/entities/task-milestone.entity.js +0 -36
- package/dist/database/entities/task-milestone.entity.js.map +0 -1
- package/dist/database/entities/task-remainder.entity.d.ts +0 -12
- package/dist/database/entities/task-remainder.entity.d.ts.map +0 -1
- package/dist/database/entities/task-remainder.entity.js +0 -57
- package/dist/database/entities/task-remainder.entity.js.map +0 -1
- package/dist/database/entities/task-tag.entity.d.ts +0 -10
- package/dist/database/entities/task-tag.entity.d.ts.map +0 -1
- package/dist/database/entities/task-tag.entity.js +0 -45
- package/dist/database/entities/task-tag.entity.js.map +0 -1
- package/dist/database/entities/task-type.entity.d.ts +0 -7
- package/dist/database/entities/task-type.entity.d.ts.map +0 -1
- package/dist/database/entities/task-type.entity.js +0 -36
- package/dist/database/entities/task-type.entity.js.map +0 -1
- package/dist/database/entities/task-user.entity.d.ts +0 -10
- package/dist/database/entities/task-user.entity.d.ts.map +0 -1
- package/dist/database/entities/task-user.entity.js +0 -45
- package/dist/database/entities/task-user.entity.js.map +0 -1
- package/dist/database/entities/task.entity.d.ts +0 -53
- package/dist/database/entities/task.entity.d.ts.map +0 -1
- package/dist/database/entities/task.entity.js +0 -259
- package/dist/database/entities/task.entity.js.map +0 -1
- package/dist/database/entities/template-task.entity.d.ts +0 -11
- package/dist/database/entities/template-task.entity.d.ts.map +0 -1
- package/dist/database/entities/template-task.entity.js +0 -53
- package/dist/database/entities/template-task.entity.js.map +0 -1
- package/dist/database/entities/template.entity.d.ts +0 -13
- package/dist/database/entities/template.entity.d.ts.map +0 -1
- package/dist/database/entities/template.entity.js +0 -58
- package/dist/database/entities/template.entity.js.map +0 -1
- package/dist/database/entities/timesheet-comment.entity.d.ts +0 -11
- package/dist/database/entities/timesheet-comment.entity.d.ts.map +0 -1
- package/dist/database/entities/timesheet-comment.entity.js +0 -65
- package/dist/database/entities/timesheet-comment.entity.js.map +0 -1
- package/dist/database/entities/timesheet-event.entity.d.ts +0 -48
- package/dist/database/entities/timesheet-event.entity.d.ts.map +0 -1
- package/dist/database/entities/timesheet-event.entity.js +0 -328
- package/dist/database/entities/timesheet-event.entity.js.map +0 -1
- package/dist/database/entities/timesheet-summary.entity.d.ts +0 -27
- package/dist/database/entities/timesheet-summary.entity.d.ts.map +0 -1
- package/dist/database/entities/timesheet-summary.entity.js +0 -161
- package/dist/database/entities/timesheet-summary.entity.js.map +0 -1
- package/dist/database/entities/timesheet.entity.d.ts +0 -32
- package/dist/database/entities/timesheet.entity.d.ts.map +0 -1
- package/dist/database/entities/timesheet.entity.js +0 -112
- package/dist/database/entities/timesheet.entity.js.map +0 -1
- package/dist/database/entities/transfer-ownership.entity.d.ts +0 -15
- package/dist/database/entities/transfer-ownership.entity.d.ts.map +0 -1
- package/dist/database/entities/transfer-ownership.entity.js +0 -75
- package/dist/database/entities/transfer-ownership.entity.js.map +0 -1
- package/dist/database/entities/upload-log.entity.d.ts +0 -31
- package/dist/database/entities/upload-log.entity.d.ts.map +0 -1
- package/dist/database/entities/upload-log.entity.js +0 -111
- package/dist/database/entities/upload-log.entity.js.map +0 -1
- package/dist/database/entities/user-notification-channel.entity.d.ts +0 -8
- package/dist/database/entities/user-notification-channel.entity.d.ts.map +0 -1
- package/dist/database/entities/user-notification-channel.entity.js +0 -63
- package/dist/database/entities/user-notification-channel.entity.js.map +0 -1
- package/dist/database/entities/user-notification-preference.entity.d.ts +0 -10
- package/dist/database/entities/user-notification-preference.entity.d.ts.map +0 -1
- package/dist/database/entities/user-notification-preference.entity.js +0 -72
- package/dist/database/entities/user-notification-preference.entity.js.map +0 -1
- package/dist/database/entities/user-role.entity.d.ts +0 -10
- package/dist/database/entities/user-role.entity.d.ts.map +0 -1
- package/dist/database/entities/user-role.entity.js +0 -45
- package/dist/database/entities/user-role.entity.js.map +0 -1
- package/dist/database/entities/user-session-history.entity.d.ts +0 -16
- package/dist/database/entities/user-session-history.entity.d.ts.map +0 -1
- package/dist/database/entities/user-session-history.entity.js +0 -78
- package/dist/database/entities/user-session-history.entity.js.map +0 -1
- package/dist/database/entities/user-shift.entity.d.ts +0 -24
- package/dist/database/entities/user-shift.entity.d.ts.map +0 -1
- package/dist/database/entities/user-shift.entity.js +0 -153
- package/dist/database/entities/user-shift.entity.js.map +0 -1
- package/dist/database/entities/user.entity.d.ts +0 -74
- package/dist/database/entities/user.entity.d.ts.map +0 -1
- package/dist/database/entities/user.entity.js +0 -280
- package/dist/database/entities/user.entity.js.map +0 -1
- package/dist/database/index.d.ts +0 -2
- package/dist/database/index.d.ts.map +0 -1
- package/dist/database/index.js +0 -18
- package/dist/database/index.js.map +0 -1
- package/dist/database/migrations/1770706648232-initialMigration.d.ts +0 -7
- package/dist/database/migrations/1770706648232-initialMigration.d.ts.map +0 -1
- package/dist/database/migrations/1770706648232-initialMigration.js.map +0 -1
- package/dist/database/seeder/base.seed.d.ts +0 -19
- package/dist/database/seeder/base.seed.d.ts.map +0 -1
- package/dist/database/seeder/base.seed.js +0 -83
- package/dist/database/seeder/base.seed.js.map +0 -1
- package/dist/database/seeder/config/seeder.config.d.ts +0 -7
- package/dist/database/seeder/config/seeder.config.d.ts.map +0 -1
- package/dist/database/seeder/config/seeder.config.js +0 -21
- package/dist/database/seeder/config/seeder.config.js.map +0 -1
- package/dist/database/seeder/errors/seeder.error.d.ts +0 -11
- package/dist/database/seeder/errors/seeder.error.d.ts.map +0 -1
- package/dist/database/seeder/errors/seeder.error.js +0 -27
- package/dist/database/seeder/errors/seeder.error.js.map +0 -1
- package/dist/database/seeder/seed-runner.d.ts +0 -2
- package/dist/database/seeder/seed-runner.d.ts.map +0 -1
- package/dist/database/seeder/seed-runner.js +0 -157
- package/dist/database/seeder/seed-runner.js.map +0 -1
- package/dist/database/seeder/seeds/city.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/city.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/city.seed.js +0 -62
- package/dist/database/seeder/seeds/city.seed.js.map +0 -1
- package/dist/database/seeder/seeds/country.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/country.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/country.seed.js +0 -54
- package/dist/database/seeder/seeds/country.seed.js.map +0 -1
- package/dist/database/seeder/seeds/currency.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/currency.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/currency.seed.js +0 -50
- package/dist/database/seeder/seeds/currency.seed.js.map +0 -1
- package/dist/database/seeder/seeds/department.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/department.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/department.seed.js +0 -48
- package/dist/database/seeder/seeds/department.seed.js.map +0 -1
- package/dist/database/seeder/seeds/permission.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/permission.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/permission.seed.js +0 -54
- package/dist/database/seeder/seeds/permission.seed.js.map +0 -1
- package/dist/database/seeder/seeds/role-permission.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/role-permission.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/role-permission.seed.js +0 -47
- package/dist/database/seeder/seeds/role-permission.seed.js.map +0 -1
- package/dist/database/seeder/seeds/role.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/role.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/role.seed.js +0 -52
- package/dist/database/seeder/seeds/role.seed.js.map +0 -1
- package/dist/database/seeder/seeds/user-role.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/user-role.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/user-role.seed.js +0 -66
- package/dist/database/seeder/seeds/user-role.seed.js.map +0 -1
- package/dist/database/seeder/seeds/user.seed.d.ts +0 -8
- package/dist/database/seeder/seeds/user.seed.d.ts.map +0 -1
- package/dist/database/seeder/seeds/user.seed.js +0 -110
- package/dist/database/seeder/seeds/user.seed.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/scripts/create-schema.d.ts +0 -2
- package/dist/scripts/create-schema.d.ts.map +0 -1
- package/dist/scripts/create-schema.js +0 -77
- package/dist/scripts/create-schema.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Entity, Column, OneToMany, ManyToOne, JoinColumn, OneToOne } from 'typeorm';
|
|
2
|
+
import { BaseEntity } from './base.entity';
|
|
3
|
+
import { Department } from './department.entity';
|
|
4
|
+
import { UserRole } from './user-role.entity';
|
|
5
|
+
import { ApprovalLevelUser } from './approval-level-user.entity';
|
|
6
|
+
import { ApprovalLevelEscalation } from './approval-level-escalation.entity';
|
|
7
|
+
import { ApprovalLevelEscalationUser } from './approval-level-escalation-user.entity';
|
|
8
|
+
import { ApprovalJourney } from './approval-journey.entity';
|
|
9
|
+
import { Chat } from './chat.entity';
|
|
10
|
+
import { UserSessionHistory } from './user-session-history.entity';
|
|
11
|
+
import { UploadLog } from './upload-log.entity';
|
|
12
|
+
import { OwnershipTransfer } from './transfer-ownership.entity';
|
|
13
|
+
import { Shift } from './shift.entity';
|
|
14
|
+
import { UserShift } from './user-shift.entity';
|
|
15
|
+
import { Timesheet } from './timesheet.entity';
|
|
16
|
+
import { TimesheetEvent } from './timesheet-event.entity';
|
|
17
|
+
import { Matter } from './matter.entity';
|
|
18
|
+
import { CreditNoteEntity } from './credit-note.entity';
|
|
19
|
+
import { TaskUser } from './task-user.entity';
|
|
20
|
+
import { SubTaskUser } from './subtask-user.entity';
|
|
21
|
+
import { MatterTeamMember } from './matter-team-member.entity';
|
|
22
|
+
import { Superset } from './superset.entity';
|
|
23
|
+
import { TaskComment } from './task-comment.entity';
|
|
24
|
+
import { Invoice } from './invoice.entity';
|
|
25
|
+
import { Expense } from './expense.entity';
|
|
26
|
+
|
|
27
|
+
@Entity({ name: 'users', schema: 'user' })
|
|
28
|
+
export class User extends BaseEntity {
|
|
29
|
+
@Column({ name: 'name' })
|
|
30
|
+
name: string;
|
|
31
|
+
|
|
32
|
+
@Column({ name: 'email', unique: true })
|
|
33
|
+
email: string;
|
|
34
|
+
|
|
35
|
+
@Column({ name: 'password', nullable: true })
|
|
36
|
+
password: string;
|
|
37
|
+
|
|
38
|
+
@Column({ name: 'language', default: 'en', nullable: true })
|
|
39
|
+
language: string;
|
|
40
|
+
|
|
41
|
+
@Column({ name: 'timezone', default: 'Asia/Kolkata', nullable: true })
|
|
42
|
+
timezone: string;
|
|
43
|
+
|
|
44
|
+
@Column({ name: 'phone_number', nullable: true })
|
|
45
|
+
phoneNumber: string;
|
|
46
|
+
|
|
47
|
+
@Column({ name: 'country_code', nullable: true })
|
|
48
|
+
countryCode: string;
|
|
49
|
+
|
|
50
|
+
@Column({ name: 'department_id', nullable: true })
|
|
51
|
+
departmentId: number;
|
|
52
|
+
|
|
53
|
+
@Column({ name: 'reports_to', type: 'jsonb', nullable: true })
|
|
54
|
+
reportsTo: any;
|
|
55
|
+
|
|
56
|
+
@Column({ name: 'file_id', nullable: true })
|
|
57
|
+
fileId: number;
|
|
58
|
+
|
|
59
|
+
@Column({ name: 'refresh_token', nullable: true })
|
|
60
|
+
refreshToken: string;
|
|
61
|
+
|
|
62
|
+
@Column({ name: 'reset_token', nullable: true })
|
|
63
|
+
resetToken: string;
|
|
64
|
+
|
|
65
|
+
@Column({ name: 'reset_token_expires', nullable: true })
|
|
66
|
+
resetTokenExpires: Date;
|
|
67
|
+
|
|
68
|
+
@Column({ name: 'is_active', default: true })
|
|
69
|
+
isActive: boolean;
|
|
70
|
+
|
|
71
|
+
@Column({ name: 'is_verified', default: false })
|
|
72
|
+
isVerified: boolean;
|
|
73
|
+
|
|
74
|
+
@Column({ name: 'hourly_rate', nullable: true })
|
|
75
|
+
hourlyRate: number;
|
|
76
|
+
|
|
77
|
+
@Column({ name: 'ntrackid', nullable: true })
|
|
78
|
+
ntrackId: number;
|
|
79
|
+
|
|
80
|
+
@Column({ name: 'ntrackempid', nullable: true })
|
|
81
|
+
ntrackEmpId: string;
|
|
82
|
+
|
|
83
|
+
@Column({ name: 'ntrack_password', nullable: true })
|
|
84
|
+
ntrackPassword: string;
|
|
85
|
+
|
|
86
|
+
@ManyToOne(() => Department, (department) => department.users)
|
|
87
|
+
@JoinColumn({ name: 'department_id' })
|
|
88
|
+
department: Department;
|
|
89
|
+
|
|
90
|
+
@OneToMany(() => UserRole, (userRole) => userRole.user, { cascade: true })
|
|
91
|
+
user_roles: UserRole[];
|
|
92
|
+
|
|
93
|
+
@OneToMany(
|
|
94
|
+
() => ApprovalLevelUser,
|
|
95
|
+
(approvalLevelUser) => approvalLevelUser.user,
|
|
96
|
+
{ cascade: true },
|
|
97
|
+
)
|
|
98
|
+
approval_level_user: ApprovalLevelUser[];
|
|
99
|
+
|
|
100
|
+
@OneToMany(
|
|
101
|
+
() => ApprovalLevelEscalation,
|
|
102
|
+
(approvalLevelEscalation) => approvalLevelEscalation.user,
|
|
103
|
+
{ cascade: true },
|
|
104
|
+
)
|
|
105
|
+
approval_level_escalation: ApprovalLevelEscalation[];
|
|
106
|
+
|
|
107
|
+
@OneToMany(
|
|
108
|
+
() => ApprovalLevelEscalationUser,
|
|
109
|
+
(approvalLevelEscalationUser) => approvalLevelEscalationUser.user,
|
|
110
|
+
{ cascade: true },
|
|
111
|
+
)
|
|
112
|
+
approval_level_escalation_user: ApprovalLevelEscalationUser[];
|
|
113
|
+
|
|
114
|
+
@OneToMany(
|
|
115
|
+
() => ApprovalJourney,
|
|
116
|
+
(approvalJourney) => approvalJourney.user,
|
|
117
|
+
{ cascade: true },
|
|
118
|
+
)
|
|
119
|
+
approval_journey: ApprovalJourney[];
|
|
120
|
+
|
|
121
|
+
@OneToMany(
|
|
122
|
+
() => ApprovalJourney,
|
|
123
|
+
(approvalJourney) => approvalJourney.requester,
|
|
124
|
+
{ cascade: true },
|
|
125
|
+
)
|
|
126
|
+
approval_journey_requester: ApprovalJourney[];
|
|
127
|
+
|
|
128
|
+
@OneToMany(() => Chat, (chat) => chat.sender)
|
|
129
|
+
sent_chats: Chat[];
|
|
130
|
+
|
|
131
|
+
@OneToMany(() => Chat, (chat) => chat.receiver)
|
|
132
|
+
received_chats: Chat[];
|
|
133
|
+
|
|
134
|
+
@OneToMany(
|
|
135
|
+
() => UserSessionHistory,
|
|
136
|
+
(userSessionHistory) => userSessionHistory.user,
|
|
137
|
+
{ cascade: true },
|
|
138
|
+
)
|
|
139
|
+
user_session_history: UserSessionHistory[];
|
|
140
|
+
|
|
141
|
+
@OneToMany(() => UploadLog, (uploadLog) => uploadLog.user)
|
|
142
|
+
uploadLogs: UploadLog[];
|
|
143
|
+
|
|
144
|
+
@OneToMany(()=>OwnershipTransfer, (ownershipTransfer) => ownershipTransfer.ownershipTransferFromUser)
|
|
145
|
+
ownershipTransfersFrom: OwnershipTransfer[];
|
|
146
|
+
|
|
147
|
+
@OneToMany(()=>OwnershipTransfer, (ownershipTransfer) => ownershipTransfer.ownershipTransferToUser)
|
|
148
|
+
ownershipTransfersTo: OwnershipTransfer[];
|
|
149
|
+
|
|
150
|
+
@OneToMany(()=>OwnershipTransfer, (ownershipTransfer) => ownershipTransfer.transferredByUser)
|
|
151
|
+
ownershipTransfersBy: OwnershipTransfer[];
|
|
152
|
+
|
|
153
|
+
@OneToMany(() => TimesheetEvent, (timesheetEvent) => timesheetEvent.user)
|
|
154
|
+
timesheetEvents: TimesheetEvent[];
|
|
155
|
+
|
|
156
|
+
@OneToMany(() => Timesheet, (timesheet) => timesheet.user)
|
|
157
|
+
timesheets: Timesheet[];
|
|
158
|
+
|
|
159
|
+
@OneToOne(() => UserShift, userShift => userShift.user) // Establish the inverse relationship
|
|
160
|
+
userShift: UserShift;
|
|
161
|
+
|
|
162
|
+
@OneToMany(() => Shift, (shift) => shift.created_By)
|
|
163
|
+
shifts: Shift[];
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
@OneToMany(() => Matter, (matter) => matter.user)
|
|
167
|
+
matters: Matter[];
|
|
168
|
+
|
|
169
|
+
@OneToMany(() => CreditNoteEntity, (creditNote) => creditNote.raisedBy)
|
|
170
|
+
creditNotes: CreditNoteEntity[];
|
|
171
|
+
|
|
172
|
+
@OneToMany(() => TaskUser, (taskUser) => taskUser.user)
|
|
173
|
+
tasks: TaskUser[];
|
|
174
|
+
|
|
175
|
+
@OneToMany(() => SubTaskUser, (subTaskUser) => subTaskUser.user)
|
|
176
|
+
subtasks: SubTaskUser[];
|
|
177
|
+
|
|
178
|
+
@OneToMany(() => Expense, (expense) => expense.requester)
|
|
179
|
+
expenses: Expense[];
|
|
180
|
+
|
|
181
|
+
@OneToMany(() => Invoice, (invoice) => invoice.approvedBy)
|
|
182
|
+
approvedInvoices: Invoice[];
|
|
183
|
+
|
|
184
|
+
@OneToMany(() => Invoice, (invoice) => invoice.approvalRequestedBy)
|
|
185
|
+
requestedInvoices: Invoice[];
|
|
186
|
+
|
|
187
|
+
@OneToMany(
|
|
188
|
+
() => MatterTeamMember,
|
|
189
|
+
(matterTeamMember) => matterTeamMember.user,
|
|
190
|
+
)
|
|
191
|
+
teamMembers: MatterTeamMember[];
|
|
192
|
+
|
|
193
|
+
@OneToMany(() => Superset, (superset) => superset.user)
|
|
194
|
+
supersetCharts: Superset[];
|
|
195
|
+
|
|
196
|
+
@OneToMany(() => TaskComment, (taskComment) => taskComment.user)
|
|
197
|
+
taskComments: TaskComment[];
|
|
198
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './entities';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
async up(queryRunner) {
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class InitialMigration1770706648232 implements MigrationInterface {
|
|
4
|
+
name = 'InitialMigration1770706648232'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
7
|
await queryRunner.query(`CREATE TABLE "core"."activity_logs" ("id" SERIAL NOT NULL, "uuid" uuid NOT NULL DEFAULT uuid_generate_v4(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "created_by" integer, "updated_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_by" integer, "is_deleted" boolean NOT NULL DEFAULT false, "deleted_by" integer, "deleted_at" TIMESTAMP, "user_id" integer, "resource_type" character varying, "resource_id" integer, "action" character varying, "description" character varying, "before_data" json, "after_data" json, CONSTRAINT "PK_f25287b6140c5ba18d38776a796" PRIMARY KEY ("id"))`);
|
|
8
8
|
await queryRunner.query(`CREATE TABLE "core"."contacts" ("id" SERIAL NOT NULL, "uuid" uuid NOT NULL DEFAULT uuid_generate_v4(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "created_by" integer, "updated_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_by" integer, "is_deleted" boolean NOT NULL DEFAULT false, "deleted_by" integer, "deleted_at" TIMESTAMP, "clientId" integer NOT NULL, "contactName" character varying(100) NOT NULL, "contactType" character varying(10) NOT NULL DEFAULT 'Primary', "contactEmail" character varying(150), "countryCode" character varying(10), "contactPhone" character varying(15), CONSTRAINT "PK_b99cd40cfd66a99f1571f4f72e6" PRIMARY KEY ("id"))`);
|
|
9
9
|
await queryRunner.query(`CREATE TABLE "core"."groups" ("id" SERIAL NOT NULL, "uuid" uuid NOT NULL DEFAULT uuid_generate_v4(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "created_by" integer, "updated_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_by" integer, "is_deleted" boolean NOT NULL DEFAULT false, "deleted_by" integer, "deleted_at" TIMESTAMP, "group_name" character varying(255) NOT NULL, "is_active" boolean DEFAULT true, "prefix_group" jsonb, CONSTRAINT "UQ_ef10d4611e4f355d10ecaa10ac6" UNIQUE ("group_name"), CONSTRAINT "PK_659d1483316afb28afd3a90646e" PRIMARY KEY ("id"))`);
|
|
@@ -236,7 +236,8 @@ class InitialMigration1770706648232 {
|
|
|
236
236
|
await queryRunner.query(`ALTER TABLE "core"."payments" ADD CONSTRAINT "FK_198183e67e58c2b0790434569d7" FOREIGN KEY ("confirmed_by") REFERENCES "user"."users"("id") ON DELETE SET NULL ON UPDATE CASCADE`);
|
|
237
237
|
await queryRunner.query(`ALTER TABLE "core"."payments" ADD CONSTRAINT "FK_563a5e248518c623eebd987d43e" FOREIGN KEY ("invoice_id") REFERENCES "core"."invoices"("id") ON DELETE CASCADE ON UPDATE CASCADE`);
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
|
|
240
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
240
241
|
await queryRunner.query(`ALTER TABLE "core"."payments" DROP CONSTRAINT "FK_563a5e248518c623eebd987d43e"`);
|
|
241
242
|
await queryRunner.query(`ALTER TABLE "core"."payments" DROP CONSTRAINT "FK_198183e67e58c2b0790434569d7"`);
|
|
242
243
|
await queryRunner.query(`ALTER TABLE "core"."user_invoice_template_footer" DROP CONSTRAINT "FK_f98f17ab7e0ce6f51c0e79b4b79"`);
|
|
@@ -469,6 +470,5 @@ class InitialMigration1770706648232 {
|
|
|
469
470
|
await queryRunner.query(`DROP TABLE "core"."contacts"`);
|
|
470
471
|
await queryRunner.query(`DROP TABLE "core"."activity_logs"`);
|
|
471
472
|
}
|
|
473
|
+
|
|
472
474
|
}
|
|
473
|
-
exports.InitialMigration1770706648232 = InitialMigration1770706648232;
|
|
474
|
-
//# sourceMappingURL=1770706648232-initialMigration.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { DataSource, QueryRunner } from 'typeorm';
|
|
2
|
+
import { seederConfig } from './config/seeder.config';
|
|
3
|
+
import { SeederError, ValidationError } from './errors/seeder.error';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for all seeders providing common functionality
|
|
7
|
+
* including transaction management, logging, and validation.
|
|
8
|
+
*/
|
|
9
|
+
export abstract class BaseSeeder {
|
|
10
|
+
protected queryRunner: QueryRunner;
|
|
11
|
+
protected readonly config =
|
|
12
|
+
seederConfig[process.env.NODE_ENV || 'development'];
|
|
13
|
+
|
|
14
|
+
constructor(protected dataSource: DataSource) {}
|
|
15
|
+
|
|
16
|
+
/** Human-readable name for log output */
|
|
17
|
+
abstract readonly seederName: string;
|
|
18
|
+
|
|
19
|
+
/** Execute the seeding logic (implemented by each seeder) */
|
|
20
|
+
abstract run(): Promise<void>;
|
|
21
|
+
|
|
22
|
+
// ─── Transaction helpers ────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
protected async startTransaction(): Promise<void> {
|
|
25
|
+
try {
|
|
26
|
+
this.queryRunner = this.dataSource.createQueryRunner();
|
|
27
|
+
await this.queryRunner.startTransaction();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
throw new SeederError('Failed to start transaction', { error });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected async commitTransaction(): Promise<void> {
|
|
34
|
+
try {
|
|
35
|
+
await this.queryRunner.commitTransaction();
|
|
36
|
+
} catch (error) {
|
|
37
|
+
throw new SeederError('Failed to commit transaction', { error });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected async rollbackTransaction(): Promise<void> {
|
|
42
|
+
try {
|
|
43
|
+
await this.queryRunner.rollbackTransaction();
|
|
44
|
+
} catch (error) {
|
|
45
|
+
throw new SeederError('Failed to rollback transaction', { error });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected async release(): Promise<void> {
|
|
50
|
+
try {
|
|
51
|
+
await this.queryRunner.release();
|
|
52
|
+
} catch (error) {
|
|
53
|
+
throw new SeederError('Failed to release query runner', { error });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Executes a callback wrapped in a DB transaction.
|
|
59
|
+
* Automatically commits on success, rolls back on failure.
|
|
60
|
+
*/
|
|
61
|
+
protected async executeInTransaction<T>(
|
|
62
|
+
callback: () => Promise<T>,
|
|
63
|
+
): Promise<T> {
|
|
64
|
+
try {
|
|
65
|
+
await this.startTransaction();
|
|
66
|
+
const result = await callback();
|
|
67
|
+
await this.commitTransaction();
|
|
68
|
+
return result;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
await this.rollbackTransaction();
|
|
71
|
+
throw error;
|
|
72
|
+
} finally {
|
|
73
|
+
await this.release();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ─── Validation helpers ─────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
protected validateRequiredFields(data: any, requiredFields: string[]): void {
|
|
80
|
+
for (const field of requiredFields) {
|
|
81
|
+
if (data[field] === undefined || data[field] === null) {
|
|
82
|
+
throw new ValidationError(`Missing required field: ${field}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ─── Logging ────────────────────────────────────────────────
|
|
88
|
+
|
|
89
|
+
protected log(message: string): void {
|
|
90
|
+
if (this.config.logging) {
|
|
91
|
+
console.log(` [${this.seederName}] ${message}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected logError(message: string): void {
|
|
96
|
+
console.error(` [${this.seederName}] ❌ ${message}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
protected logSuccess(message: string): void {
|
|
100
|
+
if (this.config.logging) {
|
|
101
|
+
console.log(` [${this.seederName}] ✅ ${message}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface SeederEnvironmentConfig {
|
|
2
|
+
/** Whether to truncate tables before seeding */
|
|
3
|
+
truncate: boolean;
|
|
4
|
+
/** Enable verbose logging */
|
|
5
|
+
logging: boolean;
|
|
6
|
+
/** Schemas to create before seeding */
|
|
7
|
+
schemas: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const seederConfig: Record<string, SeederEnvironmentConfig> = {
|
|
11
|
+
development: {
|
|
12
|
+
truncate: false,
|
|
13
|
+
logging: true,
|
|
14
|
+
schemas: ['user', 'core', 'timesheet', 'notification'],
|
|
15
|
+
},
|
|
16
|
+
production: {
|
|
17
|
+
truncate: false,
|
|
18
|
+
logging: false,
|
|
19
|
+
schemas: ['user', 'core', 'timesheet', 'notification'],
|
|
20
|
+
},
|
|
21
|
+
test: {
|
|
22
|
+
truncate: true,
|
|
23
|
+
logging: false,
|
|
24
|
+
schemas: ['user', 'core', 'timesheet', 'notification'],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class SeederError extends Error {
|
|
2
|
+
constructor(message: string, public readonly context?: any) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'SeederError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class ValidationError extends SeederError {
|
|
9
|
+
constructor(message: string, context?: any) {
|
|
10
|
+
super(message, context);
|
|
11
|
+
this.name = 'ValidationError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class DependencyError extends SeederError {
|
|
16
|
+
constructor(message: string, context?: any) {
|
|
17
|
+
super(message, context);
|
|
18
|
+
this.name = 'DependencyError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
import { config } from 'dotenv';
|
|
4
|
+
import { Client } from 'pg';
|
|
5
|
+
import { getAllSharedEntities } from '../../config/ormconfig.factory';
|
|
6
|
+
import { seederConfig } from './config/seeder.config';
|
|
7
|
+
|
|
8
|
+
// Individual seeders
|
|
9
|
+
import { DepartmentSeeder } from './seeds/department.seed';
|
|
10
|
+
import { PermissionSeeder } from './seeds/permission.seed';
|
|
11
|
+
import { RoleSeeder } from './seeds/role.seed';
|
|
12
|
+
import { RolePermissionSeeder } from './seeds/role-permission.seed';
|
|
13
|
+
import { UserSeeder } from './seeds/user.seed';
|
|
14
|
+
import { UserRoleSeeder } from './seeds/user-role.seed';
|
|
15
|
+
import { CurrencySeeder } from './seeds/currency.seed';
|
|
16
|
+
import { CountrySeeder } from './seeds/country.seed';
|
|
17
|
+
import { CitySeeder } from './seeds/city.seed';
|
|
18
|
+
|
|
19
|
+
config(); // Load .env
|
|
20
|
+
|
|
21
|
+
const env = process.env.NODE_ENV || 'development';
|
|
22
|
+
const envConfig = seederConfig[env];
|
|
23
|
+
|
|
24
|
+
// ─── Progress helper ──────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
function progressBar(current: number, total: number, label: string): string {
|
|
27
|
+
const width = 30;
|
|
28
|
+
const filled = Math.round((current / total) * width);
|
|
29
|
+
const empty = width - filled;
|
|
30
|
+
const bar = '█'.repeat(filled) + '░'.repeat(empty);
|
|
31
|
+
const pct = Math.round((current / total) * 100);
|
|
32
|
+
return ` [${bar}] ${pct}% (${current}/${total}) ${label}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ─── Schema creation ──────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
async function createSchemas(): Promise<void> {
|
|
38
|
+
const client = new Client({
|
|
39
|
+
host: process.env.DB_HOST,
|
|
40
|
+
port: parseInt(process.env.DB_PORT ?? '5432'),
|
|
41
|
+
user: process.env.DB_USERNAME,
|
|
42
|
+
password: process.env.DB_PASSWORD,
|
|
43
|
+
database: process.env.DB_NAME,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
await client.connect();
|
|
48
|
+
|
|
49
|
+
for (const schema of envConfig.schemas) {
|
|
50
|
+
await client.query(`CREATE SCHEMA IF NOT EXISTS "${schema}"`);
|
|
51
|
+
console.log(` ✅ Schema "${schema}" ready`);
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error(' ❌ Error creating schemas:', error);
|
|
55
|
+
throw error;
|
|
56
|
+
} finally {
|
|
57
|
+
await client.end();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ─── DataSource ───────────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
function createDataSource(): DataSource {
|
|
64
|
+
return new DataSource({
|
|
65
|
+
type: 'postgres',
|
|
66
|
+
host: process.env.DB_HOST ?? 'localhost',
|
|
67
|
+
port: parseInt(process.env.DB_PORT ?? '5432'),
|
|
68
|
+
username: process.env.DB_USERNAME ?? 'postgres',
|
|
69
|
+
password: process.env.DB_PASSWORD ?? 'postgres',
|
|
70
|
+
database: process.env.DB_NAME ?? 'IVM',
|
|
71
|
+
entities: getAllSharedEntities(),
|
|
72
|
+
synchronize: false,
|
|
73
|
+
logging: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ─── Seeder registry ──────────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
interface SeederEntry {
|
|
80
|
+
name: string;
|
|
81
|
+
factory: (ds: DataSource) => { run(): Promise<void> };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const SEEDERS: SeederEntry[] = [
|
|
85
|
+
{ name: 'Department', factory: (ds) => new DepartmentSeeder(ds) },
|
|
86
|
+
{ name: 'Permission', factory: (ds) => new PermissionSeeder(ds) },
|
|
87
|
+
{ name: 'Role', factory: (ds) => new RoleSeeder(ds) },
|
|
88
|
+
{ name: 'RolePermission', factory: (ds) => new RolePermissionSeeder(ds) },
|
|
89
|
+
{ name: 'User', factory: (ds) => new UserSeeder(ds) },
|
|
90
|
+
{ name: 'UserRole', factory: (ds) => new UserRoleSeeder(ds) },
|
|
91
|
+
{ name: 'Currency', factory: (ds) => new CurrencySeeder(ds) },
|
|
92
|
+
{ name: 'Country', factory: (ds) => new CountrySeeder(ds) },
|
|
93
|
+
{ name: 'City', factory: (ds) => new CitySeeder(ds) },
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
// ─── Main runner ──────────────────────────────────────────────
|
|
97
|
+
|
|
98
|
+
async function runSeeders(): Promise<void> {
|
|
99
|
+
const startTime = Date.now();
|
|
100
|
+
|
|
101
|
+
console.log('');
|
|
102
|
+
console.log('╔══════════════════════════════════════════════════╗');
|
|
103
|
+
console.log('║ 🌱 SHARED-LIB SEED RUNNER ║');
|
|
104
|
+
console.log('╠══════════════════════════════════════════════════╣');
|
|
105
|
+
console.log(`║ Environment : ${env.padEnd(34)}║`);
|
|
106
|
+
console.log(`║ Database : ${(process.env.DB_NAME ?? 'IVM').padEnd(34)}║`);
|
|
107
|
+
console.log(`║ Host : ${(process.env.DB_HOST ?? 'localhost').padEnd(34)}║`);
|
|
108
|
+
console.log(`║ Schemas : ${envConfig.schemas.join(', ').padEnd(34)}║`);
|
|
109
|
+
console.log('╚══════════════════════════════════════════════════╝');
|
|
110
|
+
console.log('');
|
|
111
|
+
|
|
112
|
+
// ── Step 1: Create schemas ──
|
|
113
|
+
console.log('━━━ Step 1/3: Creating database schemas ━━━');
|
|
114
|
+
await createSchemas();
|
|
115
|
+
console.log('');
|
|
116
|
+
|
|
117
|
+
// ── Step 2: Initialize DataSource ──
|
|
118
|
+
console.log('━━━ Step 2/3: Initializing DataSource (sync tables) ━━━');
|
|
119
|
+
const dataSource = createDataSource();
|
|
120
|
+
await dataSource.initialize();
|
|
121
|
+
console.log(' ✅ DataSource initialized & tables synchronized');
|
|
122
|
+
console.log('');
|
|
123
|
+
|
|
124
|
+
// ── Step 3: Run seeders ──
|
|
125
|
+
console.log('━━━ Step 3/3: Running seeders ━━━');
|
|
126
|
+
console.log('');
|
|
127
|
+
|
|
128
|
+
const total = SEEDERS.length;
|
|
129
|
+
const results: { name: string; status: 'success' | 'failed'; time: number; error?: string }[] = [];
|
|
130
|
+
|
|
131
|
+
for (let i = 0; i < SEEDERS.length; i++) {
|
|
132
|
+
const seeder = SEEDERS[i];
|
|
133
|
+
const seederStart = Date.now();
|
|
134
|
+
|
|
135
|
+
console.log(progressBar(i, total, `→ ${seeder.name}`));
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
await seeder.factory(dataSource).run();
|
|
139
|
+
const elapsed = Date.now() - seederStart;
|
|
140
|
+
results.push({ name: seeder.name, status: 'success', time: elapsed });
|
|
141
|
+
} catch (error: any) {
|
|
142
|
+
const elapsed = Date.now() - seederStart;
|
|
143
|
+
results.push({
|
|
144
|
+
name: seeder.name,
|
|
145
|
+
status: 'failed',
|
|
146
|
+
time: elapsed,
|
|
147
|
+
error: error.message,
|
|
148
|
+
});
|
|
149
|
+
console.error(` ❌ ${seeder.name} FAILED: ${error.message}`);
|
|
150
|
+
// Continue with remaining seeders unless it's a critical dependency
|
|
151
|
+
if (['Department', 'Permission', 'Role', 'User'].includes(seeder.name)) {
|
|
152
|
+
console.error(' ⛔ Critical seeder failed. Aborting remaining seeders.');
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
console.log('');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Final progress
|
|
160
|
+
console.log(progressBar(total, total, '→ Complete'));
|
|
161
|
+
console.log('');
|
|
162
|
+
|
|
163
|
+
// ── Summary ──
|
|
164
|
+
await dataSource.destroy();
|
|
165
|
+
|
|
166
|
+
const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
167
|
+
const successCount = results.filter((r) => r.status === 'success').length;
|
|
168
|
+
const failedCount = results.filter((r) => r.status === 'failed').length;
|
|
169
|
+
|
|
170
|
+
console.log('╔══════════════════════════════════════════════════╗');
|
|
171
|
+
console.log('║ 📊 SEEDING SUMMARY ║');
|
|
172
|
+
console.log('╠══════════════════════════════════════════════════╣');
|
|
173
|
+
|
|
174
|
+
for (const r of results) {
|
|
175
|
+
const icon = r.status === 'success' ? '✅' : '❌';
|
|
176
|
+
const timeStr = `${r.time}ms`;
|
|
177
|
+
const line = `║ ${icon} ${r.name.padEnd(25)} ${timeStr.padStart(10)} ║`;
|
|
178
|
+
console.log(line);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
console.log('╠══════════════════════════════════════════════════╣');
|
|
182
|
+
console.log(`║ Total: ${successCount} passed, ${failedCount} failed`.padEnd(51) + '║');
|
|
183
|
+
console.log(`║ Time : ${totalTime}s`.padEnd(51) + '║');
|
|
184
|
+
console.log('╚══════════════════════════════════════════════════╝');
|
|
185
|
+
console.log('');
|
|
186
|
+
|
|
187
|
+
if (failedCount > 0) {
|
|
188
|
+
console.log('Failed seeders:');
|
|
189
|
+
for (const r of results.filter((r) => r.status === 'failed')) {
|
|
190
|
+
console.log(` - ${r.name}: ${r.error}`);
|
|
191
|
+
}
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ─── Execute ──────────────────────────────────────────────────
|
|
197
|
+
runSeeders().catch((err) => {
|
|
198
|
+
console.error('❌ Fatal error:', err);
|
|
199
|
+
process.exit(1);
|
|
200
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
import { BaseSeeder } from '../base.seed';
|
|
3
|
+
import { City } from '../../entities/city.entity';
|
|
4
|
+
import { Country } from '../../entities/country.entity';
|
|
5
|
+
import cityData from '../../../core/json/geographic-data/cities.json';
|
|
6
|
+
|
|
7
|
+
export class CitySeeder extends BaseSeeder {
|
|
8
|
+
readonly seederName = 'CitySeeder';
|
|
9
|
+
|
|
10
|
+
constructor(dataSource: DataSource) {
|
|
11
|
+
super(dataSource);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async run(): Promise<void> {
|
|
15
|
+
this.log('Seeding cities...');
|
|
16
|
+
|
|
17
|
+
await this.executeInTransaction(async () => {
|
|
18
|
+
const cityRepo = this.dataSource.getRepository(City);
|
|
19
|
+
const countryRepo = this.dataSource.getRepository(Country);
|
|
20
|
+
|
|
21
|
+
const existingCount = await cityRepo.count();
|
|
22
|
+
if (existingCount > 0) {
|
|
23
|
+
this.log(
|
|
24
|
+
`Cities already exist (${existingCount} records). Skipping.`,
|
|
25
|
+
);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Build country lookup: iso2 → id
|
|
30
|
+
const countries = await countryRepo.find();
|
|
31
|
+
const countryMap = new Map<string, number>();
|
|
32
|
+
for (const c of countries) {
|
|
33
|
+
if (c.iso2) countryMap.set(c.iso2, c.id);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const cities = cityData as any[];
|
|
37
|
+
const batchSize = 500;
|
|
38
|
+
let totalInserted = 0;
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < cities.length; i += batchSize) {
|
|
41
|
+
const batch = cities.slice(i, i + batchSize);
|
|
42
|
+
const entities = batch
|
|
43
|
+
.map((city) => {
|
|
44
|
+
const countryId = countryMap.get(city.country_code);
|
|
45
|
+
if (!countryId) return null;
|
|
46
|
+
return cityRepo.create({
|
|
47
|
+
name: city.name,
|
|
48
|
+
latitude: city.latitude,
|
|
49
|
+
longitude: city.longitude,
|
|
50
|
+
country_id: countryId,
|
|
51
|
+
});
|
|
52
|
+
})
|
|
53
|
+
.filter(Boolean);
|
|
54
|
+
|
|
55
|
+
if (entities.length > 0) {
|
|
56
|
+
await cityRepo.save(entities as City[]);
|
|
57
|
+
totalInserted += entities.length;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.log(
|
|
61
|
+
`Batch ${Math.floor(i / batchSize) + 1}: inserted ${entities.length} cities`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.log(`Total cities inserted: ${totalInserted}`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
this.logSuccess('Cities seeded.');
|
|
69
|
+
}
|
|
70
|
+
}
|