diff --git a/apps/api/src/database/migrations/0013_cuddly_night_nurse.sql b/apps/api/src/database/migrations/0013_cuddly_night_nurse.sql new file mode 100644 index 0000000..d7a6c58 --- /dev/null +++ b/apps/api/src/database/migrations/0013_cuddly_night_nurse.sql @@ -0,0 +1,9 @@ +ALTER TABLE "training_surveys" ALTER COLUMN "financial_requirement_description" SET DEFAULT '';--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "prod_description_internal" text DEFAULT '' NOT NULL;--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "internal_count" integer DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "external_count" integer DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "prod_description_external" text DEFAULT '' NOT NULL;--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "country" text DEFAULT '' NOT NULL;--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "city" text DEFAULT '' NOT NULL;--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "men_count" integer DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "training_surveys" ADD COLUMN "women_count" integer DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/apps/api/src/database/migrations/meta/0013_snapshot.json b/apps/api/src/database/migrations/meta/0013_snapshot.json new file mode 100644 index 0000000..b2db357 --- /dev/null +++ b/apps/api/src/database/migrations/meta/0013_snapshot.json @@ -0,0 +1,2159 @@ +{ + "id": "83db4263-dba8-4209-bd9e-a547c3bbb7b7", + "prevId": "665d0638-f6c7-49be-aa88-2d1fd0473e90", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.activity_logs": { + "name": "activity_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "activityLogs_idx": { + "name": "activityLogs_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "activity_logs_user_id_users_id_fk": { + "name": "activity_logs_user_id_users_id_fk", + "tableFrom": "activity_logs", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.roles": { + "name": "roles", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "roles_idx": { + "name": "roles_idx", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.sessions": { + "name": "sessions", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "sessions_idx": { + "name": "sessions_idx", + "columns": [ + { + "expression": "session_token", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.users": { + "name": "users", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fullname": { + "name": "fullname", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "municipality": { + "name": "municipality", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parish": { + "name": "parish", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_two_factor_enabled": { + "name": "is_two_factor_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "two_factor_secret": { + "name": "two_factor_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_email_verified": { + "name": "is_email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_idx": { + "name": "users_idx", + "columns": [ + { + "expression": "username", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "users_state_states_id_fk": { + "name": "users_state_states_id_fk", + "tableFrom": "users", + "tableTo": "states", + "columnsFrom": [ + "state" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "users_municipality_municipalities_id_fk": { + "name": "users_municipality_municipalities_id_fk", + "tableFrom": "users", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "users_parish_parishes_id_fk": { + "name": "users_parish_parishes_id_fk", + "tableFrom": "users", + "tableTo": "parishes", + "columnsFrom": [ + "parish" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_username_unique": { + "name": "users_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + }, + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.user_role": { + "name": "user_role", + "schema": "auth", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_role_idx": { + "name": "user_role_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_role_user_id_users_id_fk": { + "name": "user_role_user_id_users_id_fk", + "tableFrom": "user_role", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_role_role_id_roles_id_fk": { + "name": "user_role_role_id_roles_id_fk", + "tableFrom": "user_role", + "tableTo": "roles", + "schemaTo": "auth", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "auth.verificationToken": { + "name": "verificationToken", + "schema": "auth", + "columns": { + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.category_type": { + "name": "category_type", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "group": { + "name": "group", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "category_typeIx0": { + "name": "category_typeIx0", + "columns": [ + { + "expression": "group", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "category_typeIx1": { + "name": "category_typeIx1", + "columns": [ + { + "expression": "description", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.localities": { + "name": "localities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "state_id": { + "name": "state_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "municipality_id": { + "name": "municipality_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "parish_id": { + "name": "parish_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "localities_index_03": { + "name": "localities_index_03", + "columns": [ + { + "expression": "state_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "municipality_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parish_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "localities_index_00": { + "name": "localities_index_00", + "columns": [ + { + "expression": "state_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "localities_index_01": { + "name": "localities_index_01", + "columns": [ + { + "expression": "municipality_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "localities_index_02": { + "name": "localities_index_02", + "columns": [ + { + "expression": "parish_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "localities_state_id_states_id_fk": { + "name": "localities_state_id_states_id_fk", + "tableFrom": "localities", + "tableTo": "states", + "columnsFrom": [ + "state_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "localities_municipality_id_municipalities_id_fk": { + "name": "localities_municipality_id_municipalities_id_fk", + "tableFrom": "localities", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "localities_parish_id_parishes_id_fk": { + "name": "localities_parish_id_parishes_id_fk", + "tableFrom": "localities", + "tableTo": "parishes", + "columnsFrom": [ + "parish_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "localities_name_unique": { + "name": "localities_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.municipalities": { + "name": "municipalities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_id": { + "name": "state_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "municipalities_index_00": { + "name": "municipalities_index_00", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "state_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "municipalities_state_id_states_id_fk": { + "name": "municipalities_state_id_states_id_fk", + "tableFrom": "municipalities", + "tableTo": "states", + "columnsFrom": [ + "state_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.parishes": { + "name": "parishes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "municipality_id": { + "name": "municipality_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "parishes_index_00": { + "name": "parishes_index_00", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "municipality_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "parishes_municipality_id_municipalities_id_fk": { + "name": "parishes_municipality_id_municipalities_id_fk", + "tableFrom": "parishes", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.states": { + "name": "states", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "states_index_00": { + "name": "states_index_00", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.products": { + "name": "products", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "price": { + "name": "price", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "stock": { + "name": "stock", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url_img": { + "name": "url_img", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gallery": { + "name": "gallery", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'BORRADOR'" + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "products_user_id_users_id_fk": { + "name": "products_user_id_users_id_fk", + "tableFrom": "products", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.answers_surveys": { + "name": "answers_surveys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "survey_id": { + "name": "survey_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answers": { + "name": "answers", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "answers_index_00": { + "name": "answers_index_00", + "columns": [ + { + "expression": "answers", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "answers_index_01": { + "name": "answers_index_01", + "columns": [ + { + "expression": "survey_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "answers_index_02": { + "name": "answers_index_02", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "answers_surveys_survey_id_surveys_id_fk": { + "name": "answers_surveys_survey_id_surveys_id_fk", + "tableFrom": "answers_surveys", + "tableTo": "surveys", + "columnsFrom": [ + "survey_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "answers_surveys_user_id_users_id_fk": { + "name": "answers_surveys_user_id_users_id_fk", + "tableFrom": "answers_surveys", + "tableTo": "users", + "schemaTo": "auth", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.surveys": { + "name": "surveys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_audience": { + "name": "target_audience", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "closing_date": { + "name": "closing_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "published": { + "name": "published", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "questions": { + "name": "questions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "surveys_index_00": { + "name": "surveys_index_00", + "columns": [ + { + "expression": "title", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.training_surveys": { + "name": "training_surveys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "firstname": { + "name": "firstname", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "lastname": { + "name": "lastname", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visit_date": { + "name": "visit_date", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "municipality": { + "name": "municipality", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parish": { + "name": "parish", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "situr_code_commune": { + "name": "situr_code_commune", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "commune_name": { + "name": "commune_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_rif": { + "name": "commune_rif", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_spokesperson_name": { + "name": "commune_spokesperson_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_spokesperson_cedula": { + "name": "commune_spokesperson_cedula", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_spokesperson_rif": { + "name": "commune_spokesperson_rif", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_spokesperson_phone": { + "name": "commune_spokesperson_phone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "commune_email": { + "name": "commune_email", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council": { + "name": "communal_council", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "situr_code_communal_council": { + "name": "situr_code_communal_council", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "communal_council_rif": { + "name": "communal_council_rif", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_spokesperson_name": { + "name": "communal_council_spokesperson_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_spokesperson_cedula": { + "name": "communal_council_spokesperson_cedula", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_spokesperson_rif": { + "name": "communal_council_spokesperson_rif", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_spokesperson_phone": { + "name": "communal_council_spokesperson_phone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "communal_council_email": { + "name": "communal_council_email", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "osp_google_maps_link": { + "name": "osp_google_maps_link", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "osp_name": { + "name": "osp_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_address": { + "name": "osp_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_rif": { + "name": "osp_rif", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_type": { + "name": "osp_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "productive_activity": { + "name": "productive_activity", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "financial_requirement_description": { + "name": "financial_requirement_description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "current_status": { + "name": "current_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ACTIVA'" + }, + "company_constitution_year": { + "name": "company_constitution_year", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "producer_count": { + "name": "producer_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "product_count": { + "name": "product_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "product_description": { + "name": "product_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "installed_capacity": { + "name": "installed_capacity", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "operational_capacity": { + "name": "operational_capacity", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_fullname": { + "name": "osp_responsible_fullname", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_cedula": { + "name": "osp_responsible_cedula", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_rif": { + "name": "osp_responsible_rif", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_phone": { + "name": "osp_responsible_phone", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "osp_responsible_email": { + "name": "osp_responsible_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "civil_state": { + "name": "civil_state", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "family_burden": { + "name": "family_burden", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "number_of_children": { + "name": "number_of_children", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "general_observations": { + "name": "general_observations", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "paralysis_reason": { + "name": "paralysis_reason", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "photo1": { + "name": "photo1", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "photo2": { + "name": "photo2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "photo3": { + "name": "photo3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "coor_state": { + "name": "coor_state", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "coor_municipality": { + "name": "coor_municipality", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "coor_parish": { + "name": "coor_parish", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "coor_phone": { + "name": "coor_phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "eco_sector": { + "name": "eco_sector", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "productive_sector": { + "name": "productive_sector", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "central_productive_activity": { + "name": "central_productive_activity", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "main_productive_activity": { + "name": "main_productive_activity", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "types_of_equipment": { + "name": "types_of_equipment", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "equipment_count": { + "name": "equipment_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "equipment_description": { + "name": "equipment_description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "raw_material": { + "name": "raw_material", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "material_type": { + "name": "material_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "raw_material_count": { + "name": "raw_material_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "product_count_daily": { + "name": "product_count_daily", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "product_count_weekly": { + "name": "product_count_weekly", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "product_count_monthly": { + "name": "product_count_monthly", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "prod_description_internal": { + "name": "prod_description_internal", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "internal_count": { + "name": "internal_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "external_count": { + "name": "external_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "prod_description_external": { + "name": "prod_description_external", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "country": { + "name": "country", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "city": { + "name": "city", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "men_count": { + "name": "men_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "women_count": { + "name": "women_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (3)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "training_surveys_index_00": { + "name": "training_surveys_index_00", + "columns": [ + { + "expression": "firstname", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "training_surveys_state_states_id_fk": { + "name": "training_surveys_state_states_id_fk", + "tableFrom": "training_surveys", + "tableTo": "states", + "columnsFrom": [ + "state" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_municipality_municipalities_id_fk": { + "name": "training_surveys_municipality_municipalities_id_fk", + "tableFrom": "training_surveys", + "tableTo": "municipalities", + "columnsFrom": [ + "municipality" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_parish_parishes_id_fk": { + "name": "training_surveys_parish_parishes_id_fk", + "tableFrom": "training_surveys", + "tableTo": "parishes", + "columnsFrom": [ + "parish" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_coor_state_states_id_fk": { + "name": "training_surveys_coor_state_states_id_fk", + "tableFrom": "training_surveys", + "tableTo": "states", + "columnsFrom": [ + "coor_state" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_coor_municipality_municipalities_id_fk": { + "name": "training_surveys_coor_municipality_municipalities_id_fk", + "tableFrom": "training_surveys", + "tableTo": "municipalities", + "columnsFrom": [ + "coor_municipality" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_surveys_coor_parish_parishes_id_fk": { + "name": "training_surveys_coor_parish_parishes_id_fk", + "tableFrom": "training_surveys", + "tableTo": "parishes", + "columnsFrom": [ + "coor_parish" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "auth.gender": { + "name": "gender", + "schema": "auth", + "values": [ + "FEMENINO", + "MASCULINO" + ] + }, + "public.nationality": { + "name": "nationality", + "schema": "public", + "values": [ + "VENEZOLANO", + "EXTRANJERO" + ] + }, + "auth.status": { + "name": "status", + "schema": "auth", + "values": [ + "ACTIVE", + "INACTIVE" + ] + } + }, + "schemas": { + "auth": "auth" + }, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "auth.user_access_view": { + "columns": { + "userId": { + "name": "userId", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "role_name": { + "name": "role_name", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n SELECT\n u.id AS user_id,\n u.username,\n u.email,\n u.fullname,\n r.id AS role_id,\n r.name AS role_name\nFROM\n auth.users u\nLEFT JOIN\n auth.user_role ur ON u.id = ur.user_id \nLEFT JOIN\n auth.roles r ON ur.role_id = r.id", + "name": "user_access_view", + "schema": "auth", + "isExisting": false, + "materialized": false + }, + "public.v_product_store": { + "columns": { + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "price": { + "name": "price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "stock": { + "name": "stock", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "url_img": { + "name": "url_img", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gallery": { + "name": "gallery", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "fullname": { + "name": "fullname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "definition": "\n select p.id as product_id, p.title, p.description, p.price, p.stock, p.url_img, p.gallery, p.address, p.status, p.user_id, u.fullname, u.email, u.phone\n from products p\n left join auth.users as u on u.id = p.user_id", + "name": "v_product_store", + "schema": "public", + "isExisting": false, + "materialized": false + }, + "public.v_surveys": { + "columns": { + "survey_id": { + "name": "survey_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "closing_date": { + "name": "closing_date", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "target_audience": { + "name": "target_audience", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "definition": "select id as survey_id, title, description, created_at, closing_date, target_audience from surveys\nwhere published = true", + "name": "v_surveys", + "schema": "public", + "isExisting": false, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/api/src/database/migrations/meta/_journal.json b/apps/api/src/database/migrations/meta/_journal.json index 73c0d00..6cf7e04 100644 --- a/apps/api/src/database/migrations/meta/_journal.json +++ b/apps/api/src/database/migrations/meta/_journal.json @@ -92,6 +92,13 @@ "when": 1769621656400, "tag": "0012_sudden_venus", "breakpoints": true + }, + { + "idx": 13, + "version": "7", + "when": 1769629815868, + "tag": "0013_cuddly_night_nurse", + "breakpoints": true } ] } \ No newline at end of file diff --git a/apps/api/src/database/schema/surveys.ts b/apps/api/src/database/schema/surveys.ts index 83741e4..9fe8599 100644 --- a/apps/api/src/database/schema/surveys.ts +++ b/apps/api/src/database/schema/surveys.ts @@ -86,7 +86,8 @@ export const trainingSurveys = t.pgTable( productiveActivity: t.text('productive_activity').notNull(), financialRequirementDescription: t .text('financial_requirement_description') - .notNull(), + .notNull() + .default(''), currentStatus: t.text('current_status').notNull().default('ACTIVA'), companyConstitutionYear: t.integer('company_constitution_year').notNull(), producerCount: t.integer('producer_count').notNull(), @@ -138,6 +139,15 @@ export const trainingSurveys = t.pgTable( productCountDaily: t.integer('product_count_daily').notNull().default(0), productCountWeekly: t.integer('product_count_weekly').notNull().default(0), productCountMonthly: t.integer('product_count_monthly').notNull().default(0), + // nuevos campos adicionales + prodDescriptionInternal: t.text('prod_description_internal').notNull().default(''), + internalCount: t.integer('internal_count').notNull().default(0), + externalCount: t.integer('external_count').notNull().default(0), + prodDescriptionExternal: t.text('prod_description_external').notNull().default(''), + country: t.text('country').notNull().default(''), + city: t.text('city').notNull().default(''), + menCount: t.integer('men_count').notNull().default(0), + womenCount: t.integer('women_count').notNull().default(0), ...timestamps, }, (trainingSurveys) => ({ diff --git a/apps/api/src/features/training/dto/create-training.dto.ts b/apps/api/src/features/training/dto/create-training.dto.ts index 4ceb425..3c491b1 100644 --- a/apps/api/src/features/training/dto/create-training.dto.ts +++ b/apps/api/src/features/training/dto/create-training.dto.ts @@ -20,7 +20,8 @@ export class CreateTrainingDto { @ApiProperty() @IsString() - financialRequirementDescription: string; + @IsOptional() + financialRequirementDescription?: string; @ApiProperty() @IsInt() @@ -282,4 +283,36 @@ export class CreateTrainingDto { @ApiProperty() @IsInt() productCountMonthly: number; + + @ApiProperty() + @IsString() + prodDescriptionInternal: string; + + @ApiProperty() + @IsInt() + internalCount: number; + + @ApiProperty() + @IsInt() + externalCount: number; + + @ApiProperty() + @IsString() + prodDescriptionExternal: string; + + @ApiProperty() + @IsString() + country: string; + + @ApiProperty() + @IsString() + city: string; + + @ApiProperty() + @IsInt() + menCount: number; + + @ApiProperty() + @IsInt() + womenCount: number; } diff --git a/apps/web/constants/countries.ts b/apps/web/constants/countries.ts new file mode 100644 index 0000000..9b66d4d --- /dev/null +++ b/apps/web/constants/countries.ts @@ -0,0 +1,196 @@ +export const COUNTRY_OPTIONS = [ + 'Afganistán', + 'Albania', + 'Alemania', + 'Andorra', + 'Angola', + 'Antigua y Barbuda', + 'Arabia Saudita', + 'Argelia', + 'Argentina', + 'Armenia', + 'Australia', + 'Austria', + 'Azerbaiyán', + 'Bahamas', + 'Bangladés', + 'Barbados', + 'Baréin', + 'Bélgica', + 'Belice', + 'Benín', + 'Bielorrusia', + 'Birmania', + 'Bolivia', + 'Bosnia y Herzegovina', + 'Botsuana', + 'Brasil', + 'Brunéi', + 'Bulgaria', + 'Burkina Faso', + 'Burundi', + 'Bután', + 'Cabo Verde', + 'Camboya', + 'Camerún', + 'Canadá', + 'Catar', + 'Chad', + 'Chile', + 'China', + 'Chipre', + 'Ciudad del Vaticano', + 'Colombia', + 'Comoras', + 'Corea del Norte', + 'Corea del Sur', + 'Costa de Marfil', + 'Costa Rica', + 'Croacia', + 'Cuba', + 'Dinamarca', + 'Dominica', + 'Ecuador', + 'Egipto', + 'El Salvador', + 'Emiratos Árabes Unidos', + 'Eritrea', + 'Eslovaquia', + 'Eslovenia', + 'España', + 'Estados Unidos', + 'Estonia', + 'Etiopía', + 'Filipinas', + 'Finlandia', + 'Fiyi', + 'Francia', + 'Gabón', + 'Gambia', + 'Georgia', + 'Ghana', + 'Granada', + 'Grecia', + 'Guatemala', + 'Guyana', + 'Guinea', + 'Guinea Ecuatorial', + 'Guinea-Bisáu', + 'Haití', + 'Honduras', + 'Hungría', + 'India', + 'Indonesia', + 'Irak', + 'Irán', + 'Irlanda', + 'Islandia', + 'Islas Marshall', + 'Islas Salomón', + 'Israel', + 'Italia', + 'Jamaica', + 'Japón', + 'Jordania', + 'Kazajistán', + 'Kenia', + 'Kirguistán', + 'Kiribati', + 'Kuwait', + 'Laos', + 'Lesoto', + 'Letonia', + 'Líbano', + 'Liberia', + 'Libia', + 'Liechtenstein', + 'Lituania', + 'Luxemburgo', + 'Madagascar', + 'Malasia', + 'Malaui', + 'Maldivas', + 'Malí', + 'Malta', + 'Marruecos', + 'Mauricio', + 'Mauritania', + 'México', + 'Micronesia', + 'Moldavia', + 'Mónaco', + 'Mongolia', + 'Montenegro', + 'Mozambique', + 'Namibia', + 'Nauru', + 'Nepal', + 'Nicaragua', + 'Níger', + 'Nigeria', + 'Noruega', + 'Nueva Zelanda', + 'Omán', + 'Países Bajos', + 'Pakistán', + 'Palaos', + 'Panamá', + 'Papúa Nueva Guinea', + 'Paraguay', + 'Perú', + 'Polonia', + 'Portugal', + 'Reino Unido', + 'República Centroafricana', + 'República Checa', + 'República de Macedonia', + 'República del Congo', + 'República Democrática del Congo', + 'República Dominicana', + 'República Sudafricana', + 'Ruanda', + 'Rumanía', + 'Rusia', + 'Samoa', + 'San Cristóbal y Nieves', + 'San Marino', + 'San Vicente y las Granadinas', + 'Santa Lucía', + 'Santo Tomé y Príncipe', + 'Senegal', + 'Serbia', + 'Seychelles', + 'Sierra Leona', + 'Singapur', + 'Siria', + 'Somalia', + 'Sri Lanka', + 'Suazilandia', + 'Sudán', + 'Sudán del Sur', + 'Suecia', + 'Suiza', + 'Surinam', + 'Tailandia', + 'Tanzania', + 'Tayikistán', + 'Timor Oriental', + 'Togo', + 'Tonga', + 'Trinidad y Tobago', + 'Túnez', + 'Turkmenistán', + 'Turquía', + 'Tuvalu', + 'Ucrania', + 'Uganda', + 'Uruguay', + 'Uzbekistán', + 'Vanuatu', + 'Venezuela', + 'Vietnam', + 'Yemen', + 'Yibuti', + 'Zambia', + 'Zimbabue' +]; \ No newline at end of file diff --git a/apps/web/feactures/training/components/form.tsx b/apps/web/feactures/training/components/form.tsx index ff44bff..0488bf9 100644 --- a/apps/web/feactures/training/components/form.tsx +++ b/apps/web/feactures/training/components/form.tsx @@ -37,6 +37,8 @@ import { import { SelectSearchable } from '@repo/shadcn/select-searchable'; import React from 'react'; +import { COUNTRY_OPTIONS } from '@/constants/countries'; + // const PRODUCTIVE_ACTIVITIES = [ // 'Agricola', // 'Textil', @@ -47,9 +49,6 @@ import React from 'react'; const ECO_SECTORS = ['Primario', 'Secundario', 'Terciario']; -// const ECO_SECTORS_PRIMARIO = ['Agropecuario', 'Pesca', 'Minería', 'Forestal']; -// const ECO_SECTORS_SECUNDARIO = ['Manufactura', 'Construcción', 'Energía']; - const PRODUCTIVE_SECTORS = ['Agricola', 'Manufactura', 'Servicios', 'Comercio', 'Turismo']; const CENTRAL_PRODUCTIVE_ACTIVITY = [ @@ -62,11 +61,6 @@ const CENTRAL_PRODUCTIVE_ACTIVITY = [ 'COMERCIO' ]; - -// const PRODUCTIVE_SECTORS_PRIMARIO = ['Agricola']; -// const PRODUCTIVE_SECTORS_SECUNDARIO = ['Manufactura']; -// const PRODUCTIVE_SECTORS_TERCIARIO = ['Servicios', 'Comercio', 'Turismo']; - const MAIN_PRODUCTIVE_ACTIVITY = [ 'AGRICULTURA ', 'CRIA ', @@ -168,10 +162,10 @@ export function CreateTrainingForm({ const isSaving = isCreating || isUpdating; - // const [state, setState] = React.useState(0); - // const [municipality, setMunicipality] = React.useState(0); - // const [disabledMunicipality, setDisabledMunicipality] = React.useState(true); - // const [disabledParish, setDisabledParish] = React.useState(true); + const [state, setState] = React.useState(0); + const [municipality, setMunicipality] = React.useState(0); + const [disabledMunicipality, setDisabledMunicipality] = React.useState(true); + const [disabledParish, setDisabledParish] = React.useState(true); const [coorState, setcoorState] = React.useState(0); const [coorMunicipality, setcoorMunicipality] = React.useState(0); @@ -180,9 +174,9 @@ export function CreateTrainingForm({ const [selectedFiles, setSelectedFiles] = React.useState([]); - // const { data: dataState } = useStateQuery(); - // const { data: dataMunicipality } = useMunicipalityQuery(state); - // const { data: dataParish } = useParishQuery(municipality); + const { data: dataState } = useStateQuery(); + const { data: dataMunicipality } = useMunicipalityQuery(state); + const { data: dataParish } = useParishQuery(municipality); const { data: dataCoorState } = useStateQuery(); const { data: dataCoorMunicipality } = useMunicipalityQuery(coorState); @@ -202,30 +196,30 @@ export function CreateTrainingForm({ : [{ id: 0, stateId: 0, name: 'Sin Parroquias' }]; - // const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }]; + const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }]; - // const municipalityOptions = - // Array.isArray(dataMunicipality?.data) && dataMunicipality.data.length > 0 - // ? dataMunicipality.data - // : [{ id: 0, stateId: 0, name: 'Sin Municipios' }]; + const municipalityOptions = + Array.isArray(dataMunicipality?.data) && dataMunicipality.data.length > 0 + ? dataMunicipality.data + : [{ id: 0, stateId: 0, name: 'Sin Municipios' }]; - // const parishOptions = - // Array.isArray(dataParish?.data) && dataParish.data.length > 0 - // ? dataParish.data - // : [{ id: 0, stateId: 0, name: 'Sin Parroquias' }]; + const parishOptions = + Array.isArray(dataParish?.data) && dataParish.data.length > 0 + ? dataParish.data + : [{ id: 0, stateId: 0, name: 'Sin Parroquias' }]; // No local state needed for existing photos, we use form values React.useEffect(() => { if (defaultValues) { - // if (defaultValues.state) { - // setState(Number(defaultValues.state)); - // setDisabledMunicipality(false); - // } - // if (defaultValues.municipality) { - // setMunicipality(Number(defaultValues.municipality)); - // setDisabledParish(false); - // } + if (defaultValues.state) { + setState(Number(defaultValues.state)); + setDisabledMunicipality(false); + } + if (defaultValues.municipality) { + setMunicipality(Number(defaultValues.municipality)); + setDisabledParish(false); + } if (defaultValues.coorState) { setcoorState(Number(defaultValues.coorState)); @@ -272,8 +266,8 @@ export function CreateTrainingForm({ productCountDaily: defaultValues?.productCountDaily || 0, productCountWeekly: defaultValues?.productCountWeekly || 0, productCountMonthly: defaultValues?.productCountMonthly || 0, - financialRequirementDescription: - defaultValues?.financialRequirementDescription || '', + // financialRequirementDescription: + // defaultValues?.financialRequirementDescription || '', siturCodeCommune: defaultValues?.siturCodeCommune || '', communeName: defaultValues?.communeName || '', communeRif: defaultValues?.communeRif || '', @@ -299,8 +293,9 @@ export function CreateTrainingForm({ companyConstitutionYear: defaultValues?.companyConstitutionYear || new Date().getFullYear(), producerCount: defaultValues?.producerCount || 0, - productCount: defaultValues?.productCount || 0, + // productCount: defaultValues?.productCount || 0, productDescription: defaultValues?.productDescription || '', + prodDescriptionInternal: defaultValues?.prodDescriptionInternal || '', installedCapacity: defaultValues?.installedCapacity || '', operationalCapacity: defaultValues?.operationalCapacity || '', ospResponsibleFullname: defaultValues?.ospResponsibleFullname || '', @@ -316,9 +311,16 @@ export function CreateTrainingForm({ photo2: defaultValues?.photo2 || '', photo3: defaultValues?.photo3 || '', paralysisReason: defaultValues?.paralysisReason || '', - // state: defaultValues?.state || undefined, - // municipality: defaultValues?.municipality || undefined, - // parish: defaultValues?.parish || undefined + state: defaultValues?.state || undefined, + municipality: defaultValues?.municipality || undefined, + parish: defaultValues?.parish || undefined, + internalCount: defaultValues?.internalCount || 0, + externalCount: defaultValues?.externalCount || 0, + prodDescriptionExternal: defaultValues?.prodDescriptionExternal || '', + country: defaultValues?.country || undefined, + city: defaultValues?.city || undefined, + menCount: defaultValues?.menCount || 0, + womenCount: defaultValues?.womenCount || 0, }, mode: 'onChange', }); @@ -565,7 +567,7 @@ export function CreateTrainingForm({ > - + @@ -593,7 +595,7 @@ export function CreateTrainingForm({ > - + @@ -621,7 +623,7 @@ export function CreateTrainingForm({ > - + @@ -640,6 +642,34 @@ export function CreateTrainingForm({ ( + + Actividad Productiva Principal + + + + )} + /> + + ( Actividad Productiva @@ -649,7 +679,7 @@ export function CreateTrainingForm({ > - + @@ -721,8 +751,64 @@ export function CreateTrainingForm({ )} /> */} - {/* Tipo de equipamiento */} + ( + + Año de constitución + + + + + + )} + /> + + ( + + Estatus + + + + )} + /> + + ( + + Razones de paralización (si aplica) + +