procbay-schema 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +189 -0
- package/package.json +77 -0
- package/prisma/.env +13 -0
- package/prisma/migrations/20250116142512_init_user_table/migration.sql +38 -0
- package/prisma/migrations/20250116142709_init_role_table/migration.sql +20 -0
- package/prisma/migrations/20250116143847_init_user_role_table/migration.sql +20 -0
- package/prisma/migrations/20250116144035_init_permission_table/migration.sql +21 -0
- package/prisma/migrations/20250116144140_init_role_permission_table/migration.sql +21 -0
- package/prisma/migrations/20250116144233_init_department_table/migration.sql +20 -0
- package/prisma/migrations/20250116144345_init_user_department_table/migration.sql +20 -0
- package/prisma/migrations/20250116152941_init_serial_number_table/migration.sql +17 -0
- package/prisma/migrations/20250116153048_init_category_table/migration.sql +22 -0
- package/prisma/migrations/20250116153415_init_attributes_table/migration.sql +28 -0
- package/prisma/migrations/20250116153628_init_attribute_values_table/migration.sql +27 -0
- package/prisma/migrations/20250116153900_init_purchase_intake_table/migration.sql +32 -0
- package/prisma/migrations/20250116154038_init_purchase_intake_item_table/migration.sql +15 -0
- package/prisma/migrations/20250120090355_added_reset_token_column_in_user_table/migration.sql +10 -0
- package/prisma/migrations/20250120100616_init_item_table/migration.sql +42 -0
- package/prisma/migrations/20250120123720_init_vendor_table/migration.sql +39 -0
- package/prisma/migrations/20250120124526_init_vendor_categories_table/migration.sql +20 -0
- package/prisma/migrations/20250122114935_added_email_template_and_smtp_config_table/migration.sql +41 -0
- package/prisma/migrations/20250123095637_chnages_in_vendr_table/migration.sql +3 -0
- package/prisma/migrations/20250123103705_added_delated_filed_in_email_template_table/migration.sql +4 -0
- package/prisma/migrations/20250123103810_added_delated_filed_in_smtp_config_table/migration.sql +13 -0
- package/prisma/migrations/20250127123900_create_approval_heirarchy_table/migration.sql +72 -0
- package/prisma/migrations/20250128054523_make_optional_role_and_user_in_approval_hierachy/migration.sql +3 -0
- package/prisma/migrations/20250129084223_item_table_chnages/migration.sql +151 -0
- package/prisma/migrations/20250130115331_chnages_in_item_table/migration.sql +9 -0
- package/prisma/migrations/20250131054132_added_approval_journey_table/migration.sql +22 -0
- package/prisma/migrations/20250131064653_added_default_for_product_id_in_item_table/migration.sql +2 -0
- package/prisma/migrations/20250204101253_chnages_in_approval_table/migration.sql +39 -0
- package/prisma/migrations/20250206091422_added_item_document_table/migration.sql +17 -0
- package/prisma/migrations/20250207113110_added_new_column_media/migration.sql +9 -0
- package/prisma/migrations/20250207125224_added_chnages_in_pr_table/migration.sql +12 -0
- package/prisma/migrations/20250212092048_vendor_contact_table/migration.sql +30 -0
- package/prisma/migrations/20250212133620_added_tamplate_master_table/migration.sql +43 -0
- package/prisma/migrations/20250213111908_created_faq_catgory_and_faq_table/migration.sql +58 -0
- package/prisma/migrations/20250214065142_chnages_in_uom_table/migration.sql +50 -0
- package/prisma/migrations/20250217061122_corrected_email_teamplate_table/migration.sql +11 -0
- package/prisma/migrations/20250218073530_init_events/migration.sql +120 -0
- package/prisma/migrations/20250218092119_corrected_table_name/migration.sql +37 -0
- package/prisma/migrations/20250218120935_chnages_in_event_table/migration.sql +5 -0
- package/prisma/migrations/20250219083326_added_new_table_for_event_startegy/migration.sql +60 -0
- package/prisma/migrations/20250219083416_added_cms_table/migration.sql +29 -0
- package/prisma/migrations/20250219092918_alter_event_table/migration.sql +5 -0
- package/prisma/migrations/20250219093046_alter_event_to_draft/migration.sql +2 -0
- package/prisma/migrations/20250220080337_altered_event_table/migration.sql +9 -0
- package/prisma/migrations/20250221105922_added_unique_to_email_in_user_table/migration.sql +8 -0
- package/prisma/migrations/20250225063838_created_vendor_kyc_table/migration.sql +23 -0
- package/prisma/migrations/20250227060646_template_field_types_added_enum/migration.sql +14 -0
- package/prisma/migrations/20250227110306_updated_event_items_and_event_vendor_table/migration.sql +7 -0
- package/prisma/migrations/20250228060440_added_country_code_in_vendor_contact_person/migration.sql +2 -0
- package/prisma/migrations/20250228095319_init_currencies_table/migration.sql +23 -0
- package/prisma/migrations/20250303082614_added_support_ticket_table/migration.sql +89 -0
- package/prisma/migrations/20250304050248_alter_support_ticket_relations/migration.sql +35 -0
- package/prisma/migrations/20250304050613_alter_support_ticket_realtions/migration.sql +36 -0
- package/prisma/migrations/20250304061954_init_support_category_table/migration.sql +261 -0
- package/prisma/migrations/20250304092346_alter_event_vendor_table/migration.sql +2 -0
- package/prisma/migrations/20250305065430_alter_vendor_kyc_table/migration.sql +2 -0
- package/prisma/migrations/20250305111735_alter_vendor_and_user_table/migration.sql +5 -0
- package/prisma/migrations/20250307033751_alter_token_version_in_user_and_vendor_token/migration.sql +5 -0
- package/prisma/migrations/20250307034907_alter_user_and_vendor_table/migration.sql +14 -0
- package/prisma/migrations/20250307064359_chnages_in_approval_herarcy_table/migration.sql +2 -0
- package/prisma/migrations/20250307105352_alter_itme_and_vendorkyc_table/migration.sql +21 -0
- package/prisma/migrations/20250310103914_init_vendor_status_table/migration.sql +21 -0
- package/prisma/migrations/20250310105209_alter_vendor_status_table/migration.sql +18 -0
- package/prisma/migrations/20250310105413_init_vendor_kyc_status_table/migration.sql +23 -0
- package/prisma/migrations/20250311090552_alter_vendor_kyc_status_table/migration.sql +2 -0
- package/prisma/migrations/20250312055258_alter_status_column_in_event_vendors/migration.sql +12 -0
- package/prisma/migrations/20250312072145_init_vendor_event_watchlist_table/migration.sql +26 -0
- package/prisma/migrations/20250312083842_alter_vendor_event_watchlisst_table/migration.sql +41 -0
- package/prisma/migrations/20250312134730_added_chnages_in_kyc_table/migration.sql +19 -0
- package/prisma/migrations/20250317040841_init_admin_and_vendor_tables/migration.sql +38 -0
- package/prisma/migrations/20250317044110_alter_event_vendor_table/migration.sql +2 -0
- package/prisma/migrations/20250317071807_alter_rejected_reason_in_approval_journey_and_purchase_intak_table/migration.sql +5 -0
- package/prisma/migrations/20250318085504_init_customer_notification_table/migration.sql +31 -0
- package/prisma/migrations/20250318085856_alter_purchase_intake_table/migration.sql +18 -0
- package/prisma/migrations/20250319085159_alter_purchase_intake_table/migration.sql +12 -0
- package/prisma/migrations/20250320093356_init_bid_and_bidlog_table/migration.sql +75 -0
- package/prisma/migrations/20250320095501_alter_email_template_table/migration.sql +2 -0
- package/prisma/migrations/20250321053926_alter_approval_journey_table/migration.sql +2 -0
- package/prisma/migrations/20250324040851_alter_bidlog_table/migration.sql +2 -0
- package/prisma/migrations/20250324091328_init_form_master_and_dynamic_form_table/migration.sql +53 -0
- package/prisma/migrations/20250324103742_alter_bidlog_table/migration.sql +5 -0
- package/prisma/migrations/20250325052714_alter_form_master_table/migration.sql +27 -0
- package/prisma/migrations/20250327011625_init_module_and_tenant_configuration_table/migration.sql +39 -0
- package/prisma/migrations/20250403054008_alter_purchase_intake_table/migration.sql +5 -0
- package/prisma/migrations/20250404115613_init_approval_level_user/migration.sql +98 -0
- package/prisma/migrations/20250410060521_alter_approval_journey_enums/migration.sql +12 -0
- package/prisma/migrations/20250410110823_alter_purchase_intake/migration.sql +2 -0
- package/prisma/migrations/20250411062955_alter_template_field_table/migration.sql +2 -0
- package/prisma/migrations/20250414065640_alter_template/migration.sql +2 -0
- package/prisma/migrations/20250414111856_alter_event_vendors/migration.sql +2 -0
- package/prisma/migrations/20250414125356_alter_event_vendor/migration.sql +9 -0
- package/prisma/migrations/20250415063558_alter_alert_type_enum/migration.sql +2 -0
- package/prisma/migrations/20250416062508_alter_purchase_intake_table/migration.sql +15 -0
- package/prisma/migrations/20250417090325_alter_purchase_intake_table_updated_enum/migration.sql +13 -0
- package/prisma/migrations/20250417111024_alter_purchase_intake_and_purchase_intake_item/migration.sql +16 -0
- package/prisma/migrations/20250421061732_init_quotation_and_quotation_log_tables/migration.sql +96 -0
- package/prisma/migrations/20250421112331_alter_item_table_added_unique_to_slug/migration.sql +8 -0
- package/prisma/migrations/20250422060655_init_user_activity_table/migration.sql +17 -0
- package/prisma/migrations/20250423053027_/migration.sql +9 -0
- package/prisma/migrations/20250423103233_alter_user_login_activity_table/migration.sql +5 -0
- package/prisma/migrations/20250423111141_init_location_tables/migration.sql +141 -0
- package/prisma/migrations/20250424120106_alter_event_table_added_user_relation/migration.sql +2 -0
- package/prisma/migrations/20250424141637_alter_states_table/migration.sql +11 -0
- package/prisma/migrations/20250425105131_alter_user_login_activity_table/migration.sql +9 -0
- package/prisma/migrations/20250428092626_alter_location_tables/migration.sql +34 -0
- package/prisma/migrations/20250428114301_alter_location_table/migration.sql +14 -0
- package/prisma/migrations/20250429103436_alter_event_vendor_table/migration.sql +14 -0
- package/prisma/migrations/20250429135621_alter_event_vendor_table/migration.sql +5 -0
- package/prisma/migrations/20250430094809_alter_form_master_table_added_user_relation/migration.sql +2 -0
- package/prisma/migrations/20250430103440_alter_event_table/migration.sql +3 -0
- package/prisma/migrations/20250501125411_alter_strategies_table/migration.sql +2 -0
- package/prisma/migrations/20250502065554_init_location_table/migration.sql +41 -0
- package/prisma/migrations/20250505104038_alter_bid_quotation_and_dynamic_form/migration.sql +22 -0
- package/prisma/migrations/20250505105253_alter_quotation/migration.sql +5 -0
- package/prisma/migrations/20250505124851_alter_alert_enum/migration.sql +56 -0
- package/prisma/migrations/20250505133250_init_sub_module_table/migration.sql +17 -0
- package/prisma/migrations/20250506054325_alter_event_vendor_bid_status/migration.sql +14 -0
- package/prisma/migrations/20250506102135_init_counter_offer_table/migration.sql +38 -0
- package/prisma/migrations/20250506103355_alter_bid_and_quotaion_table/migration.sql +5 -0
- package/prisma/migrations/20250506110309_alter_tenant_configuration_table/migration.sql +3 -0
- package/prisma/migrations/20250506123527_alter_vendor_kyu_infor_verification_status/migration.sql +2 -0
- package/prisma/migrations/20250507055536_alter_dynamic_form_table/migration.sql +2 -0
- package/prisma/migrations/20250507070518_alter_bid_log_and_quotation_log/migration.sql +15 -0
- package/prisma/migrations/20250507130834_alter_bid_status/migration.sql +10 -0
- package/prisma/migrations/20250508065503_alter_purchase_intake_item_table/migration.sql +16 -0
- package/prisma/migrations/20250508130119_alter_purchase_intake_item/migration.sql +13 -0
- package/prisma/migrations/20250512082244_altered_template_table_to_add_currency_id/migration.sql +12 -0
- package/prisma/migrations/20250512100817_alter_approval_journey_table/migration.sql +3 -0
- package/prisma/migrations/20250513083700_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250514100915_alter_event_table_added_template_realtion/migration.sql +2 -0
- package/prisma/migrations/20250514103503_alter_vendor_table_added_is_kyc_approved_column/migration.sql +2 -0
- package/prisma/migrations/20250520131556_init_purchase_order_table/migration.sql +52 -0
- package/prisma/migrations/20250521113946_alter_purchase_order_status_enum/migration.sql +16 -0
- package/prisma/migrations/20250522083917_alter_event_vendor_bid_status_enum/migration.sql +17 -0
- package/prisma/migrations/20250522131610_updated_vendor_table/migration.sql +16 -0
- package/prisma/migrations/20250523051058_alter_vendor_kyc_verificaiton_status_enum/migration.sql +2 -0
- package/prisma/migrations/20250526072120_alter_vendor_table/migration.sql +16 -0
- package/prisma/migrations/20250527055351_init_purchase_order_activity_log/migration.sql +41 -0
- package/prisma/migrations/20250528060657_alter_item_tale/migration.sql +14 -0
- package/prisma/migrations/20250528061946_alter_event_item_table/migration.sql +5 -0
- package/prisma/migrations/20250528081337_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250528081524_removed_item_id_from_item_table/migration.sql +11 -0
- package/prisma/migrations/20250528081843_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250528094057_alter_alert_type_enum/migration.sql +11 -0
- package/prisma/migrations/20250529053721_alter_added_quantity_in_purchase_order/migration.sql +2 -0
- package/prisma/migrations/20250602055114_alter_approval_journey_parent_id_to_string/migration.sql +2 -0
- package/prisma/migrations/20250602055748_alter_event_configuration_added_rule_slug/migration.sql +2 -0
- package/prisma/migrations/20250602111042_init_user_vendor_socket_token_table/migration.sql +17 -0
- package/prisma/migrations/20250602125833_alter_bidlog_and_quoatationlog_tableto_add_json_field/migration.sql +5 -0
- package/prisma/migrations/20250603063501_alter_bid_and_quoatation_table/migration.sql +29 -0
- package/prisma/migrations/20250606015045_alter_quotation_log_table/migration.sql +2 -0
- package/prisma/migrations/20250606020918_alter_quotation_table/migration.sql +2 -0
- package/prisma/migrations/20250606022901_alter_quotation_log_table/migration.sql +3 -0
- package/prisma/migrations/20250606054914_init_event_activity_logs_table/migration.sql +35 -0
- package/prisma/migrations/20250606100634_alter_added_counter_offer_status/migration.sql +5 -0
- package/prisma/migrations/20250606100908_alter_counter_offer_table/migration.sql +2 -0
- package/prisma/migrations/20250610055710_alter_enum/migration.sql +16 -0
- package/prisma/migrations/20250610060558_alter_event_and_event_vendor_db/migration.sql +14 -0
- package/prisma/migrations/20250610091013_alter_purchase_intak_item_table/migration.sql +4 -0
- package/prisma/migrations/20250610100156_alter_purchase_intake_item_table/migration.sql +19 -0
- package/prisma/migrations/20250610125706_alter_event_table/migration.sql +6 -0
- package/prisma/migrations/20250610133613_added_timestamp/migration.sql +319 -0
- package/prisma/migrations/20250611090439_init_contact_us_table/migration.sql +23 -0
- package/prisma/migrations/20250611121005_alter_event_vendor_table/migration.sql +10 -0
- package/prisma/migrations/20250612064335_alter_tenant_configuration/migration.sql +3 -0
- package/prisma/migrations/20250612094643_alter_event_vendor_bid_status_enum/migration.sql +2 -0
- package/prisma/migrations/20250618074558_alter_updated_bid_status_and_quotation_status/migration.sql +21 -0
- package/prisma/migrations/20250618122242_alter_added_event_phase_closed/migration.sql +2 -0
- package/prisma/migrations/20250620054518_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250620062723_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250620063056_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250620100507_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250627104958_alter_counter_offer_status/migration.sql +2 -0
- package/prisma/migrations/20250702095923_alter_item_table/migration.sql +74 -0
- package/prisma/migrations/20250702120134_/migration.sql +14 -0
- package/prisma/migrations/20250702150717_alter_attribute_table/migration.sql +9 -0
- package/prisma/migrations/20250703090321_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250707054625_alter_purchase_order_table/migration.sql +15 -0
- package/prisma/migrations/20250707111354_alter_purchase_order_table_and_init_purchase_order_item_table/migration.sql +39 -0
- package/prisma/migrations/20250707111522_alter_purchase_order_item_table/migration.sql +17 -0
- package/prisma/migrations/20250710054113_alter_bid_and_quotation_status/migration.sql +31 -0
- package/prisma/migrations/20250710070813_alter_event_status/migration.sql +2 -0
- package/prisma/migrations/20250710082332_alter_bid_and_quotations_table/migration.sql +36 -0
- package/prisma/migrations/20250714102325_init_upload_log_table/migration.sql +27 -0
- package/prisma/migrations/20250716061012_alter_event_activity_logs_to_activity_logs/migration.sql +48 -0
- package/prisma/migrations/20250716071839_init_chat_thread_chat_message_and_ai_models/migration.sql +56 -0
- package/prisma/migrations/20250716135548_alter_admin_alerts_enum/migration.sql +2 -0
- package/prisma/migrations/20250717100515_init_user_event_configuration/migration.sql +21 -0
- package/prisma/migrations/20250717101037_alter_user_event_configuration_table/migration.sql +19 -0
- package/prisma/migrations/20250718071630_alter_added_module_in_upload_logs_table/migration.sql +5 -0
- package/prisma/migrations/20250718071732_alter_module_enum/migration.sql +15 -0
- package/prisma/migrations/20250721054851_init_export_log_table/migration.sql +34 -0
- package/prisma/migrations/20250722054549_init_fiscal_year_table/migration.sql +22 -0
- package/prisma/migrations/20250722072051_alter_fiscal_year_table_added_uuid/migration.sql +14 -0
- package/prisma/migrations/20250722095259_alter_fiscal_table/migration.sql +9 -0
- package/prisma/migrations/20250723071050_alter_department_table/migration.sql +14 -0
- package/prisma/migrations/20250724071201_alter_export_upload_log_enum/migration.sql +8 -0
- package/prisma/migrations/20250725094759_new_migrate/migration.sql +2 -0
- package/prisma/migrations/20250725095012_alter_migration/migration.sql +2 -0
- package/prisma/migrations/20250728072402_init_budget_management_tables/migration.sql +80 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +2609 -0
- package/prisma/seeders/approval-hierarchy.seed.js +340 -0
- package/prisma/seeders/attribute-value.seed.js +64 -0
- package/prisma/seeders/attribute.seed.js +61 -0
- package/prisma/seeders/category.seed.js +133 -0
- package/prisma/seeders/city.seed.js +147 -0
- package/prisma/seeders/country.seed.js +282 -0
- package/prisma/seeders/currency.seed.js +41 -0
- package/prisma/seeders/customer-notification.seed.js +83 -0
- package/prisma/seeders/department.seed.js +38 -0
- package/prisma/seeders/docs/CORE_SEEDER_OPTIMIZATIONS.md +270 -0
- package/prisma/seeders/docs/GEOGRAPHIC_PERFORMANCE_OPTIMIZATIONS.md +175 -0
- package/prisma/seeders/dynamic-form.seed.js +135 -0
- package/prisma/seeders/email-template.seed.js +68 -0
- package/prisma/seeders/faq-category.seed.js +56 -0
- package/prisma/seeders/faq.seed.js +61 -0
- package/prisma/seeders/form-master.seed.js +55 -0
- package/prisma/seeders/item.seed.js +133 -0
- package/prisma/seeders/permission.seed.js +102 -0
- package/prisma/seeders/region.seed.js +78 -0
- package/prisma/seeders/role-permission.seed.js +70 -0
- package/prisma/seeders/role.seed.js +38 -0
- package/prisma/seeders/seed.js +553 -0
- package/prisma/seeders/serial-number-config.seed.js +58 -0
- package/prisma/seeders/smtp-config.seed.js +61 -0
- package/prisma/seeders/state.seed.js +170 -0
- package/prisma/seeders/strategies.seed.js +54 -0
- package/prisma/seeders/subregion.seed.js +88 -0
- package/prisma/seeders/support-category.seed.js +56 -0
- package/prisma/seeders/template.seed.js +87 -0
- package/prisma/seeders/test-core-seeders.js +276 -0
- package/prisma/seeders/user-department.seed.js +66 -0
- package/prisma/seeders/user-event-configuration.seed.js +47 -0
- package/prisma/seeders/user-role.seed.js +74 -0
- package/prisma/seeders/user.seed.js +114 -0
- package/prisma/seeders/utils/bulk-seeder.js +300 -0
- package/prisma/seeders/utils/config.js +103 -0
- package/prisma/seeders/utils/connection-manager.js +380 -0
- package/prisma/seeders/utils/content-seeder.js +472 -0
- package/prisma/seeders/utils/core-seeder.js +330 -0
- package/prisma/seeders/utils/json-loader.js +69 -0
- package/prisma/seeders/utils/performance-config.js +341 -0
- package/prisma/seeders/utils/performance-helpers.js +206 -0
- package/prisma/seeders/utils/progress-tracker.js +364 -0
- package/prisma/seeders/utils/seeder-config-mapper.js +316 -0
- package/scripts/seed-databases.js +873 -0
- package/scripts/sync-schemas.js +865 -0
- package/scripts/truncate-tables.js +1048 -0
- package/src/prisma/client.d.ts +1 -0
- package/src/prisma/client.js +4 -0
- package/src/prisma/default.d.ts +1 -0
- package/src/prisma/default.js +4 -0
- package/src/prisma/edge.d.ts +1 -0
- package/src/prisma/edge.js +2084 -0
- package/src/prisma/index-browser.js +2043 -0
- package/src/prisma/index.d.ts +202051 -0
- package/src/prisma/index.js +2113 -0
- package/src/prisma/libquery_engine-darwin.dylib.node +0 -0
- package/src/prisma/libquery_engine-darwin.dylib.node.tmp24628 +0 -0
- package/src/prisma/libquery_engine-darwin.dylib.node.tmp29464 +0 -0
- package/src/prisma/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/src/prisma/package.json +140 -0
- package/src/prisma/query_engine-windows.dll.node +0 -0
- package/src/prisma/query_engine-windows.dll.node.tmp4144 +0 -0
- package/src/prisma/runtime/edge-esm.js +34 -0
- package/src/prisma/runtime/edge.js +34 -0
- package/src/prisma/runtime/index-browser.d.ts +370 -0
- package/src/prisma/runtime/index-browser.js +16 -0
- package/src/prisma/runtime/library.d.ts +3647 -0
- package/src/prisma/runtime/library.js +146 -0
- package/src/prisma/runtime/react-native.js +83 -0
- package/src/prisma/runtime/wasm.js +35 -0
- package/src/prisma/schema.prisma +2609 -0
- package/src/prisma/wasm.d.ts +1 -0
- package/src/prisma/wasm.js +2043 -0
|
@@ -0,0 +1,2609 @@
|
|
|
1
|
+
// This is your Prisma schema file,
|
|
2
|
+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
3
|
+
|
|
4
|
+
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
5
|
+
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
6
|
+
|
|
7
|
+
generator client {
|
|
8
|
+
provider = "prisma-client-js"
|
|
9
|
+
output = "../src/prisma"
|
|
10
|
+
binaryTargets = ["native", "windows", "darwin", "debian-openssl-3.0.x"] // Add all required platforms
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
datasource db {
|
|
14
|
+
provider = "postgresql"
|
|
15
|
+
url = env("DEFAULT_DATABASE_URL")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//---------------------------------- SERIAL NUMBER CONFIGURATION MODEL START ------------------------------------------------
|
|
19
|
+
model SerialNumberConfiguration {
|
|
20
|
+
id Int @id @default(autoincrement())
|
|
21
|
+
module String? @unique
|
|
22
|
+
alias String?
|
|
23
|
+
initial_number Int?
|
|
24
|
+
current_number Int?
|
|
25
|
+
created_at DateTime? @default(now())
|
|
26
|
+
|
|
27
|
+
@@index([module])
|
|
28
|
+
@@map("serial_number_configurations")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//---------------------------------- SERIALNUMBERCONFIGURATION MODEL END ------------------------------------------------
|
|
32
|
+
|
|
33
|
+
//---------------------------------- USER MODEL START ------------------------------------------------
|
|
34
|
+
|
|
35
|
+
enum StatusEnum {
|
|
36
|
+
Active
|
|
37
|
+
InActive
|
|
38
|
+
Blocked
|
|
39
|
+
Suspended
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
model User {
|
|
43
|
+
id Int @id @default(autoincrement())
|
|
44
|
+
uuid String? @unique @default(uuid())
|
|
45
|
+
unique_id String? @unique
|
|
46
|
+
name String?
|
|
47
|
+
first_name String?
|
|
48
|
+
middle_name String?
|
|
49
|
+
last_name String?
|
|
50
|
+
email_id String? @unique
|
|
51
|
+
password String?
|
|
52
|
+
country_code String?
|
|
53
|
+
mobile_number String? @unique
|
|
54
|
+
status StatusEnum @default(InActive)
|
|
55
|
+
is_email_verified Boolean @default(false)
|
|
56
|
+
is_mobile_verified Boolean @default(false)
|
|
57
|
+
profile_picture String?
|
|
58
|
+
invitation_status Boolean @default(false)
|
|
59
|
+
reset_token String?
|
|
60
|
+
reset_token_expiry DateTime? @db.Timestamptz(6)
|
|
61
|
+
access_token_expiry String?
|
|
62
|
+
token_version Int? @default(0) // This will be used to invalidate old refresh tokens
|
|
63
|
+
is_logged_in Boolean @default(false)
|
|
64
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
65
|
+
created_by Int?
|
|
66
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
67
|
+
updated_by Int?
|
|
68
|
+
is_deleted Boolean @default(false)
|
|
69
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
70
|
+
deleted_by Int?
|
|
71
|
+
user_roles UserRole[]
|
|
72
|
+
user_department UserDepartment[]
|
|
73
|
+
approval_hierarchy ApprovalHierarchy[]
|
|
74
|
+
approval_journey ApprovalJourney[]
|
|
75
|
+
approval_level_escalation ApprovalLevelEscalation[]
|
|
76
|
+
ticket_replies TicketReply[] @relation("user_reply")
|
|
77
|
+
ticket_assignment_by TicketAssignment[] @relation("user_assigned_by")
|
|
78
|
+
ticket_assignment_to TicketAssignment[] @relation("user_assigned_to")
|
|
79
|
+
ticket_assignment_by_user TicketHistory[] @relation("user_assigned_by")
|
|
80
|
+
ticket_assignment_to_user TicketHistory[] @relation("user_assigned_to")
|
|
81
|
+
vendor_profile_status_updated_by VendorStatus[] @relation("vendor_profile_status_updated_by")
|
|
82
|
+
vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
|
|
83
|
+
admin_alerts AdminAlert[]
|
|
84
|
+
purchase_intake PurchaseIntake[]
|
|
85
|
+
approval_level_user ApprovalLevelUser[]
|
|
86
|
+
approval_level_escalation_user ApprovalLevelEscalationUser[]
|
|
87
|
+
purchase_intake_deleted_by PurchaseIntake[] @relation("purchase_intake_deleted_by")
|
|
88
|
+
template Template[]
|
|
89
|
+
event Event[]
|
|
90
|
+
form_master FormMaster[]
|
|
91
|
+
dynamic_form DynamicForm[]
|
|
92
|
+
purchase_order PurchaseOrder[]
|
|
93
|
+
purchase_order_activity_log PurchaseOrderActivityLog[]
|
|
94
|
+
user_socket_tokens UserVendorSocketTokens[]
|
|
95
|
+
activity_logs ActivityLog[]
|
|
96
|
+
contact_us ContactUs[]
|
|
97
|
+
upload_logs UploadLog[]
|
|
98
|
+
chat_thread ChatThread[]
|
|
99
|
+
export_logs ExportLog[]
|
|
100
|
+
department_head Department[] @relation("department_head")
|
|
101
|
+
budget_manager Department[] @relation("budget_manager")
|
|
102
|
+
|
|
103
|
+
@@map("users")
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
//---------------------------------- USER MODEL END ------------------------------------------------
|
|
107
|
+
|
|
108
|
+
//---------------------------------- ROLE MODEL START ------------------------------------------------
|
|
109
|
+
model Role {
|
|
110
|
+
id Int @id @default(autoincrement())
|
|
111
|
+
role_name String?
|
|
112
|
+
slug String @unique
|
|
113
|
+
description String?
|
|
114
|
+
is_active Boolean @default(false)
|
|
115
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
116
|
+
created_by Int?
|
|
117
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
118
|
+
updated_by Int?
|
|
119
|
+
is_deleted Boolean @default(false)
|
|
120
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
121
|
+
deleted_by Int?
|
|
122
|
+
user_roles UserRole[]
|
|
123
|
+
role_permission RolePermission[]
|
|
124
|
+
approval_hierarchy ApprovalHierarchy[]
|
|
125
|
+
|
|
126
|
+
@@map("roles")
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
//---------------------------------- ROLE MODEL END ------------------------------------------------
|
|
130
|
+
|
|
131
|
+
//---------------------------------- USER ROLE MODEL START ------------------------------------------------
|
|
132
|
+
model UserRole {
|
|
133
|
+
id Int @id @default(autoincrement())
|
|
134
|
+
user_id Int
|
|
135
|
+
role_id Int
|
|
136
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
137
|
+
created_by Int?
|
|
138
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
139
|
+
updated_by Int?
|
|
140
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
141
|
+
deleted_by Int?
|
|
142
|
+
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
143
|
+
role Role @relation(fields: [role_id], references: [id], onDelete: Cascade)
|
|
144
|
+
|
|
145
|
+
@@map("user_roles")
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
//---------------------------------- USER ROLE MODEL END ------------------------------------------------
|
|
149
|
+
|
|
150
|
+
//---------------------------------- PERMISSION MODEL START ------------------------------------------------
|
|
151
|
+
model Permission {
|
|
152
|
+
id Int @id @default(autoincrement())
|
|
153
|
+
permissions_name String?
|
|
154
|
+
slug String @unique
|
|
155
|
+
description String?
|
|
156
|
+
model String?
|
|
157
|
+
is_active Boolean @default(false)
|
|
158
|
+
is_deleted Boolean @default(false)
|
|
159
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
160
|
+
created_by Int?
|
|
161
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
162
|
+
updated_by Int?
|
|
163
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
164
|
+
deleted_by Int?
|
|
165
|
+
role_permission RolePermission[]
|
|
166
|
+
|
|
167
|
+
@@map("permissions")
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//---------------------------------- PERMISSION MODEL END ------------------------------------------------
|
|
171
|
+
|
|
172
|
+
//---------------------------------- ROLE PERMISSION MODEL START ------------------------------------------------
|
|
173
|
+
model RolePermission {
|
|
174
|
+
id Int @id @default(autoincrement())
|
|
175
|
+
permission_id Int
|
|
176
|
+
role_id Int
|
|
177
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
178
|
+
created_by Int?
|
|
179
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
180
|
+
updated_by Int?
|
|
181
|
+
is_deleted Boolean @default(false)
|
|
182
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
183
|
+
deleted_by Int?
|
|
184
|
+
|
|
185
|
+
permission Permission @relation(fields: [permission_id], references: [id], onDelete: Cascade)
|
|
186
|
+
role Role @relation(fields: [role_id], references: [id], onDelete: Cascade)
|
|
187
|
+
|
|
188
|
+
@@map("role_permissions")
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
//---------------------------------- ROLE PERMISSION MODEL END ------------------------------------------------
|
|
192
|
+
|
|
193
|
+
//---------------------------------- DEPARTMENT MODEL START ------------------------------------------------
|
|
194
|
+
model Department {
|
|
195
|
+
id Int @id @default(autoincrement())
|
|
196
|
+
uuid String? @unique @default(uuid())
|
|
197
|
+
department_name String?
|
|
198
|
+
department_slug String? @unique
|
|
199
|
+
department_head Int?
|
|
200
|
+
department_head_user User? @relation("department_head", fields: [department_head], references: [id])
|
|
201
|
+
budget_manager Int?
|
|
202
|
+
budget_manager_user User? @relation("budget_manager", fields: [budget_manager], references: [id])
|
|
203
|
+
description String?
|
|
204
|
+
is_active Boolean @default(false)
|
|
205
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
206
|
+
created_by Int?
|
|
207
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
208
|
+
updated_by Int?
|
|
209
|
+
is_deleted Boolean @default(false)
|
|
210
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
211
|
+
deleted_by Int?
|
|
212
|
+
user_department UserDepartment[]
|
|
213
|
+
department_budget DepartmentBudget[]
|
|
214
|
+
|
|
215
|
+
@@map("departments")
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
//---------------------------------- DEPARTMENT MODEL END ------------------------------------------------
|
|
219
|
+
|
|
220
|
+
//---------------------------------- USER DEPARTMENT MODEL START ------------------------------------------------
|
|
221
|
+
model UserDepartment {
|
|
222
|
+
id Int @id @default(autoincrement())
|
|
223
|
+
uuid String? @unique @default(uuid())
|
|
224
|
+
user_id Int?
|
|
225
|
+
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
226
|
+
department_id Int?
|
|
227
|
+
department Department? @relation(fields: [department_id], references: [id], onDelete: Cascade)
|
|
228
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
229
|
+
created_by Int?
|
|
230
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
231
|
+
updated_by Int?
|
|
232
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
233
|
+
deleted_by Int?
|
|
234
|
+
|
|
235
|
+
@@map("user_departments")
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//---------------------------------- USER DEPARTMENT MODEL END ------------------------------------------------
|
|
239
|
+
|
|
240
|
+
//---------------------------------- CATEGORY MODEL START ----------------------------------
|
|
241
|
+
model Category {
|
|
242
|
+
id Int @id @default(autoincrement())
|
|
243
|
+
uuid String? @unique @default(uuid())
|
|
244
|
+
name String? @unique
|
|
245
|
+
slug String?
|
|
246
|
+
is_active Boolean @default(true)
|
|
247
|
+
parent_id Int @default(0)
|
|
248
|
+
description String?
|
|
249
|
+
image_url String?
|
|
250
|
+
created_by Int?
|
|
251
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
252
|
+
updated_by Int?
|
|
253
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
254
|
+
is_deleted Boolean @default(false)
|
|
255
|
+
deleted_by Int?
|
|
256
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
257
|
+
attributes Attribute[]
|
|
258
|
+
vendor_categories VendorCategory[]
|
|
259
|
+
Item Item[]
|
|
260
|
+
category_uom UomCategory[]
|
|
261
|
+
CategoryBudget CategoryBudget[]
|
|
262
|
+
|
|
263
|
+
@@map("categories")
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
//---------------------------------- CATEGORY MODEL END ----------------------------------
|
|
267
|
+
|
|
268
|
+
//---------------------------------- ATTRIBUTE MODEL START ----------------------------------
|
|
269
|
+
model Attribute {
|
|
270
|
+
id Int @id @default(autoincrement())
|
|
271
|
+
uuid String? @unique @default(uuid())
|
|
272
|
+
category_id Int?
|
|
273
|
+
category Category? @relation(fields: [category_id], references: [id])
|
|
274
|
+
attribute_name String?
|
|
275
|
+
is_required Boolean? @default(false)
|
|
276
|
+
is_active Boolean? @default(true)
|
|
277
|
+
slug String?
|
|
278
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
279
|
+
created_by Int?
|
|
280
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
281
|
+
updated_by Int?
|
|
282
|
+
is_deleted Boolean? @default(false)
|
|
283
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
284
|
+
deleted_by Int?
|
|
285
|
+
attribute_values AttributeValue[]
|
|
286
|
+
item_attributes ItemAttribute[]
|
|
287
|
+
|
|
288
|
+
@@unique([category_id, attribute_name])
|
|
289
|
+
@@map("attributes")
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
//---------------------------------- ATTRIBUTE MODEL END ----------------------------------
|
|
293
|
+
|
|
294
|
+
//---------------------------------- ATTRIBUTEVALUE MODEL START ----------------------------------
|
|
295
|
+
model AttributeValue {
|
|
296
|
+
id Int @id @default(autoincrement())
|
|
297
|
+
uuid String? @unique @default(uuid())
|
|
298
|
+
attribute_id Int?
|
|
299
|
+
attribute Attribute? @relation(fields: [attribute_id], references: [id])
|
|
300
|
+
attribute_value_name String?
|
|
301
|
+
is_active Boolean @default(true)
|
|
302
|
+
slug String?
|
|
303
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
304
|
+
created_by Int?
|
|
305
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
306
|
+
updated_by Int?
|
|
307
|
+
is_deleted Boolean? @default(false)
|
|
308
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
309
|
+
deleted_by Int?
|
|
310
|
+
item_attribute_values ItemAttributeValue[]
|
|
311
|
+
|
|
312
|
+
@@unique([attribute_id, attribute_value_name])
|
|
313
|
+
@@map("attribute_values")
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
//---------------------------------- ATTRIBUTEVALUE MODEL END ----------------------------------
|
|
317
|
+
|
|
318
|
+
//---------------------------------- ITEM MODEL START ----------------------------------
|
|
319
|
+
model Item {
|
|
320
|
+
id Int @id @default(autoincrement())
|
|
321
|
+
uuid String? @unique @default(uuid())
|
|
322
|
+
is_parent Boolean @default(false)
|
|
323
|
+
parent_id Int? @default(0)
|
|
324
|
+
category_id Int?
|
|
325
|
+
category Category? @relation(fields: [category_id], references: [id])
|
|
326
|
+
uomId Int?
|
|
327
|
+
uom Uom? @relation(fields: [uomId], references: [id])
|
|
328
|
+
item_code String? @unique
|
|
329
|
+
item_name String?
|
|
330
|
+
item_handler String?
|
|
331
|
+
slug String? @unique
|
|
332
|
+
description String?
|
|
333
|
+
terms_and_conditions String[]
|
|
334
|
+
keywords String[]
|
|
335
|
+
tags Json? @db.JsonB
|
|
336
|
+
cost_price Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
337
|
+
selling_price Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
338
|
+
profit Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
339
|
+
margin Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
340
|
+
title String? @db.VarChar(150)
|
|
341
|
+
continue_selling_when_out_of_stock Boolean? @default(false)
|
|
342
|
+
physical_product Boolean? @default(false)
|
|
343
|
+
variant_attributes Json? @db.JsonB // {"color": "red", "size": "large", "material": "cotton"}
|
|
344
|
+
variant_display_name String? @db.VarChar(200) // "Red Large Cotton" - auto-generated or custom
|
|
345
|
+
available_qty Int? @default(0)
|
|
346
|
+
inventory_reason String? @db.VarChar(150)
|
|
347
|
+
reserved_quantity Int? @default(0)
|
|
348
|
+
stock_in_hand Int? @default(0)
|
|
349
|
+
reorder_level Int? @default(0) // NEW: When to reorder
|
|
350
|
+
max_stock_level Int? // NEW: Maximum stock level
|
|
351
|
+
sku String? @unique @db.VarChar(255)
|
|
352
|
+
is_taxable Boolean? @default(false)
|
|
353
|
+
bar_code String? @unique @db.VarChar(255) // Made unique
|
|
354
|
+
physical_item Boolean? @default(false)
|
|
355
|
+
track_quantity Boolean? @default(false)
|
|
356
|
+
weight Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
357
|
+
dimensions Json? @db.JsonB // {"length": 10, "width": 5, "height": 2, "unit": "cm"}
|
|
358
|
+
shipping_weight Decimal? @db.Decimal(10, 2) // Different from product weight
|
|
359
|
+
media Json? @db.JsonB
|
|
360
|
+
specifications Json? @db.JsonB
|
|
361
|
+
template_suffix String?
|
|
362
|
+
seo_page_title String?
|
|
363
|
+
seo_meta_keyword String?
|
|
364
|
+
seo_meta_description String?
|
|
365
|
+
step_completed Int? @default(0)
|
|
366
|
+
is_published Boolean? @default(false)
|
|
367
|
+
published_at DateTime? @db.Timestamptz(6)
|
|
368
|
+
published_by Int?
|
|
369
|
+
is_active Boolean @default(true)
|
|
370
|
+
is_featured Boolean @default(false) // NEW: For featured products
|
|
371
|
+
is_default_variant Boolean @default(false) // NEW: Default variant for parent
|
|
372
|
+
sort_order Int @default(0) // NEW: For ordering variants
|
|
373
|
+
min_order_qty Int @default(1) // Minimum order quantity
|
|
374
|
+
max_order_qty Int? // Maximum order quantity
|
|
375
|
+
is_bulk_pricing_enabled Boolean @default(false) // For bulk pricing
|
|
376
|
+
bulk_pricing_tiers Json? @db.JsonB // [{"qty": 10, "price": 20}, {"qty": 50, "price": 18}]
|
|
377
|
+
created_by Int?
|
|
378
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
379
|
+
updated_by Int?
|
|
380
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
381
|
+
is_deleted Boolean @default(false)
|
|
382
|
+
deleted_by Int?
|
|
383
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
384
|
+
purchase_intake_items PurchaseIntakeItem[]
|
|
385
|
+
item_attributes ItemAttribute[]
|
|
386
|
+
item_attribute_values ItemAttributeValue[]
|
|
387
|
+
item_documents ItemDocument[]
|
|
388
|
+
event_items EventItems[]
|
|
389
|
+
purchase_order_items PurchaseOrderItem[]
|
|
390
|
+
|
|
391
|
+
@@unique([item_handler, item_name])
|
|
392
|
+
@@index([parent_id, is_active, is_deleted]) // For variant queries
|
|
393
|
+
@@index([is_parent, is_published, is_active]) // For parent product queries
|
|
394
|
+
@@index([available_qty]) // For stock queries
|
|
395
|
+
@@index([reorder_level, available_qty]) // For low stock alerts
|
|
396
|
+
@@index([category_id, is_published, is_active]) // For category browsing
|
|
397
|
+
@@index([created_at]) // For recent products
|
|
398
|
+
@@index([selling_price]) // For price filtering
|
|
399
|
+
@@map("item")
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
//---------------------------------- ITEM MODEL END ----------------------------------
|
|
403
|
+
|
|
404
|
+
//---------------------------------- PURCHASEINTAKES MODEL START ----------------------------------
|
|
405
|
+
|
|
406
|
+
// Enum for priority levels
|
|
407
|
+
enum PurchaseIntakePriorityEnum {
|
|
408
|
+
Urgent
|
|
409
|
+
High
|
|
410
|
+
Medium
|
|
411
|
+
Low
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Enum for status levels
|
|
415
|
+
enum PurchaseIntakeStatusEnum {
|
|
416
|
+
Approved
|
|
417
|
+
InProgress
|
|
418
|
+
Pending
|
|
419
|
+
Rejected
|
|
420
|
+
Completed
|
|
421
|
+
Cancelled
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
enum PurchaseRequestStatusEnum {
|
|
425
|
+
Open
|
|
426
|
+
InProgress
|
|
427
|
+
OnHold
|
|
428
|
+
Partial
|
|
429
|
+
Closed
|
|
430
|
+
Cancelled
|
|
431
|
+
Completed
|
|
432
|
+
Rejected
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
model PurchaseIntake {
|
|
436
|
+
id Int @id @default(autoincrement())
|
|
437
|
+
uuid String? @unique @default(uuid())
|
|
438
|
+
pi_number String? @unique
|
|
439
|
+
pr_number String? @unique
|
|
440
|
+
requestor_id Int?
|
|
441
|
+
user User? @relation(fields: [requestor_id], references: [id], onDelete: Cascade)
|
|
442
|
+
department String?
|
|
443
|
+
request_date DateTime? @default(now()) @db.Timestamptz(6)
|
|
444
|
+
items_or_services_description String?
|
|
445
|
+
priority PurchaseIntakePriorityEnum
|
|
446
|
+
estimated_budget Float?
|
|
447
|
+
status PurchaseIntakeStatusEnum @default(Pending)
|
|
448
|
+
pr_status PurchaseRequestStatusEnum @default(Open)
|
|
449
|
+
reject_reason String?
|
|
450
|
+
pr_reject_reason String?
|
|
451
|
+
attachments Json?
|
|
452
|
+
if_yes_attach_quotations Json?
|
|
453
|
+
others Json?
|
|
454
|
+
is_active Boolean @default(true)
|
|
455
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
456
|
+
created_by Int?
|
|
457
|
+
updated_by Int?
|
|
458
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
459
|
+
is_deleted Boolean @default(false)
|
|
460
|
+
delete_reason String?
|
|
461
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
462
|
+
deleted_by Int?
|
|
463
|
+
deleted_by_user User? @relation("purchase_intake_deleted_by", fields: [deleted_by], references: [id])
|
|
464
|
+
purchase_intake_item PurchaseIntakeItem[]
|
|
465
|
+
events Event[]
|
|
466
|
+
event_items EventItems[]
|
|
467
|
+
purchase_order_items PurchaseOrderItem[]
|
|
468
|
+
|
|
469
|
+
@@map("purchase_intakes")
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
//---------------------------------- PURCHASEINTAKES MODEL END ----------------------------------
|
|
473
|
+
|
|
474
|
+
//---------------------------------- PURCHASEINTAKESITEMS MODEL START ----------------------------------
|
|
475
|
+
|
|
476
|
+
enum PurchaseIntakeItemEnum {
|
|
477
|
+
Open
|
|
478
|
+
InProgress
|
|
479
|
+
OnHold
|
|
480
|
+
Partial
|
|
481
|
+
Closed
|
|
482
|
+
Cancelled
|
|
483
|
+
Completed
|
|
484
|
+
Rejected
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
model PurchaseIntakeItem {
|
|
488
|
+
id Int @id @default(autoincrement())
|
|
489
|
+
uuid String? @unique @default(uuid())
|
|
490
|
+
purchase_intakes_id Int?
|
|
491
|
+
purchase_intake PurchaseIntake? @relation(fields: [purchase_intakes_id], references: [id], onDelete: Cascade)
|
|
492
|
+
item_id Int?
|
|
493
|
+
items Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
|
|
494
|
+
quantity Int?
|
|
495
|
+
initial_quantity Int?
|
|
496
|
+
open_quantity Int?
|
|
497
|
+
closed_quantity Int? @default(0)
|
|
498
|
+
unit_of_measurement String?
|
|
499
|
+
location_id Int?
|
|
500
|
+
location Location? @relation(fields: [location_id], references: [id], onDelete: Cascade)
|
|
501
|
+
status PurchaseIntakeItemEnum @default(Open)
|
|
502
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
503
|
+
|
|
504
|
+
@@map("purchase_intakes_items")
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
//---------------------------------- PURCHASEINTAKESITEMS MODEL END ----------------------------------
|
|
508
|
+
|
|
509
|
+
//---------------------------------- VENDOR MODEL START ------------------------------------------------
|
|
510
|
+
|
|
511
|
+
model Vendor {
|
|
512
|
+
id Int @id @default(autoincrement())
|
|
513
|
+
uuid String? @unique @default(uuid())
|
|
514
|
+
vendor_id String? @unique
|
|
515
|
+
name String?
|
|
516
|
+
legal_name String?
|
|
517
|
+
email_id String? @unique
|
|
518
|
+
mobile_number String? @unique
|
|
519
|
+
password String?
|
|
520
|
+
country_code String?
|
|
521
|
+
gst_in String?
|
|
522
|
+
person_in_charge String?
|
|
523
|
+
city String?
|
|
524
|
+
industry String?
|
|
525
|
+
incorporation_date DateTime? @db.Timestamptz(6)
|
|
526
|
+
ownership_type String?
|
|
527
|
+
head_office_location String?
|
|
528
|
+
operational_region Json?
|
|
529
|
+
pan_number String?
|
|
530
|
+
pan_image String?
|
|
531
|
+
is_pan_verified Boolean? @default(false)
|
|
532
|
+
pan_verification_request String?
|
|
533
|
+
pan_verification_response String?
|
|
534
|
+
gst_number String?
|
|
535
|
+
is_gst_verified Boolean? @default(false)
|
|
536
|
+
gst_verification_request String?
|
|
537
|
+
gst_verification_response String?
|
|
538
|
+
is_basic_info_registered Boolean? @default(false)
|
|
539
|
+
status StatusEnum @default(InActive)
|
|
540
|
+
is_email_verified Boolean @default(false)
|
|
541
|
+
is_mobile_verified Boolean @default(false)
|
|
542
|
+
profile_picture String?
|
|
543
|
+
invitation_status Boolean @default(false)
|
|
544
|
+
reset_token String?
|
|
545
|
+
reset_token_expiry DateTime? @db.Timestamptz(6)
|
|
546
|
+
access_token_expiry String?
|
|
547
|
+
token_version Int? @default(0) // This will be used to invalidate old refresh tokens
|
|
548
|
+
is_logged_in Boolean @default(false)
|
|
549
|
+
onboarded_on DateTime? @db.Timestamptz(6)
|
|
550
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
551
|
+
created_by Int?
|
|
552
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
553
|
+
updated_by Int?
|
|
554
|
+
is_deleted Boolean @default(false)
|
|
555
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
556
|
+
deleted_by Int?
|
|
557
|
+
is_kyc_approved VendorKycVerificationStatusEnum @default(PENDING)
|
|
558
|
+
vendor_categories VendorCategory[]
|
|
559
|
+
vendor_contact_persons VendorContactPerson[]
|
|
560
|
+
event_vendors EventVendors[]
|
|
561
|
+
vendor_kyc_info VendorKycInfo[]
|
|
562
|
+
support_tickets SupportTicket[]
|
|
563
|
+
ticket_replies TicketReply[] @relation("vendor_reply")
|
|
564
|
+
vendor_status VendorStatus[]
|
|
565
|
+
vendor_event_watchlist VendorEventWatchlist[]
|
|
566
|
+
vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
|
|
567
|
+
vendor_alerts VendorAlert[]
|
|
568
|
+
purchase_order_activity_log PurchaseOrderActivityLog[]
|
|
569
|
+
vendor_socket_tokens UserVendorSocketTokens[]
|
|
570
|
+
activity_logs ActivityLog[]
|
|
571
|
+
|
|
572
|
+
@@map("vendors")
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
//---------------------------------- VENDOR MODEL END ------------------------------------------------
|
|
576
|
+
|
|
577
|
+
//---------------------------------- VENDOR CATEGORY MODEL START ------------------------------------------------
|
|
578
|
+
model VendorCategory {
|
|
579
|
+
id Int @id @default(autoincrement())
|
|
580
|
+
uuid String? @unique @default(uuid())
|
|
581
|
+
vendor_id Int
|
|
582
|
+
vendor Vendor @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
583
|
+
category_id Int
|
|
584
|
+
category Category @relation(fields: [category_id], references: [id], onDelete: Cascade)
|
|
585
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
586
|
+
created_by Int?
|
|
587
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
588
|
+
updated_by Int?
|
|
589
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
590
|
+
deleted_by Int?
|
|
591
|
+
|
|
592
|
+
@@map("vendor_categories")
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
//---------------------------------- VENDOR CATEGORY MODEL END ------------------------------------------------
|
|
596
|
+
|
|
597
|
+
//---------------------------------- VENDOR CONTACT PERSON MODEL START ------------------------------------------------
|
|
598
|
+
enum ContactTypeEnum {
|
|
599
|
+
Primary
|
|
600
|
+
Secondary
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
model VendorContactPerson {
|
|
604
|
+
id Int @id @default(autoincrement())
|
|
605
|
+
uuid String? @unique @default(uuid())
|
|
606
|
+
vendor_id Int
|
|
607
|
+
vendor Vendor @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
608
|
+
name String?
|
|
609
|
+
email_id String?
|
|
610
|
+
country_code String?
|
|
611
|
+
mobile_number String?
|
|
612
|
+
designation String?
|
|
613
|
+
contact_type ContactTypeEnum @default(Primary)
|
|
614
|
+
is_active Boolean @default(true)
|
|
615
|
+
is_deleted Boolean @default(false)
|
|
616
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
617
|
+
created_by Int?
|
|
618
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
619
|
+
updated_by Int?
|
|
620
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
621
|
+
deleted_by Int?
|
|
622
|
+
|
|
623
|
+
@@map("vendor_contact_persons")
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
//---------------------------------- VENDOR CONTACT PERSON MODEL END ------------------------------------------------
|
|
627
|
+
|
|
628
|
+
//---------------------------------- EMAILTEMPLATE MODEL END ------------------------------------------------
|
|
629
|
+
model EmailTemplate {
|
|
630
|
+
id Int @id @default(autoincrement())
|
|
631
|
+
uuid String? @unique @default(uuid())
|
|
632
|
+
template_name String?
|
|
633
|
+
template_slug String? @unique @db.VarChar(100)
|
|
634
|
+
subject String?
|
|
635
|
+
html_content String?
|
|
636
|
+
macro String?
|
|
637
|
+
is_active Boolean? @default(true)
|
|
638
|
+
is_deleted Boolean? @default(false)
|
|
639
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
640
|
+
created_by Int?
|
|
641
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
642
|
+
updated_by Int?
|
|
643
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
644
|
+
deleted_by Int?
|
|
645
|
+
|
|
646
|
+
@@map("email_templates")
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
//---------------------------------- EMAILTEMPLATE MODEL END ------------------------------------------------
|
|
650
|
+
|
|
651
|
+
//---------------------------------- SMTP MODEL START ------------------------------------------------
|
|
652
|
+
model SmtpConfig {
|
|
653
|
+
id Int @id @default(autoincrement())
|
|
654
|
+
smtp_server String @unique
|
|
655
|
+
port Int?
|
|
656
|
+
username String?
|
|
657
|
+
password String?
|
|
658
|
+
from_email String?
|
|
659
|
+
encryption String?
|
|
660
|
+
test_email String?
|
|
661
|
+
is_active Boolean @default(false)
|
|
662
|
+
is_deleted Boolean @default(false)
|
|
663
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
664
|
+
created_by Int?
|
|
665
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
666
|
+
updated_by Int?
|
|
667
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
668
|
+
deleted_by Int?
|
|
669
|
+
|
|
670
|
+
@@map("smtp_config")
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
//---------------------------------- SMTP MODEL END ------------------------------------------------
|
|
674
|
+
|
|
675
|
+
//---------------------------------- APPROVAL HIERARCHY MODEL START ------------------------------------------------
|
|
676
|
+
enum InitiatorTypeEnum {
|
|
677
|
+
Role
|
|
678
|
+
User
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
model ApprovalHierarchy {
|
|
682
|
+
id Int @id @default(autoincrement())
|
|
683
|
+
uuid String? @unique @default(uuid())
|
|
684
|
+
name String?
|
|
685
|
+
slug String? @unique
|
|
686
|
+
module String?
|
|
687
|
+
task String?
|
|
688
|
+
initiator_type InitiatorTypeEnum
|
|
689
|
+
roleId Int?
|
|
690
|
+
role Role? @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
|
691
|
+
userId Int?
|
|
692
|
+
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
693
|
+
is_active Boolean @default(true)
|
|
694
|
+
is_deleted Boolean @default(false)
|
|
695
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
696
|
+
created_by Int?
|
|
697
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
698
|
+
updated_by Int?
|
|
699
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
700
|
+
deleted_by Int?
|
|
701
|
+
approval_condition ApprovalCondition[]
|
|
702
|
+
approval_level ApprovalLevel[]
|
|
703
|
+
approval_journey ApprovalJourney[]
|
|
704
|
+
|
|
705
|
+
@@map("approval_hierarchy")
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
//---------------------------------- APPROVAL HIERARCHY MODEL END ------------------------------------------------
|
|
709
|
+
|
|
710
|
+
//---------------------------------- APPROVAL CONDITION MODEL START ------------------------------------------------
|
|
711
|
+
|
|
712
|
+
enum ConditionTypeEnum {
|
|
713
|
+
Price
|
|
714
|
+
Escalation
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
model ApprovalCondition {
|
|
718
|
+
id Int @id @default(autoincrement())
|
|
719
|
+
uuid String? @unique @default(uuid())
|
|
720
|
+
approval_hierarchy_id Int?
|
|
721
|
+
approval_hierarchy ApprovalHierarchy? @relation(fields: [approval_hierarchy_id], references: [id], onDelete: Cascade)
|
|
722
|
+
conditions ConditionTypeEnum
|
|
723
|
+
price_from Float?
|
|
724
|
+
price_to Float?
|
|
725
|
+
approval_level ApprovalLevel[]
|
|
726
|
+
|
|
727
|
+
@@map("approval_conditions")
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
//---------------------------------- APPROVAL CONDITION MODEL END ------------------------------------------------
|
|
731
|
+
|
|
732
|
+
//---------------------------------- APPROVAL LEVEL MODEL START ------------------------------------------------
|
|
733
|
+
|
|
734
|
+
model ApprovalLevel {
|
|
735
|
+
id Int @id @default(autoincrement())
|
|
736
|
+
uuid String? @unique @default(uuid())
|
|
737
|
+
approval_hierarchy_id Int?
|
|
738
|
+
approval_hierarchy ApprovalHierarchy? @relation(fields: [approval_hierarchy_id], references: [id], onDelete: Cascade)
|
|
739
|
+
approval_condition_id Int?
|
|
740
|
+
approval_condition ApprovalCondition? @relation(fields: [approval_condition_id], references: [id], onDelete: Cascade)
|
|
741
|
+
level String?
|
|
742
|
+
valid_till_hours Int?
|
|
743
|
+
valid_till_minutes Int?
|
|
744
|
+
approval_level_escalation ApprovalLevelEscalation[]
|
|
745
|
+
approval_level_users ApprovalLevelUser[]
|
|
746
|
+
|
|
747
|
+
@@map("approval_levels")
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
//---------------------------------- APPROVAL LEVEL MODEL END ------------------------------------------------
|
|
751
|
+
|
|
752
|
+
//---------------------------------- APPROVAL LEVEL USER MODEL START ------------------------------------------------
|
|
753
|
+
|
|
754
|
+
model ApprovalLevelUser {
|
|
755
|
+
id Int @id @default(autoincrement())
|
|
756
|
+
uuid String? @unique @default(uuid())
|
|
757
|
+
approval_level_id Int?
|
|
758
|
+
approval_level ApprovalLevel? @relation(fields: [approval_level_id], references: [id], onDelete: Cascade)
|
|
759
|
+
approver_id Int?
|
|
760
|
+
user User? @relation(fields: [approver_id], references: [id], onDelete: Cascade)
|
|
761
|
+
|
|
762
|
+
@@unique([approval_level_id, approver_id])
|
|
763
|
+
@@map("approval_level_users")
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
//---------------------------------- APPROVAL LEVEL USER MODEL END ------------------------------------------------
|
|
767
|
+
|
|
768
|
+
//---------------------------------- APPROVAL LEVEL ESCALATIONS MODEL START ------------------------------------------------
|
|
769
|
+
|
|
770
|
+
model ApprovalLevelEscalation {
|
|
771
|
+
id Int @id @default(autoincrement())
|
|
772
|
+
uuid String? @unique @default(uuid())
|
|
773
|
+
approval_level_id Int?
|
|
774
|
+
approval_level ApprovalLevel? @relation(fields: [approval_level_id], references: [id], onDelete: Cascade)
|
|
775
|
+
escalation_approver_id Int?
|
|
776
|
+
user User? @relation(fields: [escalation_approver_id], references: [id], onDelete: Cascade)
|
|
777
|
+
valid_till_hours Int?
|
|
778
|
+
valid_till_minutes Int?
|
|
779
|
+
approval_level_escalation_users ApprovalLevelEscalationUser[]
|
|
780
|
+
|
|
781
|
+
@@map("approval_level_escalations")
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
//---------------------------------- APPROVAL LEVEL ESCALATIONS MODEL END ------------------------------------------------
|
|
785
|
+
|
|
786
|
+
// --------------------------------- APPROVAL LEVEL ESCALATIONS USERS MODEL START ------------------------------------------------
|
|
787
|
+
|
|
788
|
+
model ApprovalLevelEscalationUser {
|
|
789
|
+
id Int @id @default(autoincrement())
|
|
790
|
+
uuid String? @unique @default(uuid())
|
|
791
|
+
approval_level_escalation_id Int?
|
|
792
|
+
approval_level_escalation ApprovalLevelEscalation? @relation(fields: [approval_level_escalation_id], references: [id], onDelete: Cascade)
|
|
793
|
+
approver_id Int?
|
|
794
|
+
user User? @relation(fields: [approver_id], references: [id], onDelete: Cascade)
|
|
795
|
+
|
|
796
|
+
@@unique([approval_level_escalation_id, approver_id])
|
|
797
|
+
@@map("approval_level_escalation_users")
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
//---------------------------------- APPROVAL LEVEL ESCALATIONS MODEL END ------------------------------------------------
|
|
801
|
+
|
|
802
|
+
//---------------------------------- UOM MODEL START ------------------------------------------------
|
|
803
|
+
|
|
804
|
+
model Uom {
|
|
805
|
+
id Int @id @default(autoincrement())
|
|
806
|
+
uuid String? @unique @default(uuid())
|
|
807
|
+
uom_code String? @unique @db.VarChar(25)
|
|
808
|
+
description String? @db.VarChar(300)
|
|
809
|
+
is_active Boolean? @default(false)
|
|
810
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
811
|
+
created_by Int?
|
|
812
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
813
|
+
updated_by Int?
|
|
814
|
+
is_deleted Boolean? @default(false)
|
|
815
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
816
|
+
deleted_by Int?
|
|
817
|
+
|
|
818
|
+
items Item[]
|
|
819
|
+
|
|
820
|
+
uom_category UomCategory[]
|
|
821
|
+
|
|
822
|
+
@@map("uoms")
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
//---------------------------------- UOM MODEL END ------------------------------------------------
|
|
826
|
+
|
|
827
|
+
//---------------------------------- UOM CATEGORY MODEL START ------------------------------------------------
|
|
828
|
+
|
|
829
|
+
model UomCategory {
|
|
830
|
+
id Int @id @default(autoincrement())
|
|
831
|
+
uuid String? @unique @default(uuid())
|
|
832
|
+
Category Category? @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
|
833
|
+
categoryId Int?
|
|
834
|
+
Uom Uom? @relation(fields: [uomId], references: [id], onDelete: Cascade)
|
|
835
|
+
uomId Int?
|
|
836
|
+
created_by Int?
|
|
837
|
+
|
|
838
|
+
@@map("uom_categories")
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
//---------------------------------- UOM CATEGORY MODEL START ------------------------------------------------
|
|
842
|
+
|
|
843
|
+
//---------------------------------- PRODUCT ATTRIBUTE MODEL START ------------------------------------------------
|
|
844
|
+
model ItemAttribute {
|
|
845
|
+
id Int @id @default(autoincrement())
|
|
846
|
+
uuid String? @unique @default(uuid())
|
|
847
|
+
item_id Int?
|
|
848
|
+
item Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
|
|
849
|
+
attribute_id Int?
|
|
850
|
+
attribute Attribute? @relation(fields: [attribute_id], references: [id])
|
|
851
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
852
|
+
created_by Int?
|
|
853
|
+
|
|
854
|
+
item_attribute_values ItemAttributeValue[]
|
|
855
|
+
|
|
856
|
+
@@unique([item_id, attribute_id])
|
|
857
|
+
@@index([item_id])
|
|
858
|
+
@@map("item_attributes")
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
//---------------------------------- PRODUCT ATTRIBUTE MODEL END ------------------------------------------------
|
|
862
|
+
|
|
863
|
+
//---------------------------------- PRODUCT ATTRIBUTE VALUE MODEL START ------------------------------------------------
|
|
864
|
+
model ItemAttributeValue {
|
|
865
|
+
id Int @id @default(autoincrement())
|
|
866
|
+
uuid String? @unique @default(uuid())
|
|
867
|
+
item_id Int?
|
|
868
|
+
item Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
|
|
869
|
+
item_attribute_id Int?
|
|
870
|
+
item_attribute ItemAttribute? @relation(fields: [item_attribute_id], references: [id], onDelete: Cascade)
|
|
871
|
+
attribute_value_id Int?
|
|
872
|
+
attribute_value AttributeValue? @relation(fields: [attribute_value_id], references: [id])
|
|
873
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
874
|
+
created_by Int?
|
|
875
|
+
|
|
876
|
+
@@unique([item_id, item_attribute_id, attribute_value_id])
|
|
877
|
+
@@index([item_id])
|
|
878
|
+
@@map("item_attribute_values")
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
//---------------------------------- PRODUCT ATTRIBUTE VALUE MODEL START ------------------------------------------------
|
|
882
|
+
|
|
883
|
+
//---------------------------------- ITEM DOCUMENTS MODEL START ------------------------------------------------
|
|
884
|
+
|
|
885
|
+
model ItemDocument {
|
|
886
|
+
id Int @id @default(autoincrement())
|
|
887
|
+
uuid String? @unique @default(uuid())
|
|
888
|
+
item_id Int?
|
|
889
|
+
item Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
|
|
890
|
+
original_document String?
|
|
891
|
+
optimized_image String?
|
|
892
|
+
thumbnail_image String?
|
|
893
|
+
original_name String?
|
|
894
|
+
original_extension String?
|
|
895
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
896
|
+
created_by Int?
|
|
897
|
+
|
|
898
|
+
@@map("item_documents")
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
//---------------------------------- ITEM IMAGES MODEL END ------------------------------------------------
|
|
902
|
+
|
|
903
|
+
//---------------------------------- APPROVAL JOURNEY MODEL START ------------------------------------------------
|
|
904
|
+
|
|
905
|
+
enum ApprovalJourneyStatusEnum {
|
|
906
|
+
Pending
|
|
907
|
+
Approved
|
|
908
|
+
AutoApproved
|
|
909
|
+
Rejected
|
|
910
|
+
AutoRejected
|
|
911
|
+
Escalated
|
|
912
|
+
NA
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
model ApprovalJourney {
|
|
916
|
+
id Int @id @default(autoincrement())
|
|
917
|
+
uuid String? @unique @default(uuid())
|
|
918
|
+
parent_id String?
|
|
919
|
+
journy_type String?
|
|
920
|
+
approval_hierarchy_id Int?
|
|
921
|
+
approval_hierarchy ApprovalHierarchy? @relation(fields: [approval_hierarchy_id], references: [id], onDelete: Cascade)
|
|
922
|
+
approvar_id Int?
|
|
923
|
+
user User? @relation(fields: [approvar_id], references: [id], onDelete: Cascade)
|
|
924
|
+
level String?
|
|
925
|
+
status ApprovalJourneyStatusEnum @default(Pending)
|
|
926
|
+
reject_reason String?
|
|
927
|
+
is_approver_turn Boolean @default(false)
|
|
928
|
+
duration String? // Duration in hours and minutes (e.g. "2h 30m")
|
|
929
|
+
valid_to DateTime? @db.Timestamptz(6) // Explicitly use timestamptz
|
|
930
|
+
valid_till DateTime? @db.Timestamptz(6) // Explicitly use timestamptz
|
|
931
|
+
is_deleted Boolean @default(false)
|
|
932
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
933
|
+
created_by Int?
|
|
934
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
935
|
+
updated_by Int?
|
|
936
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
937
|
+
deleted_by Int?
|
|
938
|
+
|
|
939
|
+
@@map("approval_journey")
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
//---------------------------------- APPROVAL JOURNEY MODEL END ------------------------------------------------
|
|
943
|
+
|
|
944
|
+
//---------------------------------- TEMPLATE MODEL START ------------------------------------------------
|
|
945
|
+
|
|
946
|
+
model Template {
|
|
947
|
+
id Int @id @default(autoincrement())
|
|
948
|
+
uuid String? @unique @default(uuid())
|
|
949
|
+
template_code String? @unique
|
|
950
|
+
template_name String?
|
|
951
|
+
template_type Json?
|
|
952
|
+
currency_id Int?
|
|
953
|
+
currency Currency? @relation(fields: [currency_id], references: [id], onDelete: Cascade)
|
|
954
|
+
fields TemplateField[]
|
|
955
|
+
is_active Boolean? @default(false)
|
|
956
|
+
is_deleted Boolean? @default(false)
|
|
957
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
958
|
+
created_by Int?
|
|
959
|
+
user User? @relation(fields: [created_by], references: [id], onDelete: Cascade)
|
|
960
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
961
|
+
updated_by Int?
|
|
962
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
963
|
+
deleted_by Int?
|
|
964
|
+
event Event[]
|
|
965
|
+
|
|
966
|
+
@@map("templates")
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
//---------------------------------- TEMPLATE MODEL END ------------------------------------------------
|
|
970
|
+
|
|
971
|
+
//---------------------------------- TEMPLATE FIELD MODEL START ------------------------------------------------
|
|
972
|
+
|
|
973
|
+
enum FieldType {
|
|
974
|
+
TEXT
|
|
975
|
+
NUMBER
|
|
976
|
+
FORMULA
|
|
977
|
+
DATE
|
|
978
|
+
TIME
|
|
979
|
+
DATETIME
|
|
980
|
+
PERCENTAGE
|
|
981
|
+
MEDIA
|
|
982
|
+
CURRENCY
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
enum FieldRole {
|
|
986
|
+
BUYER
|
|
987
|
+
VENDOR
|
|
988
|
+
AUTO_CALCULATED
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
enum FieldPlacement {
|
|
992
|
+
GLOBAL
|
|
993
|
+
LOCAL
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
model TemplateField {
|
|
997
|
+
id Int @id @default(autoincrement())
|
|
998
|
+
uuid String? @unique @default(uuid())
|
|
999
|
+
template_id Int
|
|
1000
|
+
template Template @relation(fields: [template_id], references: [id])
|
|
1001
|
+
field_name String?
|
|
1002
|
+
field_slug String?
|
|
1003
|
+
field_type FieldType?
|
|
1004
|
+
field_role FieldRole?
|
|
1005
|
+
field_placement FieldPlacement?
|
|
1006
|
+
field_formula String? // Optional formula for formula-driven fields
|
|
1007
|
+
is_mandatory Boolean? @default(false)
|
|
1008
|
+
position Int?
|
|
1009
|
+
is_deleted Boolean? @default(false)
|
|
1010
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1011
|
+
created_by Int?
|
|
1012
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1013
|
+
updated_by Int?
|
|
1014
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1015
|
+
deleted_by Int?
|
|
1016
|
+
|
|
1017
|
+
@@map("template_fields")
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
//---------------------------------- TEMPLATE FIELD MODEL END ------------------------------------------------
|
|
1021
|
+
|
|
1022
|
+
//---------------------------------- FAQ CATEGORY MODEL START ------------------------------------------------
|
|
1023
|
+
|
|
1024
|
+
model FaqCategory {
|
|
1025
|
+
id Int @id @default(autoincrement())
|
|
1026
|
+
uuid String? @unique @default(uuid())
|
|
1027
|
+
category_name String? @unique @db.VarChar(255)
|
|
1028
|
+
slug String? @unique @db.VarChar(255)
|
|
1029
|
+
is_active Boolean? @default(false)
|
|
1030
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1031
|
+
created_by Int?
|
|
1032
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1033
|
+
updated_by Int?
|
|
1034
|
+
is_deleted Boolean? @default(false)
|
|
1035
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1036
|
+
deleted_by Int?
|
|
1037
|
+
faqs Faq[]
|
|
1038
|
+
|
|
1039
|
+
@@map("faq_categories")
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
//---------------------------------- FAQ CATEGORY MODEL END ------------------------------------------------
|
|
1043
|
+
|
|
1044
|
+
//---------------------------------- FAQ MODEL START ------------------------------------------------
|
|
1045
|
+
|
|
1046
|
+
enum FaqType {
|
|
1047
|
+
ADMIN
|
|
1048
|
+
BUYER
|
|
1049
|
+
VENDOR
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
model Faq {
|
|
1053
|
+
id Int @id @default(autoincrement())
|
|
1054
|
+
uuid String? @unique @default(uuid())
|
|
1055
|
+
faq_type FaqType?
|
|
1056
|
+
faq_category_id Int?
|
|
1057
|
+
faq_category FaqCategory? @relation(fields: [faq_category_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1058
|
+
question String? @db.Text()
|
|
1059
|
+
answer String? @db.Text()
|
|
1060
|
+
is_active Boolean? @default(false)
|
|
1061
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1062
|
+
created_by Int?
|
|
1063
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1064
|
+
updated_by Int?
|
|
1065
|
+
is_deleted Boolean? @default(false)
|
|
1066
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1067
|
+
deleted_by Int?
|
|
1068
|
+
|
|
1069
|
+
@@unique([faq_category_id, question, faq_type]) // Composite unique constraint
|
|
1070
|
+
@@map("faqs")
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
//---------------------------------- FAQ MODEL END ------------------------------------------------
|
|
1074
|
+
|
|
1075
|
+
//---------------------------------- EVENT START END ------------------------------------------------
|
|
1076
|
+
|
|
1077
|
+
enum EventStatus {
|
|
1078
|
+
Draft
|
|
1079
|
+
Live
|
|
1080
|
+
Closed
|
|
1081
|
+
Upcoming
|
|
1082
|
+
Cancelled
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
enum EventType {
|
|
1086
|
+
RFQ
|
|
1087
|
+
RFI
|
|
1088
|
+
RFP
|
|
1089
|
+
RAUC
|
|
1090
|
+
FAUC
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
enum EventPhase {
|
|
1094
|
+
Upcoming
|
|
1095
|
+
Invitation
|
|
1096
|
+
PreBids
|
|
1097
|
+
Bidding
|
|
1098
|
+
Evaluation
|
|
1099
|
+
ClosingSoon
|
|
1100
|
+
Closed
|
|
1101
|
+
Expired
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
model Event {
|
|
1105
|
+
id Int @id @default(autoincrement())
|
|
1106
|
+
uuid String? @unique @default(uuid())
|
|
1107
|
+
code String? @unique
|
|
1108
|
+
template_id Int?
|
|
1109
|
+
template Template? @relation(fields: [template_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1110
|
+
type EventType?
|
|
1111
|
+
name String?
|
|
1112
|
+
start_date DateTime? @db.Timestamptz(6) // Explicitly use timestamptz
|
|
1113
|
+
end_date DateTime? @db.Timestamptz(6) // Explicitly use timestamptz
|
|
1114
|
+
duration String?
|
|
1115
|
+
attachments Json?
|
|
1116
|
+
terms_conditions String?
|
|
1117
|
+
step_completed Int?
|
|
1118
|
+
status EventStatus? @default(Draft)
|
|
1119
|
+
event_phase EventPhase?
|
|
1120
|
+
purchase_intake_id Int?
|
|
1121
|
+
purchase_intake PurchaseIntake? @relation(fields: [purchase_intake_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1122
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1123
|
+
created_by Int?
|
|
1124
|
+
user User? @relation(fields: [created_by], references: [id], onDelete: Cascade)
|
|
1125
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1126
|
+
updated_by Int?
|
|
1127
|
+
is_deleted Boolean? @default(false)
|
|
1128
|
+
reason String?
|
|
1129
|
+
is_published Boolean @default(false)
|
|
1130
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1131
|
+
deleted_by Int?
|
|
1132
|
+
event_items EventItems[]
|
|
1133
|
+
event_vendors EventVendors[]
|
|
1134
|
+
event_configurations EventConfigurations[]
|
|
1135
|
+
event_strategies EventStrategies[]
|
|
1136
|
+
vendor_event_watchlist VendorEventWatchlist[]
|
|
1137
|
+
bids Bid[]
|
|
1138
|
+
bid_logs BidLog[]
|
|
1139
|
+
quotations Quotation[]
|
|
1140
|
+
quotation_logs QuotationLog[]
|
|
1141
|
+
purchase_order PurchaseOrder[]
|
|
1142
|
+
|
|
1143
|
+
@@map("events")
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
//---------------------------------- EVENT MODEL END ------------------------------------------------
|
|
1147
|
+
|
|
1148
|
+
//---------------------------------- EVENT ITEMS MODEL START ------------------------------------------------
|
|
1149
|
+
|
|
1150
|
+
model EventItems {
|
|
1151
|
+
id Int @id @default(autoincrement())
|
|
1152
|
+
uuid String? @unique @default(uuid())
|
|
1153
|
+
event_id Int?
|
|
1154
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1155
|
+
item_id Int?
|
|
1156
|
+
item Item? @relation(fields: [item_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1157
|
+
purchase_intake_id Int?
|
|
1158
|
+
purchase_intake PurchaseIntake? @relation(fields: [purchase_intake_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1159
|
+
dynamic_fields Json?
|
|
1160
|
+
is_active Boolean? @default(true)
|
|
1161
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1162
|
+
created_by Int?
|
|
1163
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1164
|
+
updated_by Int?
|
|
1165
|
+
is_deleted Boolean? @default(false)
|
|
1166
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1167
|
+
deleted_by Int?
|
|
1168
|
+
bids Bid[]
|
|
1169
|
+
bid_logs BidLog[]
|
|
1170
|
+
quotations Quotation[]
|
|
1171
|
+
quotation_logs QuotationLog[]
|
|
1172
|
+
|
|
1173
|
+
@@map("event_items")
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
//---------------------------------- EVENT ITEMS MODEL END ------------------------------------------------
|
|
1177
|
+
|
|
1178
|
+
//---------------------------------- VENDOR EVENTS MODEL START ------------------------------------------------
|
|
1179
|
+
|
|
1180
|
+
enum EventVendorStatus {
|
|
1181
|
+
Pending
|
|
1182
|
+
Approved
|
|
1183
|
+
Rejected
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
enum EventVendorBidStatus {
|
|
1187
|
+
INVITED
|
|
1188
|
+
VIEWED
|
|
1189
|
+
DRAFT
|
|
1190
|
+
BIDSUBMITTED
|
|
1191
|
+
SUBMITTED
|
|
1192
|
+
ENDED
|
|
1193
|
+
NORESPONSE
|
|
1194
|
+
EVALUATION
|
|
1195
|
+
WON
|
|
1196
|
+
NOTAWARDED
|
|
1197
|
+
CANCELLED
|
|
1198
|
+
EXPIRED
|
|
1199
|
+
ACCEPTED
|
|
1200
|
+
REJECTED
|
|
1201
|
+
LASTBIDREJECTED
|
|
1202
|
+
BLOCKED
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
model EventVendors {
|
|
1206
|
+
id Int @id @default(autoincrement())
|
|
1207
|
+
uuid String? @unique @default(uuid())
|
|
1208
|
+
vendor_id Int?
|
|
1209
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1210
|
+
event_id Int?
|
|
1211
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1212
|
+
is_active Boolean? @default(true)
|
|
1213
|
+
is_email_sent Boolean? @default(false)
|
|
1214
|
+
is_restricted Boolean? @default(false)
|
|
1215
|
+
status EventVendorStatus @default(Pending)
|
|
1216
|
+
reason String?
|
|
1217
|
+
is_wishlisted Boolean? @default(false)
|
|
1218
|
+
event_vendor_bid_status EventVendorBidStatus? @default(INVITED)
|
|
1219
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1220
|
+
created_by Int?
|
|
1221
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1222
|
+
updated_by Int?
|
|
1223
|
+
is_deleted Boolean? @default(false)
|
|
1224
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1225
|
+
deleted_by Int?
|
|
1226
|
+
bids Bid[]
|
|
1227
|
+
bid_logs BidLog[]
|
|
1228
|
+
quotations Quotation[]
|
|
1229
|
+
quotation_logs QuotationLog[]
|
|
1230
|
+
purchase_order PurchaseOrder[]
|
|
1231
|
+
|
|
1232
|
+
@@index([event_id, vendor_id])
|
|
1233
|
+
@@index([status])
|
|
1234
|
+
@@map("event_vendors")
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
//---------------------------------- VENDOR EVENTS MODEL END ------------------------------------------------
|
|
1238
|
+
|
|
1239
|
+
//---------------------------------- EVENTS CONFIGURATIONS MODEL START ------------------------------------------------
|
|
1240
|
+
|
|
1241
|
+
model EventConfigurations {
|
|
1242
|
+
id Int @id @default(autoincrement())
|
|
1243
|
+
uuid String? @unique @default(uuid())
|
|
1244
|
+
event_id Int?
|
|
1245
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1246
|
+
rule_name String?
|
|
1247
|
+
rule_value Json?
|
|
1248
|
+
rule_slug String?
|
|
1249
|
+
is_active Boolean? @default(false)
|
|
1250
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1251
|
+
created_by Int?
|
|
1252
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1253
|
+
updated_by Int?
|
|
1254
|
+
is_deleted Boolean? @default(false)
|
|
1255
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1256
|
+
deleted_by Int?
|
|
1257
|
+
|
|
1258
|
+
@@map("event_configurations")
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
//---------------------------------- EVENTS CONFIGURATIONS MODEL END ------------------------------------------------
|
|
1262
|
+
|
|
1263
|
+
//---------------------------------- EVENTS STRATEGIES MODEL START ------------------------------------------------
|
|
1264
|
+
|
|
1265
|
+
model EventStrategies {
|
|
1266
|
+
id Int @id @default(autoincrement())
|
|
1267
|
+
uuid String? @unique @default(uuid())
|
|
1268
|
+
event_id Int?
|
|
1269
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1270
|
+
strategy_id Int?
|
|
1271
|
+
strategy Strategies? @relation(fields: [strategy_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1272
|
+
is_active Boolean? @default(false)
|
|
1273
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1274
|
+
created_by Int?
|
|
1275
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1276
|
+
updated_by Int?
|
|
1277
|
+
is_deleted Boolean? @default(false)
|
|
1278
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1279
|
+
deleted_by Int?
|
|
1280
|
+
|
|
1281
|
+
@@map("event_strategies")
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
//---------------------------------- EVENTS STRATEGIES MODEL END ------------------------------------------------
|
|
1285
|
+
|
|
1286
|
+
//---------------------------------- VENDOR EVENTS WATCHLIST MODEL START ------------------------------------------------
|
|
1287
|
+
|
|
1288
|
+
model VendorEventWatchlist {
|
|
1289
|
+
id Int @id @default(autoincrement())
|
|
1290
|
+
uuid String? @unique @default(uuid())
|
|
1291
|
+
vendor_id Int?
|
|
1292
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1293
|
+
event_id Int?
|
|
1294
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1295
|
+
is_active Boolean? @default(true)
|
|
1296
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1297
|
+
created_by Int?
|
|
1298
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1299
|
+
updated_by Int?
|
|
1300
|
+
is_deleted Boolean? @default(false)
|
|
1301
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1302
|
+
deleted_by Int?
|
|
1303
|
+
|
|
1304
|
+
@@map("vendor_event_watchlist")
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
//---------------------------------- VENDOR EVENTS MODEL END ------------------------------------------------
|
|
1308
|
+
|
|
1309
|
+
//---------------------------------- STRATEGIES MODEL START ------------------------------------------------
|
|
1310
|
+
|
|
1311
|
+
model Strategies {
|
|
1312
|
+
id Int @id @default(autoincrement())
|
|
1313
|
+
uuid String? @unique @default(uuid())
|
|
1314
|
+
name String? @unique
|
|
1315
|
+
description String?
|
|
1316
|
+
is_active Boolean? @default(false)
|
|
1317
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1318
|
+
created_by Int?
|
|
1319
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1320
|
+
updated_by Int?
|
|
1321
|
+
is_deleted Boolean? @default(false)
|
|
1322
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1323
|
+
deleted_by Int?
|
|
1324
|
+
event_strategies EventStrategies[]
|
|
1325
|
+
|
|
1326
|
+
@@map("strategies")
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
//---------------------------------- STRATEGIES MODEL END ------------------------------------------------
|
|
1330
|
+
|
|
1331
|
+
/////////////////////////////////// START CMS SCHEMA //////////////////////////////
|
|
1332
|
+
|
|
1333
|
+
enum userTypeEnum {
|
|
1334
|
+
ADMIN
|
|
1335
|
+
VENDOR
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
model Cms {
|
|
1339
|
+
id Int @id @default(autoincrement())
|
|
1340
|
+
uuid String? @unique @default(uuid())
|
|
1341
|
+
title String?
|
|
1342
|
+
content String?
|
|
1343
|
+
type userTypeEnum
|
|
1344
|
+
slug String?
|
|
1345
|
+
images Json? @db.JsonB
|
|
1346
|
+
is_active Boolean @default(false)
|
|
1347
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1348
|
+
created_by Int?
|
|
1349
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
1350
|
+
updated_by Int?
|
|
1351
|
+
is_deleted Boolean @default(false)
|
|
1352
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1353
|
+
deleted_by Int?
|
|
1354
|
+
|
|
1355
|
+
@@unique([slug, type])
|
|
1356
|
+
@@map("cms")
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
/////////////////////////////////// END CMS SCHEMA //////////////////////////////
|
|
1360
|
+
|
|
1361
|
+
//---------------------------------- VENDOR KYC INFO MODEL START ------------------------------------------------
|
|
1362
|
+
|
|
1363
|
+
enum VendorKycStatusEnum {
|
|
1364
|
+
PENDING
|
|
1365
|
+
APPROVED
|
|
1366
|
+
REJECTED
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
model VendorKycInfo {
|
|
1370
|
+
id Int @id @default(autoincrement())
|
|
1371
|
+
uuid String? @unique @default(uuid())
|
|
1372
|
+
vendor_id Int?
|
|
1373
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1374
|
+
section_name String?
|
|
1375
|
+
section_type String?
|
|
1376
|
+
fields Json?
|
|
1377
|
+
status VendorKycStatusEnum @default(PENDING)
|
|
1378
|
+
reject_reason String?
|
|
1379
|
+
is_active Boolean? @default(true)
|
|
1380
|
+
is_deleted Boolean? @default(false)
|
|
1381
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1382
|
+
created_by Int?
|
|
1383
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1384
|
+
updated_by Int?
|
|
1385
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1386
|
+
deleted_by Int?
|
|
1387
|
+
vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
|
|
1388
|
+
|
|
1389
|
+
@@unique([vendor_id, section_type])
|
|
1390
|
+
@@map("vendor_kyc_info")
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
//---------------------------------- VENDOR KYC INFO MODEL END ------------------------------------------------
|
|
1394
|
+
|
|
1395
|
+
//---------------------------------- CURRENCY MODEL START ------------------------------------------------
|
|
1396
|
+
|
|
1397
|
+
model Currency {
|
|
1398
|
+
id Int @id @default(autoincrement())
|
|
1399
|
+
uuid String? @unique @default(uuid())
|
|
1400
|
+
name String? @unique
|
|
1401
|
+
code String? @unique
|
|
1402
|
+
symbol String?
|
|
1403
|
+
is_active Boolean? @default(true)
|
|
1404
|
+
is_deleted Boolean? @default(false)
|
|
1405
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1406
|
+
created_by Int?
|
|
1407
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1408
|
+
updated_by Int?
|
|
1409
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1410
|
+
deleted_by Int?
|
|
1411
|
+
template Template[]
|
|
1412
|
+
|
|
1413
|
+
@@map("currencies")
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
//---------------------------------- CURRENCY MODEL END ------------------------------------------------
|
|
1417
|
+
|
|
1418
|
+
//---------------------------------- SUPPORT TICKETS MODEL START ------------------------------------------------
|
|
1419
|
+
|
|
1420
|
+
enum TicketStatusEnum {
|
|
1421
|
+
OPEN
|
|
1422
|
+
IN_PROGRESS
|
|
1423
|
+
RESOLVED
|
|
1424
|
+
CLOSED
|
|
1425
|
+
REOPEN
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
enum TicketPriorityEnum {
|
|
1429
|
+
LOW
|
|
1430
|
+
MEDIUM
|
|
1431
|
+
HIGH
|
|
1432
|
+
CRITICAL
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
enum TicketContactMethodEnum {
|
|
1436
|
+
EMAIL
|
|
1437
|
+
PHONE
|
|
1438
|
+
CHAT
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
model SupportTicket {
|
|
1442
|
+
id Int @id @default(autoincrement())
|
|
1443
|
+
uuid String? @unique @default(uuid())
|
|
1444
|
+
ticket_code String? @unique
|
|
1445
|
+
vendor_id Int?
|
|
1446
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1447
|
+
subject String?
|
|
1448
|
+
category_id Int?
|
|
1449
|
+
category SupportCategory? @relation(fields: [category_id], references: [id], onDelete: Cascade)
|
|
1450
|
+
priority TicketPriorityEnum @default(MEDIUM)
|
|
1451
|
+
description String?
|
|
1452
|
+
attachments Json?
|
|
1453
|
+
status TicketStatusEnum @default(OPEN)
|
|
1454
|
+
prefered_contact_method TicketContactMethodEnum
|
|
1455
|
+
is_active Boolean? @default(true)
|
|
1456
|
+
is_deleted Boolean? @default(false)
|
|
1457
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1458
|
+
created_by Int?
|
|
1459
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1460
|
+
updated_by Int?
|
|
1461
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1462
|
+
deleted_by Int?
|
|
1463
|
+
assigned_tickets TicketAssignment[]
|
|
1464
|
+
ticket_history TicketHistory[]
|
|
1465
|
+
ticket_replies TicketReply[]
|
|
1466
|
+
|
|
1467
|
+
@@map("support_tickets")
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
model TicketAssignment {
|
|
1471
|
+
id Int @id @default(autoincrement())
|
|
1472
|
+
uuid String? @unique @default(uuid())
|
|
1473
|
+
ticket_id Int?
|
|
1474
|
+
support_ticket SupportTicket? @relation(fields: [ticket_id], references: [id], onDelete: Cascade)
|
|
1475
|
+
assigned_by Int?
|
|
1476
|
+
assigned_by_user User? @relation("user_assigned_by", fields: [assigned_by], references: [id], onDelete: Cascade)
|
|
1477
|
+
assigned_to Int?
|
|
1478
|
+
assigned_to_user User? @relation("user_assigned_to", fields: [assigned_to], references: [id], onDelete: Cascade)
|
|
1479
|
+
assigned_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1480
|
+
|
|
1481
|
+
@@map("ticket_assignments")
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
model TicketHistory {
|
|
1485
|
+
id Int @id @default(autoincrement())
|
|
1486
|
+
uuid String? @unique @default(uuid())
|
|
1487
|
+
ticket_id Int?
|
|
1488
|
+
support_ticket SupportTicket? @relation(fields: [ticket_id], references: [id], onDelete: Cascade)
|
|
1489
|
+
assigned_to Int?
|
|
1490
|
+
assigned_to_user User? @relation("user_assigned_to", fields: [assigned_to], references: [id], onDelete: Cascade)
|
|
1491
|
+
assigned_by Int?
|
|
1492
|
+
assigned_by_user User? @relation("user_assigned_by", fields: [assigned_by], references: [id], onDelete: Cascade)
|
|
1493
|
+
status TicketStatusEnum
|
|
1494
|
+
updated_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1495
|
+
|
|
1496
|
+
@@map("ticket_history")
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
model TicketReply {
|
|
1500
|
+
id Int @id @default(autoincrement())
|
|
1501
|
+
uuid String? @unique @default(uuid())
|
|
1502
|
+
ticket_id Int?
|
|
1503
|
+
support_ticket SupportTicket? @relation(fields: [ticket_id], references: [id], onDelete: Cascade)
|
|
1504
|
+
user_id Int? // User who replied
|
|
1505
|
+
user User? @relation("user_reply", fields: [user_id], references: [id], onDelete: Cascade)
|
|
1506
|
+
vendor_id Int? // Vendor who replied
|
|
1507
|
+
vendor Vendor? @relation("vendor_reply", fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1508
|
+
message String?
|
|
1509
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1510
|
+
|
|
1511
|
+
@@map("ticket_replies")
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
//---------------------------------- SUPPORT TICKETS MODEL END ------------------------------------------------
|
|
1515
|
+
//---------------------------------- SUPPORT CATEGORY MODEL START ------------------------------------------------
|
|
1516
|
+
|
|
1517
|
+
model SupportCategory {
|
|
1518
|
+
id Int @id @default(autoincrement())
|
|
1519
|
+
uuid String? @unique @default(uuid())
|
|
1520
|
+
name String? @unique
|
|
1521
|
+
parent_id Int? @default(0)
|
|
1522
|
+
description String?
|
|
1523
|
+
image_url String?
|
|
1524
|
+
is_active Boolean? @default(false)
|
|
1525
|
+
slug String?
|
|
1526
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1527
|
+
created_by Int?
|
|
1528
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1529
|
+
updated_by Int?
|
|
1530
|
+
is_deleted Boolean? @default(false)
|
|
1531
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1532
|
+
deleted_by Int?
|
|
1533
|
+
tickets SupportTicket[]
|
|
1534
|
+
|
|
1535
|
+
@@map("support_categories")
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
//---------------------------------- SUPPORT CATEGORY MODEL END ------------------------------------------------
|
|
1539
|
+
|
|
1540
|
+
//---------------------------------- VENDOR STATUS MODEL START ------------------------------------------------
|
|
1541
|
+
model VendorStatus {
|
|
1542
|
+
id Int @id @default(autoincrement())
|
|
1543
|
+
vendor_id Int?
|
|
1544
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id])
|
|
1545
|
+
previous_status StatusEnum?
|
|
1546
|
+
current_status StatusEnum?
|
|
1547
|
+
comment String?
|
|
1548
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1549
|
+
updated_by Int?
|
|
1550
|
+
updatedBy User? @relation("vendor_profile_status_updated_by", fields: [updated_by], references: [id])
|
|
1551
|
+
|
|
1552
|
+
@@map("vendor_status")
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
//---------------------------------- VENDOR STATUS MODEL END ------------------------------------------------
|
|
1556
|
+
|
|
1557
|
+
//---------------------------------- VENDOR KYC INFO VERIFICATION STATUS MODEL START --------------------------------------------
|
|
1558
|
+
enum VendorKycVerificationStatusEnum {
|
|
1559
|
+
PENDING
|
|
1560
|
+
APPROVED
|
|
1561
|
+
REJECTED
|
|
1562
|
+
IN_PROGRESS
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
model VendorKycInfoVerificationStatus {
|
|
1566
|
+
id Int @id @default(autoincrement())
|
|
1567
|
+
uuid String? @unique @default(uuid())
|
|
1568
|
+
kyc_id Int?
|
|
1569
|
+
kyc_info VendorKycInfo? @relation(fields: [kyc_id], references: [id], onDelete: Cascade)
|
|
1570
|
+
status VendorKycVerificationStatusEnum @default(PENDING)
|
|
1571
|
+
reject_reason String?
|
|
1572
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1573
|
+
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1574
|
+
raised_by Int?
|
|
1575
|
+
vendor Vendor? @relation(fields: [raised_by], references: [id], onDelete: Cascade)
|
|
1576
|
+
approved_by Int?
|
|
1577
|
+
user User? @relation(fields: [approved_by], references: [id], onDelete: Cascade)
|
|
1578
|
+
|
|
1579
|
+
@@map("vendor_kyc_info_verification_status")
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
//------------------------------------- VENDOR KYC INFO VERIFICATION STATUS MODEL END --------------------------------------------
|
|
1583
|
+
|
|
1584
|
+
//------------------------------------- ADMIN ALERTS MODEL START ------------------------------------------
|
|
1585
|
+
|
|
1586
|
+
enum AlertTypeEnum {
|
|
1587
|
+
PURCHASE_INTAKE
|
|
1588
|
+
PURCHASE_REQUEST
|
|
1589
|
+
PURCHASE_ORDER
|
|
1590
|
+
APPROVAL
|
|
1591
|
+
QUOTATION
|
|
1592
|
+
AUCTION
|
|
1593
|
+
VENDOR_KYC
|
|
1594
|
+
GENERAL
|
|
1595
|
+
CONTRACT
|
|
1596
|
+
CONTRACT_CLAUSE
|
|
1597
|
+
CONTRACT_TEMPLATE
|
|
1598
|
+
UPLOAD
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
model AdminAlert {
|
|
1602
|
+
id Int @id @default(autoincrement())
|
|
1603
|
+
user_id Int?
|
|
1604
|
+
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
1605
|
+
alert_type AlertTypeEnum?
|
|
1606
|
+
title String?
|
|
1607
|
+
message String?
|
|
1608
|
+
redirect_url String?
|
|
1609
|
+
is_read Boolean @default(false)
|
|
1610
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1611
|
+
meta_data Json? @db.JsonB
|
|
1612
|
+
|
|
1613
|
+
@@map("admin_alerts")
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
//------------------------------------- ADMIN ALERTS MODEL END --------------------------------------------
|
|
1617
|
+
|
|
1618
|
+
//------------------------------------- VENDOR ALERTS MODEL START ------------------------------------------
|
|
1619
|
+
|
|
1620
|
+
model VendorAlert {
|
|
1621
|
+
id Int @id @default(autoincrement())
|
|
1622
|
+
vendor_id Int?
|
|
1623
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1624
|
+
alert_type AlertTypeEnum?
|
|
1625
|
+
title String?
|
|
1626
|
+
message String?
|
|
1627
|
+
redirect_url String?
|
|
1628
|
+
is_read Boolean @default(false)
|
|
1629
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1630
|
+
meta_data Json? @db.JsonB
|
|
1631
|
+
|
|
1632
|
+
@@map("vendor_alerts")
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
//------------------------------------- VENDOR ALERTS MODEL END --------------------------------------------
|
|
1636
|
+
|
|
1637
|
+
//-------------------------------------CUSTOMER NOTIFICATION MODEL START --------------------------------------------
|
|
1638
|
+
|
|
1639
|
+
enum MediumEnum {
|
|
1640
|
+
EMAIL
|
|
1641
|
+
SMS
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
model CustomerNotification {
|
|
1645
|
+
id Int @id @default(autoincrement())
|
|
1646
|
+
uuid String? @unique @default(uuid())
|
|
1647
|
+
template_name String? @db.VarChar(255)
|
|
1648
|
+
remark String?
|
|
1649
|
+
event String? @db.VarChar(255)
|
|
1650
|
+
medium MediumEnum?
|
|
1651
|
+
is_recurring Boolean @default(false)
|
|
1652
|
+
title String?
|
|
1653
|
+
trigger_message String?
|
|
1654
|
+
template_slug String?
|
|
1655
|
+
attachments String[] @default([])
|
|
1656
|
+
files Json[] @db.JsonB
|
|
1657
|
+
is_active Boolean @default(false)
|
|
1658
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1659
|
+
created_by Int?
|
|
1660
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
1661
|
+
updated_by Int?
|
|
1662
|
+
is_deleted Boolean @default(false)
|
|
1663
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1664
|
+
deleted_by Int?
|
|
1665
|
+
|
|
1666
|
+
@@map("customer_notifications")
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
//-------------------------------------CUSTOMER NOTIFICATION MODEL End --------------------------------------------
|
|
1670
|
+
|
|
1671
|
+
//-------------------------------------BID MODEL START --------------------------------------------
|
|
1672
|
+
|
|
1673
|
+
// Bid Status
|
|
1674
|
+
enum BidStatus {
|
|
1675
|
+
NOT_HIGHEST_BIDDER
|
|
1676
|
+
HIGHEST_BIDDER
|
|
1677
|
+
CANCELLED
|
|
1678
|
+
REJECTED
|
|
1679
|
+
ACCEPTED
|
|
1680
|
+
LAST_REJECTED
|
|
1681
|
+
COMPLETE_REJECTED
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
model Bid {
|
|
1685
|
+
id Int @id @default(autoincrement())
|
|
1686
|
+
uuid String? @unique @default(uuid())
|
|
1687
|
+
event_id Int?
|
|
1688
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade)
|
|
1689
|
+
event_item_id Int?
|
|
1690
|
+
event_item EventItems? @relation(fields: [event_item_id], references: [id], onDelete: Cascade)
|
|
1691
|
+
event_type EventType?
|
|
1692
|
+
event_vendor_id Int?
|
|
1693
|
+
event_vendor EventVendors? @relation(fields: [event_vendor_id], references: [id], onDelete: Cascade)
|
|
1694
|
+
bid_log_id Int? // Reference to BidLog for detailed bid history
|
|
1695
|
+
bid_log BidLog? @relation(fields: [bid_log_id], references: [id], onDelete: Cascade)
|
|
1696
|
+
bid_amount Float?
|
|
1697
|
+
version Int @default(0) // For optimistic locking
|
|
1698
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1699
|
+
created_by Int?
|
|
1700
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
1701
|
+
updated_by Int?
|
|
1702
|
+
is_deleted Boolean @default(false)
|
|
1703
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1704
|
+
deleted_by Int?
|
|
1705
|
+
|
|
1706
|
+
@@index([event_id, event_item_id])
|
|
1707
|
+
@@map("bids")
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
//-------------------------------------BID MODEL END --------------------------------------------
|
|
1711
|
+
|
|
1712
|
+
//-------------------------------------BID LOG MODEL START --------------------------------------------
|
|
1713
|
+
|
|
1714
|
+
model BidLog {
|
|
1715
|
+
id Int @id @default(autoincrement())
|
|
1716
|
+
uuid String? @unique @default(uuid())
|
|
1717
|
+
event_id Int?
|
|
1718
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade)
|
|
1719
|
+
event_item_id Int?
|
|
1720
|
+
event_item EventItems? @relation(fields: [event_item_id], references: [id], onDelete: Cascade)
|
|
1721
|
+
event_type EventType?
|
|
1722
|
+
event_vendor_id Int?
|
|
1723
|
+
event_vendor EventVendors? @relation(fields: [event_vendor_id], references: [id], onDelete: Cascade)
|
|
1724
|
+
bid_amount Float?
|
|
1725
|
+
bid_status BidStatus @default(NOT_HIGHEST_BIDDER)
|
|
1726
|
+
bidding_rank Int?
|
|
1727
|
+
is_cancelled Boolean @default(false)
|
|
1728
|
+
auto_cancel Boolean @default(false)
|
|
1729
|
+
cancel_reason String?
|
|
1730
|
+
is_winner Boolean @default(false)
|
|
1731
|
+
is_auto_bid Boolean @default(false)
|
|
1732
|
+
is_placed_by_admin Boolean @default(false)
|
|
1733
|
+
placed_by_id Int?
|
|
1734
|
+
reason String?
|
|
1735
|
+
bid_json Json? // Flexible structure for bid details
|
|
1736
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1737
|
+
created_by Int?
|
|
1738
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
1739
|
+
updated_by Int?
|
|
1740
|
+
is_deleted Boolean @default(false)
|
|
1741
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1742
|
+
deleted_by Int?
|
|
1743
|
+
has_active_counter Boolean @default(false)
|
|
1744
|
+
counter_offer CounterOffer[]
|
|
1745
|
+
bid Bid[]
|
|
1746
|
+
|
|
1747
|
+
@@index([event_id, event_item_id, created_at])
|
|
1748
|
+
@@map("bid_logs")
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
//------------------------------------- BID LOG MODEL END --------------------------------------------
|
|
1752
|
+
//------------------------------------- QUOTATION MODEL END --------------------------------------------
|
|
1753
|
+
|
|
1754
|
+
// Quotation Status
|
|
1755
|
+
enum QuotationStatus {
|
|
1756
|
+
SUBMITTED
|
|
1757
|
+
UNDER_REVIEW
|
|
1758
|
+
ACCEPTED
|
|
1759
|
+
REJECTED
|
|
1760
|
+
REVISED
|
|
1761
|
+
LAST_REJECTED
|
|
1762
|
+
COMPLETE_REJECTED
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
model Quotation {
|
|
1766
|
+
id Int @id @default(autoincrement())
|
|
1767
|
+
uuid String @unique @default(uuid())
|
|
1768
|
+
event_id Int?
|
|
1769
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade)
|
|
1770
|
+
event_item_id Int?
|
|
1771
|
+
event_item EventItems? @relation(fields: [event_item_id], references: [id], onDelete: Cascade)
|
|
1772
|
+
event_type EventType? // Should be RFQ, RFI, or RFP
|
|
1773
|
+
event_vendor_id Int?
|
|
1774
|
+
event_vendor EventVendors? @relation(fields: [event_vendor_id], references: [id], onDelete: Cascade)
|
|
1775
|
+
quotation_log_id Int? // Reference to QuotationLog for detailed history
|
|
1776
|
+
quotation_log QuotationLog? @relation(fields: [quotation_log_id], references: [id], onDelete: Cascade)
|
|
1777
|
+
quote_amount Float?
|
|
1778
|
+
technical_details Json? // Flexible structure for specifications
|
|
1779
|
+
delivery_timeline String?
|
|
1780
|
+
warranty_terms String?
|
|
1781
|
+
payment_terms String?
|
|
1782
|
+
validity_period Int? // Days the quotation remains valid
|
|
1783
|
+
quotation_status QuotationStatus @default(SUBMITTED)
|
|
1784
|
+
quotation_rank Int?
|
|
1785
|
+
current_revision Int @default(1)
|
|
1786
|
+
version Int @default(0) // For optimistic locking
|
|
1787
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1788
|
+
created_by Int?
|
|
1789
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
1790
|
+
updated_by Int?
|
|
1791
|
+
is_deleted Boolean @default(false)
|
|
1792
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1793
|
+
deleted_by Int?
|
|
1794
|
+
|
|
1795
|
+
@@index([event_id, event_item_id])
|
|
1796
|
+
@@map("quotations")
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
//------------------------------------- QUOTATION MODEL END --------------------------------------------
|
|
1800
|
+
//------------------------------------- QUOTATION LOG MODEL END --------------------------------------------
|
|
1801
|
+
model QuotationLog {
|
|
1802
|
+
id Int @id @default(autoincrement())
|
|
1803
|
+
uuid String @unique @default(uuid())
|
|
1804
|
+
event_id Int?
|
|
1805
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade)
|
|
1806
|
+
event_item_id Int?
|
|
1807
|
+
event_item EventItems? @relation(fields: [event_item_id], references: [id], onDelete: Cascade)
|
|
1808
|
+
event_type EventType?
|
|
1809
|
+
event_vendor_id Int?
|
|
1810
|
+
event_vendor EventVendors? @relation(fields: [event_vendor_id], references: [id], onDelete: Cascade)
|
|
1811
|
+
quote_amount Float?
|
|
1812
|
+
technical_details Json?
|
|
1813
|
+
delivery_timeline String?
|
|
1814
|
+
warranty_terms String?
|
|
1815
|
+
payment_terms String?
|
|
1816
|
+
quotation_status QuotationStatus @default(SUBMITTED)
|
|
1817
|
+
quotation_rank Int?
|
|
1818
|
+
revision_number Int @default(1)
|
|
1819
|
+
review_comments String? // Admin feedback
|
|
1820
|
+
reviewed_by Int?
|
|
1821
|
+
quote_json Json? // Flexible structure for quotation details
|
|
1822
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1823
|
+
created_by Int?
|
|
1824
|
+
updated_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1825
|
+
updated_by Int?
|
|
1826
|
+
has_active_counter Boolean @default(false)
|
|
1827
|
+
counter_offer CounterOffer[]
|
|
1828
|
+
quotation Quotation[]
|
|
1829
|
+
|
|
1830
|
+
@@index([event_id, event_item_id])
|
|
1831
|
+
@@map("quotation_logs")
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
//------------------------------------- QUOTATION LOG MODEL END --------------------------------------------
|
|
1835
|
+
|
|
1836
|
+
//------------------------------------ Form Master Models Start ------------------------------------
|
|
1837
|
+
model FormMaster {
|
|
1838
|
+
id Int @id @default(autoincrement())
|
|
1839
|
+
uuid String? @unique @default(uuid())
|
|
1840
|
+
module_name String?
|
|
1841
|
+
module_slug String? @unique
|
|
1842
|
+
is_active Boolean? @default(true)
|
|
1843
|
+
is_deleted Boolean? @default(false)
|
|
1844
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1845
|
+
created_by Int?
|
|
1846
|
+
user User? @relation(fields: [created_by], references: [id], onDelete: Cascade)
|
|
1847
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1848
|
+
updated_by Int?
|
|
1849
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1850
|
+
deleted_by Int?
|
|
1851
|
+
dynamic_form DynamicForm[]
|
|
1852
|
+
|
|
1853
|
+
@@map("form_masters")
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
//------------------------------------ Form Master Models End ------------------------------------
|
|
1857
|
+
|
|
1858
|
+
//------------------------------------ Dynamic Form Models Start ------------------------------------
|
|
1859
|
+
model DynamicForm {
|
|
1860
|
+
id Int @id @default(autoincrement())
|
|
1861
|
+
uuid String? @unique @default(uuid())
|
|
1862
|
+
module_id Int?
|
|
1863
|
+
module FormMaster? @relation(fields: [module_id], references: [id], onDelete: Cascade)
|
|
1864
|
+
form_name String?
|
|
1865
|
+
form_slug String?
|
|
1866
|
+
fields Json?
|
|
1867
|
+
form_order Int?
|
|
1868
|
+
is_active Boolean? @default(true)
|
|
1869
|
+
is_deleted Boolean? @default(false)
|
|
1870
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1871
|
+
created_by Int?
|
|
1872
|
+
user User? @relation(fields: [created_by], references: [id], onDelete: Cascade)
|
|
1873
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1874
|
+
updated_by Int?
|
|
1875
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1876
|
+
deleted_by Int?
|
|
1877
|
+
|
|
1878
|
+
@@unique([module_id, form_slug])
|
|
1879
|
+
@@map("dynamic_forms")
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
//------------------------------------ Form Builder Models End ------------------------------------
|
|
1883
|
+
|
|
1884
|
+
//------------------------------------ Modules Model Start ----------------------------
|
|
1885
|
+
|
|
1886
|
+
model Module {
|
|
1887
|
+
id Int @id @default(autoincrement()) // Primary Key
|
|
1888
|
+
uuid String? @unique @default(uuid())
|
|
1889
|
+
tenant_config_id Int?
|
|
1890
|
+
tenant_config TenantConfiguration? @relation(fields: [tenant_config_id], references: [id])
|
|
1891
|
+
name String?
|
|
1892
|
+
slug String? @unique
|
|
1893
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1894
|
+
created_by Int? // Optional field if no constraints are specified
|
|
1895
|
+
sub_modules SubModule[]
|
|
1896
|
+
|
|
1897
|
+
@@map("modules")
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
//------------------------------------ Modules Model End ----------------------------
|
|
1901
|
+
|
|
1902
|
+
//------------------------------------ Tenant Configuration Model Start ----------------------------
|
|
1903
|
+
|
|
1904
|
+
model TenantConfiguration {
|
|
1905
|
+
id Int @id @default(autoincrement())
|
|
1906
|
+
uuid String? @unique @default(uuid())
|
|
1907
|
+
tenant_id Int?
|
|
1908
|
+
tenant_name String?
|
|
1909
|
+
database_name String?
|
|
1910
|
+
tenant_subdomain String?
|
|
1911
|
+
currency String?
|
|
1912
|
+
timezone String?
|
|
1913
|
+
status String?
|
|
1914
|
+
email String?
|
|
1915
|
+
logo String?
|
|
1916
|
+
allowed_modules Module[]
|
|
1917
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1918
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1919
|
+
|
|
1920
|
+
@@map("tenant_configurations")
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
//------------------------------------ Tenant Configuration Model End ------------------------------
|
|
1924
|
+
|
|
1925
|
+
//------------------------------------- USER LOGIN ACTIVITY MODEL START --------------------------------------------
|
|
1926
|
+
|
|
1927
|
+
enum LoginActivityUserType {
|
|
1928
|
+
ADMIN
|
|
1929
|
+
VENDOR
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
model UserLoginActivity {
|
|
1933
|
+
id Int @id @default(autoincrement())
|
|
1934
|
+
user_id Int?
|
|
1935
|
+
user_type LoginActivityUserType?
|
|
1936
|
+
ip_address String?
|
|
1937
|
+
user_agent String?
|
|
1938
|
+
browser String?
|
|
1939
|
+
device String?
|
|
1940
|
+
platform String?
|
|
1941
|
+
login_timestamp DateTime @default(now()) @db.Timestamptz(6)
|
|
1942
|
+
logout_timestamp DateTime? @db.Timestamptz(6)
|
|
1943
|
+
status String?
|
|
1944
|
+
session_id String?
|
|
1945
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1946
|
+
|
|
1947
|
+
@@map("user_login_activities")
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
//------------------------------------- USER LOGIN ACTIVITY MODEL END --------------------------------------------
|
|
1951
|
+
//------------------------------------- REGION MODEL START --------------------------------------------
|
|
1952
|
+
|
|
1953
|
+
model Region {
|
|
1954
|
+
id Int @id @default(autoincrement())
|
|
1955
|
+
name String? @unique
|
|
1956
|
+
translations Json?
|
|
1957
|
+
wikiDataId String?
|
|
1958
|
+
status Boolean? @default(false)
|
|
1959
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1960
|
+
created_by Int?
|
|
1961
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
1962
|
+
updated_by Int?
|
|
1963
|
+
is_deleted Boolean? @default(false)
|
|
1964
|
+
deleted_by Int?
|
|
1965
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1966
|
+
countries Country[]
|
|
1967
|
+
subregions Subregion[]
|
|
1968
|
+
|
|
1969
|
+
@@map("regions")
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
//------------------------------------- REGION MODEL END --------------------------------------------
|
|
1973
|
+
//------------------------------------- SUB REGION MODEL START --------------------------------------------
|
|
1974
|
+
|
|
1975
|
+
model Subregion {
|
|
1976
|
+
id Int @id @default(autoincrement())
|
|
1977
|
+
name String? @unique
|
|
1978
|
+
translations Json?
|
|
1979
|
+
wikiDataId String?
|
|
1980
|
+
status Boolean? @default(false)
|
|
1981
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1982
|
+
created_by Int?
|
|
1983
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
1984
|
+
updated_by Int?
|
|
1985
|
+
is_deleted Boolean? @default(false)
|
|
1986
|
+
deleted_by Int?
|
|
1987
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
1988
|
+
region Region? @relation(fields: [region_id], references: [id])
|
|
1989
|
+
region_id Int?
|
|
1990
|
+
countries Country[]
|
|
1991
|
+
|
|
1992
|
+
@@index([region_id])
|
|
1993
|
+
@@map("subregions")
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
//------------------------------------- SUB REGION MODEL END --------------------------------------------
|
|
1997
|
+
//------------------------------------- COUNTRY MODEL START --------------------------------------------
|
|
1998
|
+
|
|
1999
|
+
model Country {
|
|
2000
|
+
id Int @id @default(autoincrement())
|
|
2001
|
+
name String?
|
|
2002
|
+
iso3 String? @unique @db.Char(3)
|
|
2003
|
+
iso2 String? @unique @db.Char(2)
|
|
2004
|
+
numeric_code String? @db.Char(3)
|
|
2005
|
+
phonecode String?
|
|
2006
|
+
capital String?
|
|
2007
|
+
currency String?
|
|
2008
|
+
currency_name String?
|
|
2009
|
+
currency_symbol String?
|
|
2010
|
+
tld String?
|
|
2011
|
+
native String?
|
|
2012
|
+
region String?
|
|
2013
|
+
subregion String?
|
|
2014
|
+
nationality String?
|
|
2015
|
+
latitude Decimal? @db.Decimal(10, 8)
|
|
2016
|
+
longitude Decimal? @db.Decimal(11, 8)
|
|
2017
|
+
emoji String?
|
|
2018
|
+
emojiU String?
|
|
2019
|
+
timezones Json?
|
|
2020
|
+
translations Json?
|
|
2021
|
+
wikiDataId String?
|
|
2022
|
+
status Boolean? @default(false)
|
|
2023
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2024
|
+
created_by Int?
|
|
2025
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2026
|
+
updated_by Int?
|
|
2027
|
+
is_deleted Boolean? @default(false)
|
|
2028
|
+
deleted_by Int?
|
|
2029
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2030
|
+
region_relation Region? @relation(fields: [region_id], references: [id])
|
|
2031
|
+
region_id Int?
|
|
2032
|
+
subregion_relation Subregion? @relation(fields: [subregion_id], references: [id])
|
|
2033
|
+
subregion_id Int?
|
|
2034
|
+
|
|
2035
|
+
states State[]
|
|
2036
|
+
cities City[]
|
|
2037
|
+
locations Location[]
|
|
2038
|
+
|
|
2039
|
+
@@index([region_id])
|
|
2040
|
+
@@index([subregion_id])
|
|
2041
|
+
@@map("countries")
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
//------------------------------------- COUNTRY MODEL END --------------------------------------------
|
|
2045
|
+
//------------------------------------- STATE MODEL START --------------------------------------------
|
|
2046
|
+
|
|
2047
|
+
model State {
|
|
2048
|
+
id Int @id @default(autoincrement())
|
|
2049
|
+
name String?
|
|
2050
|
+
state_code String?
|
|
2051
|
+
type String?
|
|
2052
|
+
latitude Decimal? @db.Decimal(10, 8)
|
|
2053
|
+
longitude Decimal? @db.Decimal(11, 8)
|
|
2054
|
+
wikiDataId String?
|
|
2055
|
+
status Boolean? @default(false)
|
|
2056
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2057
|
+
created_by Int?
|
|
2058
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2059
|
+
updated_by Int?
|
|
2060
|
+
is_deleted Boolean? @default(false)
|
|
2061
|
+
deleted_by Int?
|
|
2062
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2063
|
+
country Country? @relation(fields: [country_id], references: [id])
|
|
2064
|
+
country_id Int?
|
|
2065
|
+
cities City[]
|
|
2066
|
+
locations Location[]
|
|
2067
|
+
|
|
2068
|
+
@@unique([name, country_id, state_code], name: "name_country_id_state_code")
|
|
2069
|
+
@@index([country_id])
|
|
2070
|
+
@@map("states")
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
//------------------------------------- STATE MODEL END --------------------------------------------
|
|
2074
|
+
//------------------------------------- CITY MODEL START --------------------------------------------
|
|
2075
|
+
|
|
2076
|
+
model City {
|
|
2077
|
+
id Int @id @default(autoincrement())
|
|
2078
|
+
name String?
|
|
2079
|
+
latitude Decimal? @db.Decimal(10, 8)
|
|
2080
|
+
longitude Decimal? @db.Decimal(11, 8)
|
|
2081
|
+
wikiDataId String?
|
|
2082
|
+
status Boolean? @default(false)
|
|
2083
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2084
|
+
created_by Int?
|
|
2085
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2086
|
+
updated_by Int?
|
|
2087
|
+
is_deleted Boolean? @default(false)
|
|
2088
|
+
deleted_by Int?
|
|
2089
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2090
|
+
state State? @relation(fields: [state_id], references: [id])
|
|
2091
|
+
state_id Int?
|
|
2092
|
+
country Country? @relation(fields: [country_id], references: [id])
|
|
2093
|
+
country_id Int?
|
|
2094
|
+
locations Location[]
|
|
2095
|
+
|
|
2096
|
+
@@unique([name, country_id, state_id], name: "name_country_id_state_id")
|
|
2097
|
+
@@index([state_id])
|
|
2098
|
+
@@index([country_id])
|
|
2099
|
+
@@map("cities")
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
//------------------------------------- CITY MODEL END --------------------------------------------
|
|
2103
|
+
//------------------------------------- LOCATION MODEL START --------------------------------------------
|
|
2104
|
+
|
|
2105
|
+
model Location {
|
|
2106
|
+
id Int @id @default(autoincrement())
|
|
2107
|
+
name String?
|
|
2108
|
+
address String?
|
|
2109
|
+
zipcode String?
|
|
2110
|
+
status Boolean? @default(false)
|
|
2111
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2112
|
+
created_by Int?
|
|
2113
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2114
|
+
updated_by Int?
|
|
2115
|
+
is_deleted Boolean? @default(false)
|
|
2116
|
+
deleted_by Int?
|
|
2117
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2118
|
+
country Country? @relation(fields: [country_id], references: [id])
|
|
2119
|
+
country_id Int?
|
|
2120
|
+
state State? @relation(fields: [state_id], references: [id])
|
|
2121
|
+
state_id Int?
|
|
2122
|
+
city City? @relation(fields: [city_id], references: [id])
|
|
2123
|
+
city_id Int?
|
|
2124
|
+
purchase_intake_item PurchaseIntakeItem[]
|
|
2125
|
+
|
|
2126
|
+
@@unique([name, country_id, state_id, city_id], name: "name_country_id_state_id_city_id")
|
|
2127
|
+
@@index([country_id])
|
|
2128
|
+
@@index([state_id])
|
|
2129
|
+
@@index([city_id])
|
|
2130
|
+
@@map("locations")
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
//------------------------------------- LOCATION MODEL END --------------------------------------------
|
|
2134
|
+
|
|
2135
|
+
//------------------------------------ Sub Module Model Start ----------------------------
|
|
2136
|
+
model SubModule {
|
|
2137
|
+
id Int @id @default(autoincrement())
|
|
2138
|
+
name String
|
|
2139
|
+
slug String @unique
|
|
2140
|
+
module_id Int?
|
|
2141
|
+
created_by Int?
|
|
2142
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2143
|
+
module Module? @relation(fields: [module_id], references: [id], onDelete: Cascade)
|
|
2144
|
+
|
|
2145
|
+
@@map("sub_modules")
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
//------------------------------------ Sub Module Model END ----------------------------
|
|
2149
|
+
|
|
2150
|
+
//------------------------------------ COUNTER OFFER MODEL START ------------------------------------
|
|
2151
|
+
|
|
2152
|
+
enum CounterOfferStatus {
|
|
2153
|
+
PENDING
|
|
2154
|
+
ACCEPTED
|
|
2155
|
+
REJECTED
|
|
2156
|
+
COUNTERED
|
|
2157
|
+
AUTO_REJECTED
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
model CounterOffer {
|
|
2161
|
+
id Int @id @default(autoincrement())
|
|
2162
|
+
uuid String @unique @default(uuid())
|
|
2163
|
+
bid_log_id Int?
|
|
2164
|
+
bid_log BidLog? @relation(fields: [bid_log_id], references: [id])
|
|
2165
|
+
quotation_log_id Int?
|
|
2166
|
+
quotation_log QuotationLog? @relation(fields: [quotation_log_id], references: [id])
|
|
2167
|
+
counter_amount Float
|
|
2168
|
+
counter_message String?
|
|
2169
|
+
technical_details Json? // For quotations - specific changes requested
|
|
2170
|
+
delivery_timeline String? // For quotations
|
|
2171
|
+
payment_terms String? // For quotations
|
|
2172
|
+
warranty_terms String? // For quotations
|
|
2173
|
+
is_viewed Boolean @default(false)
|
|
2174
|
+
status CounterOfferStatus? @default(PENDING)
|
|
2175
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2176
|
+
created_by Int // Admin/buyer who created the counter offer
|
|
2177
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2178
|
+
updated_by Int?
|
|
2179
|
+
is_deleted Boolean @default(false)
|
|
2180
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2181
|
+
deleted_by Int?
|
|
2182
|
+
|
|
2183
|
+
@@index([bid_log_id])
|
|
2184
|
+
@@index([quotation_log_id])
|
|
2185
|
+
@@map("counter_offers")
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
//------------------------------------ COUNTER OFFER MODEL END ------------------------------------
|
|
2189
|
+
|
|
2190
|
+
//------------------------------------ PURCHASE ORDER MODEL START ------------------------------------
|
|
2191
|
+
|
|
2192
|
+
enum PurchaseOrderStatus {
|
|
2193
|
+
PENDING
|
|
2194
|
+
REQUESTED
|
|
2195
|
+
REJECTED
|
|
2196
|
+
COMPLETED
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
model PurchaseOrder {
|
|
2200
|
+
id Int @id @default(autoincrement())
|
|
2201
|
+
uuid String @unique @default(uuid())
|
|
2202
|
+
event_id Int?
|
|
2203
|
+
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade)
|
|
2204
|
+
event_vendor_id Int?
|
|
2205
|
+
event_vendor EventVendors? @relation(fields: [event_vendor_id], references: [id], onDelete: Cascade)
|
|
2206
|
+
purchase_order_no String? @unique
|
|
2207
|
+
purchase_order_date DateTime? @default(now()) @db.Timestamptz(6)
|
|
2208
|
+
total_amount Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
2209
|
+
status PurchaseOrderStatus? @default(PENDING)
|
|
2210
|
+
attachments Json?
|
|
2211
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2212
|
+
created_by Int?
|
|
2213
|
+
user User? @relation(fields: [created_by], references: [id], onDelete: Cascade)
|
|
2214
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2215
|
+
updated_by Int?
|
|
2216
|
+
is_deleted Boolean @default(false)
|
|
2217
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2218
|
+
deleted_by Int?
|
|
2219
|
+
purchase_order_activity_log PurchaseOrderActivityLog[]
|
|
2220
|
+
purchase_order_items PurchaseOrderItem[]
|
|
2221
|
+
|
|
2222
|
+
@@index([event_id])
|
|
2223
|
+
@@index([event_vendor_id])
|
|
2224
|
+
@@index([status])
|
|
2225
|
+
@@map("purchase_orders")
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
//------------------------------------ PURCHASE ORDER MODEL END --------------------------------------
|
|
2229
|
+
|
|
2230
|
+
//------------------------------------ PURCHASE ORDER ITEMS MODEL START ------------------------------------
|
|
2231
|
+
|
|
2232
|
+
model PurchaseOrderItem {
|
|
2233
|
+
id Int @id @default(autoincrement())
|
|
2234
|
+
uuid String @unique @default(uuid())
|
|
2235
|
+
purchase_order_id Int?
|
|
2236
|
+
purchase_order PurchaseOrder? @relation(fields: [purchase_order_id], references: [id], onDelete: Cascade)
|
|
2237
|
+
purchase_request_id Int?
|
|
2238
|
+
purchase_request PurchaseIntake? @relation(fields: [purchase_request_id], references: [id], onDelete: Cascade)
|
|
2239
|
+
item_id Int?
|
|
2240
|
+
item Item? @relation(fields: [item_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2241
|
+
amount Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
2242
|
+
quantity Int?
|
|
2243
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2244
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2245
|
+
is_deleted Boolean @default(false)
|
|
2246
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2247
|
+
|
|
2248
|
+
@@unique([purchase_order_id, item_id], name: "unique_purchase_order_item")
|
|
2249
|
+
@@index([purchase_order_id])
|
|
2250
|
+
@@index([purchase_request_id])
|
|
2251
|
+
@@index([item_id])
|
|
2252
|
+
@@map("purchase_order_items")
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
//------------------------------------ PURCHASE ORDER ITEMS MODEL END --------------------------------------
|
|
2256
|
+
|
|
2257
|
+
//------------------------------------ PURCHASE ORDER ACTIVITY MODEL START --------------------------------------
|
|
2258
|
+
|
|
2259
|
+
enum POActivityType {
|
|
2260
|
+
CREATED
|
|
2261
|
+
REQUESTED
|
|
2262
|
+
UPLOADED
|
|
2263
|
+
SENT_TO_VENDOR
|
|
2264
|
+
COMPLETED
|
|
2265
|
+
CANCELLED
|
|
2266
|
+
OTHER
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
model PurchaseOrderActivityLog {
|
|
2270
|
+
id Int @id @default(autoincrement())
|
|
2271
|
+
uuid String @unique @default(uuid())
|
|
2272
|
+
purchase_order_id Int?
|
|
2273
|
+
purchase_order PurchaseOrder? @relation(fields: [purchase_order_id], references: [id], onDelete: Cascade)
|
|
2274
|
+
user_id Int? // Could be buyer or vendor
|
|
2275
|
+
user User? @relation(fields: [user_id], references: [id], onDelete: SetNull)
|
|
2276
|
+
vendor_id Int?
|
|
2277
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: SetNull)
|
|
2278
|
+
activity_type POActivityType? @default(CREATED)
|
|
2279
|
+
remarks String? // Optional free text for custom remarks
|
|
2280
|
+
metadata Json? // Any additional details (file info, etc.)
|
|
2281
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2282
|
+
|
|
2283
|
+
@@index([purchase_order_id])
|
|
2284
|
+
@@index([user_id])
|
|
2285
|
+
@@index([vendor_id])
|
|
2286
|
+
@@map("purchase_order_activity_logs")
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
//------------------------------------ PURCHASE ORDER ACTIVITY MODEL END --------------------------------------
|
|
2290
|
+
|
|
2291
|
+
//------------------------------------- USER VENDOR SOCKET TOKENS MODEL START --------------------------------------------
|
|
2292
|
+
|
|
2293
|
+
model UserVendorSocketTokens {
|
|
2294
|
+
id Int @id @default(autoincrement())
|
|
2295
|
+
user_id Int?
|
|
2296
|
+
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
2297
|
+
vendor_id Int?
|
|
2298
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
2299
|
+
socket_id String?
|
|
2300
|
+
status Boolean? @default(true)
|
|
2301
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2302
|
+
|
|
2303
|
+
@@map("user_vendor_socket_tokens")
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
//------------------------------------- USER VENDOR SOCKET TOKENS MODEL END --------------------------------------------
|
|
2307
|
+
|
|
2308
|
+
//------------------------------------- EVENT ACTIVITY LOG MODEL START --------------------------------------------
|
|
2309
|
+
|
|
2310
|
+
model ActivityLog {
|
|
2311
|
+
id Int @id @default(autoincrement())
|
|
2312
|
+
uuid String? @unique @default(uuid())
|
|
2313
|
+
user_id Int?
|
|
2314
|
+
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
2315
|
+
vendor_id Int?
|
|
2316
|
+
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
2317
|
+
module_name String? // e.g., "PurchaseIntake", "VendorManagement"
|
|
2318
|
+
module_id Int? // ID of the module instance (e.g., PurchaseIntake ID)
|
|
2319
|
+
activity_type String? // e.g., "created", "updated", "deleted"
|
|
2320
|
+
description String?
|
|
2321
|
+
metadata Json? // Additional details about the activity
|
|
2322
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2323
|
+
|
|
2324
|
+
@@index([user_id])
|
|
2325
|
+
@@index([vendor_id])
|
|
2326
|
+
@@map("activity_logs")
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
//------------------------------------- EVENT ACTIVITY LOG MODEL END --------------------------------------------
|
|
2330
|
+
|
|
2331
|
+
//------------------------------------- CONTATC US MODEL END --------------------------------------------
|
|
2332
|
+
|
|
2333
|
+
model ContactUs {
|
|
2334
|
+
id Int @id @default(autoincrement())
|
|
2335
|
+
uuid String? @unique @default(uuid())
|
|
2336
|
+
full_name String?
|
|
2337
|
+
email String?
|
|
2338
|
+
mobile_code String?
|
|
2339
|
+
mobile String?
|
|
2340
|
+
description String?
|
|
2341
|
+
user_id Int?
|
|
2342
|
+
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
2343
|
+
is_reply Boolean? @default(false)
|
|
2344
|
+
reply_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2345
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2346
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2347
|
+
|
|
2348
|
+
@@map("contact_us")
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
//------------------------------------- CONTACT US MODEL END --------------------------------------------
|
|
2352
|
+
|
|
2353
|
+
//------------------------------------- UPLOAD MODEL START --------------------------------------------
|
|
2354
|
+
|
|
2355
|
+
enum UploadStatus {
|
|
2356
|
+
PENDING
|
|
2357
|
+
PROCESSING
|
|
2358
|
+
COMPLETED
|
|
2359
|
+
FAILED
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
enum UploadModuleEnum {
|
|
2363
|
+
ITEM_LIBRARY
|
|
2364
|
+
CATEGORY_MASTER
|
|
2365
|
+
SUB_CATEGORY_MASTER
|
|
2366
|
+
UOM_MASTER
|
|
2367
|
+
ATTRIBUTE_MASTER
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
model UploadLog {
|
|
2371
|
+
id Int @id @default(autoincrement())
|
|
2372
|
+
uuid String? @unique @default(uuid())
|
|
2373
|
+
user_id Int
|
|
2374
|
+
user User @relation(fields: [user_id], references: [id])
|
|
2375
|
+
module UploadModuleEnum?
|
|
2376
|
+
file_name String?
|
|
2377
|
+
file_size Int?
|
|
2378
|
+
status UploadStatus @default(PENDING)
|
|
2379
|
+
total_records Int?
|
|
2380
|
+
success_count Int?
|
|
2381
|
+
failure_count Int?
|
|
2382
|
+
error_file_path String?
|
|
2383
|
+
started_at DateTime @default(now())
|
|
2384
|
+
completed_at DateTime?
|
|
2385
|
+
errors Json?
|
|
2386
|
+
|
|
2387
|
+
@@map("upload_logs")
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
//------------------------------------- UPLOAD MODEL END --------------------------------------------
|
|
2391
|
+
|
|
2392
|
+
//------------------------------------- CHAT THREAD MODEL START --------------------------------------------
|
|
2393
|
+
model ChatThread {
|
|
2394
|
+
id String @id @default(cuid())
|
|
2395
|
+
title String? // Auto-generated or user-defined title
|
|
2396
|
+
userId Int?
|
|
2397
|
+
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
2398
|
+
createdAt DateTime @default(now())
|
|
2399
|
+
updatedAt DateTime @updatedAt
|
|
2400
|
+
isArchived Boolean @default(false)
|
|
2401
|
+
metadata Json? // Store additional context, settings, etc.
|
|
2402
|
+
messages ChatMessage[]
|
|
2403
|
+
|
|
2404
|
+
@@index([userId, createdAt])
|
|
2405
|
+
@@map("chat_threads")
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
//------------------------------------- CHAT THREAD MODEL END --------------------------------------------
|
|
2409
|
+
|
|
2410
|
+
//------------------------------------- CHAT MESSAGE MODEL START --------------------------------------------
|
|
2411
|
+
enum MessageRole {
|
|
2412
|
+
USER
|
|
2413
|
+
ASSISTANT
|
|
2414
|
+
SYSTEM
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
model ChatMessage {
|
|
2418
|
+
id String @id @default(cuid())
|
|
2419
|
+
threadId String?
|
|
2420
|
+
role MessageRole?
|
|
2421
|
+
content String?
|
|
2422
|
+
createdAt DateTime? @default(now())
|
|
2423
|
+
metadata Json? // Store token count, model used, etc.
|
|
2424
|
+
attachments Json? // Store file references, images, etc.
|
|
2425
|
+
thread ChatThread? @relation(fields: [threadId], references: [id], onDelete: Cascade)
|
|
2426
|
+
|
|
2427
|
+
@@index([threadId, createdAt])
|
|
2428
|
+
@@map("chat_messages")
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
//------------------------------------- CHAT MESSAGE MODEL END --------------------------------------------
|
|
2432
|
+
|
|
2433
|
+
//------------------------------------- AI MODEL START --------------------------------------------
|
|
2434
|
+
|
|
2435
|
+
model AIModel {
|
|
2436
|
+
id String @id @default(cuid())
|
|
2437
|
+
name String? @unique
|
|
2438
|
+
provider String? // openai, anthropic, etc.
|
|
2439
|
+
modelName String? // gpt-4, claude-3, etc.
|
|
2440
|
+
isActive Boolean @default(true)
|
|
2441
|
+
config Json? // Store model-specific settings
|
|
2442
|
+
createdAt DateTime @default(now())
|
|
2443
|
+
|
|
2444
|
+
@@map("ai_models")
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
//------------------------------------- AI MODEL END --------------------------------------------
|
|
2448
|
+
|
|
2449
|
+
//------------------------------------- USER EVENT CONFIGURATION MODEL END --------------------------------------------
|
|
2450
|
+
|
|
2451
|
+
model UserEventConfiguration {
|
|
2452
|
+
id Int @id @default(autoincrement())
|
|
2453
|
+
uuid String? @unique @default(uuid())
|
|
2454
|
+
name String?
|
|
2455
|
+
slug String? @unique
|
|
2456
|
+
is_active Boolean @default(false)
|
|
2457
|
+
is_editable Boolean @default(false)
|
|
2458
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
2459
|
+
created_by Int?
|
|
2460
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
2461
|
+
updated_by Int?
|
|
2462
|
+
|
|
2463
|
+
@@map("user_event_configurations")
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
//------------------------------------- USER EVENT CONFIGURATION MODEL END --------------------------------------------
|
|
2467
|
+
|
|
2468
|
+
//------------------------------------- EXPORT MODEL START --------------------------------------------
|
|
2469
|
+
|
|
2470
|
+
enum ExportStatus {
|
|
2471
|
+
PENDING
|
|
2472
|
+
PROCESSING
|
|
2473
|
+
COMPLETED
|
|
2474
|
+
FAILED
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
enum ExportModuleEnum {
|
|
2478
|
+
ITEM_LIBRARY
|
|
2479
|
+
CATEGORY_MASTER
|
|
2480
|
+
SUB_CATEGORY_MASTER
|
|
2481
|
+
UOM_MASTER
|
|
2482
|
+
ATTRIBUTE_MASTER
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
model ExportLog {
|
|
2486
|
+
id Int @id @default(autoincrement())
|
|
2487
|
+
uuid String? @unique @default(uuid())
|
|
2488
|
+
user_id Int
|
|
2489
|
+
user User @relation(fields: [user_id], references: [id])
|
|
2490
|
+
module UploadModuleEnum?
|
|
2491
|
+
file_name String?
|
|
2492
|
+
file_size Int?
|
|
2493
|
+
file_path String?
|
|
2494
|
+
download_url String?
|
|
2495
|
+
error_message String?
|
|
2496
|
+
total_records Int?
|
|
2497
|
+
processed_records Int? @default(0)
|
|
2498
|
+
filters Json?
|
|
2499
|
+
status UploadStatus @default(PENDING)
|
|
2500
|
+
created_at DateTime @default(now())
|
|
2501
|
+
started_at DateTime?
|
|
2502
|
+
completed_at DateTime?
|
|
2503
|
+
expires_at DateTime? @default(dbgenerated("NOW() + INTERVAL '7 days'"))
|
|
2504
|
+
|
|
2505
|
+
@@map("export_logs")
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
//------------------------------------- UPLOAD MODEL END --------------------------------------------
|
|
2509
|
+
|
|
2510
|
+
//------------------------------------- FISCAL YEAR MODEL START --------------------------------------------
|
|
2511
|
+
|
|
2512
|
+
model FiscalYear {
|
|
2513
|
+
id Int @id @default(autoincrement())
|
|
2514
|
+
uuid String? @unique @default(uuid())
|
|
2515
|
+
name String? @unique // e.g., "FY 2025-26"
|
|
2516
|
+
start_date DateTime?
|
|
2517
|
+
end_date DateTime?
|
|
2518
|
+
is_active Boolean @default(false) // Only one active year at a time
|
|
2519
|
+
is_default Boolean @default(false) // Mark default for new records
|
|
2520
|
+
created_at DateTime @default(now())
|
|
2521
|
+
created_by Int?
|
|
2522
|
+
updated_at DateTime @updatedAt
|
|
2523
|
+
updated_by Int?
|
|
2524
|
+
is_deleted Boolean @default(false)
|
|
2525
|
+
deleted_at DateTime?
|
|
2526
|
+
deleted_by Int?
|
|
2527
|
+
|
|
2528
|
+
@@index([start_date, end_date])
|
|
2529
|
+
@@map("fiscal_years")
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
//------------------------------------- FISCAL YEAR MODEL END --------------------------------------------
|
|
2533
|
+
//------------------------------------- BUDGET MODEL START --------------------------------------------
|
|
2534
|
+
enum BudgetStatus {
|
|
2535
|
+
WARNING
|
|
2536
|
+
HEALTHY
|
|
2537
|
+
CRITICAL
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
model Budget {
|
|
2541
|
+
id Int @id @default(autoincrement())
|
|
2542
|
+
company_name String?
|
|
2543
|
+
financial_year String?
|
|
2544
|
+
currency String? @default("INR")
|
|
2545
|
+
total_annual_budget Decimal? @db.Decimal(15, 2)
|
|
2546
|
+
description String?
|
|
2547
|
+
supporting_documents Json? // Store file references or URLs
|
|
2548
|
+
status BudgetStatus @default(HEALTHY)
|
|
2549
|
+
created_by Int?
|
|
2550
|
+
created_at DateTime @default(now())
|
|
2551
|
+
updated_by Int?
|
|
2552
|
+
updated_at DateTime @updatedAt
|
|
2553
|
+
is_deleted Boolean @default(false)
|
|
2554
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2555
|
+
deleted_by Int?
|
|
2556
|
+
|
|
2557
|
+
department_budgets DepartmentBudget[]
|
|
2558
|
+
CategoryBudget CategoryBudget[]
|
|
2559
|
+
|
|
2560
|
+
@@map("budgets")
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
//------------------------------------- BUDGET MODEL END --------------------------------------------
|
|
2564
|
+
|
|
2565
|
+
//------------------------------------- DEPARTMENT BUDGET MODEL START --------------------------------------------
|
|
2566
|
+
model DepartmentBudget {
|
|
2567
|
+
id Int @id @default(autoincrement())
|
|
2568
|
+
budget_id Int?
|
|
2569
|
+
budget Budget? @relation(fields: [budget_id], references: [id], onDelete: Cascade)
|
|
2570
|
+
department_id Int?
|
|
2571
|
+
department Department? @relation(fields: [department_id], references: [id], onDelete: Cascade)
|
|
2572
|
+
allocated_budget Decimal @db.Decimal(15, 2)
|
|
2573
|
+
notes String?
|
|
2574
|
+
created_by Int?
|
|
2575
|
+
created_at DateTime @default(now())
|
|
2576
|
+
updated_by Int?
|
|
2577
|
+
updated_at DateTime @updatedAt
|
|
2578
|
+
is_deleted Boolean @default(false)
|
|
2579
|
+
deleted_by Int?
|
|
2580
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2581
|
+
|
|
2582
|
+
@@unique([budget_id, department_id])
|
|
2583
|
+
@@map("department_budgets")
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
//------------------------------------- DEPARTMENT BUDGET MODEL END --------------------------------------------
|
|
2587
|
+
|
|
2588
|
+
//------------------------------------- CATEGORY BUDGET MODEL START --------------------------------------------
|
|
2589
|
+
model CategoryBudget {
|
|
2590
|
+
id Int @id @default(autoincrement())
|
|
2591
|
+
budget_id Int?
|
|
2592
|
+
budget Budget? @relation(fields: [budget_id], references: [id], onDelete: Cascade)
|
|
2593
|
+
category_id Int?
|
|
2594
|
+
category Category? @relation(fields: [category_id], references: [id], onDelete: Cascade)
|
|
2595
|
+
allocated_budget Decimal @db.Decimal(15, 2)
|
|
2596
|
+
notes String?
|
|
2597
|
+
crated_by Int?
|
|
2598
|
+
created_at DateTime @default(now())
|
|
2599
|
+
updated_by Int?
|
|
2600
|
+
updated_at DateTime @updatedAt
|
|
2601
|
+
is_deleted Boolean @default(false)
|
|
2602
|
+
deleted_by Int?
|
|
2603
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2604
|
+
|
|
2605
|
+
@@unique([budget_id, category_id])
|
|
2606
|
+
@@map("category_budgets")
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
//------------------------------------- CATEGORY BUDGET MODEL END --------------------------------------------
|