n8n-nodes-aivencerealtycrm 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,10 +40,6 @@ class AivenceRealty {
40
40
  name: 'Property',
41
41
  value: 'property',
42
42
  },
43
- {
44
- name: 'Email',
45
- value: 'email',
46
- },
47
43
  {
48
44
  name: 'Maintenance Request',
49
45
  value: 'maintenanceRequest',
@@ -53,8 +49,8 @@ class AivenceRealty {
53
49
  value: 'contractor',
54
50
  },
55
51
  {
56
- name: 'Maintenance Cost',
57
- value: 'maintenanceCost',
52
+ name: 'Tenant',
53
+ value: 'tenant',
58
54
  },
59
55
  {
60
56
  name: 'Appointment',
@@ -102,10 +98,16 @@ class AivenceRealty {
102
98
  description: 'Obtener lead por ID',
103
99
  action: 'Obtener lead',
104
100
  },
101
+ {
102
+ name: 'Add Activity',
103
+ value: 'addActivity',
104
+ description: 'Agregar actividad a un lead',
105
+ action: 'Agregar actividad',
106
+ },
105
107
  ],
106
108
  default: 'list',
107
109
  },
108
- // Lead ID (para Update y Get)
110
+ // Lead ID (para Update, Get y AddActivity)
109
111
  {
110
112
  displayName: 'Lead ID',
111
113
  name: 'leadId',
@@ -114,7 +116,7 @@ class AivenceRealty {
114
116
  displayOptions: {
115
117
  show: {
116
118
  resource: ['lead'],
117
- operation: ['update', 'get'],
119
+ operation: ['update', 'get', 'addActivity'],
118
120
  },
119
121
  },
120
122
  default: '',
@@ -297,6 +299,211 @@ class AivenceRealty {
297
299
  default: 'apartamento',
298
300
  description: 'Tipo de propiedad de interés',
299
301
  },
302
+ {
303
+ displayName: 'Conversation ID',
304
+ name: 'conversation_id',
305
+ type: 'string',
306
+ displayOptions: {
307
+ show: {
308
+ resource: ['lead'],
309
+ operation: ['create', 'update'],
310
+ useJsonInput: [false],
311
+ },
312
+ },
313
+ default: '',
314
+ description: 'ID de conversación de Chatwoot/AivenceGraph para vincular el lead con su historial',
315
+ },
316
+ {
317
+ displayName: 'Status',
318
+ name: 'status',
319
+ type: 'options',
320
+ options: [
321
+ {
322
+ name: 'New',
323
+ value: 'new',
324
+ },
325
+ {
326
+ name: 'Contacted',
327
+ value: 'contacted',
328
+ },
329
+ {
330
+ name: 'Qualified',
331
+ value: 'qualified',
332
+ },
333
+ {
334
+ name: 'Converted',
335
+ value: 'converted',
336
+ },
337
+ {
338
+ name: 'Lost',
339
+ value: 'lost',
340
+ },
341
+ ],
342
+ displayOptions: {
343
+ show: {
344
+ resource: ['lead'],
345
+ operation: ['create', 'update'],
346
+ useJsonInput: [false],
347
+ },
348
+ },
349
+ default: 'new',
350
+ description: 'Estado del lead',
351
+ },
352
+ {
353
+ displayName: 'Score',
354
+ name: 'score',
355
+ type: 'number',
356
+ typeOptions: {
357
+ minValue: 0,
358
+ maxValue: 100,
359
+ },
360
+ displayOptions: {
361
+ show: {
362
+ resource: ['lead'],
363
+ operation: ['create', 'update'],
364
+ useJsonInput: [false],
365
+ },
366
+ },
367
+ default: 0,
368
+ description: 'Puntuación del lead (0-100)',
369
+ },
370
+ {
371
+ displayName: 'Category',
372
+ name: 'category',
373
+ type: 'options',
374
+ options: [
375
+ {
376
+ name: 'Hot',
377
+ value: 'hot',
378
+ },
379
+ {
380
+ name: 'Warm',
381
+ value: 'warm',
382
+ },
383
+ {
384
+ name: 'Cold',
385
+ value: 'cold',
386
+ },
387
+ ],
388
+ displayOptions: {
389
+ show: {
390
+ resource: ['lead'],
391
+ operation: ['create', 'update'],
392
+ useJsonInput: [false],
393
+ },
394
+ },
395
+ default: 'warm',
396
+ description: 'Categoría del lead',
397
+ },
398
+ {
399
+ displayName: 'Tags',
400
+ name: 'tags',
401
+ type: 'string',
402
+ displayOptions: {
403
+ show: {
404
+ resource: ['lead'],
405
+ operation: ['create', 'update'],
406
+ useJsonInput: [false],
407
+ },
408
+ },
409
+ default: '',
410
+ description: 'Tags separados por comas (ej: "VIP,Urgente,Referido")',
411
+ },
412
+ {
413
+ displayName: 'Notes',
414
+ name: 'notes',
415
+ type: 'string',
416
+ typeOptions: {
417
+ rows: 4,
418
+ },
419
+ displayOptions: {
420
+ show: {
421
+ resource: ['lead'],
422
+ operation: ['create', 'update'],
423
+ useJsonInput: [false],
424
+ },
425
+ },
426
+ default: '',
427
+ description: 'Notas adicionales sobre el lead',
428
+ },
429
+ {
430
+ displayName: 'CRM ID',
431
+ name: 'crm_id',
432
+ type: 'string',
433
+ displayOptions: {
434
+ show: {
435
+ resource: ['lead'],
436
+ operation: ['create', 'update'],
437
+ useJsonInput: [false],
438
+ },
439
+ },
440
+ default: '',
441
+ description: 'ID del lead en sistema CRM externo',
442
+ },
443
+ // ============================================
444
+ // LEAD ADD ACTIVITY FIELDS
445
+ // ============================================
446
+ {
447
+ displayName: 'Activity Type',
448
+ name: 'activity_type',
449
+ type: 'options',
450
+ required: true,
451
+ options: [
452
+ {
453
+ name: 'Llamada',
454
+ value: 'llamada',
455
+ },
456
+ {
457
+ name: 'Email',
458
+ value: 'email',
459
+ },
460
+ {
461
+ name: 'WhatsApp',
462
+ value: 'whatsapp',
463
+ },
464
+ {
465
+ name: 'Reunión',
466
+ value: 'reunion',
467
+ },
468
+ {
469
+ name: 'Visita Propiedad',
470
+ value: 'visita_propiedad',
471
+ },
472
+ {
473
+ name: 'Seguimiento',
474
+ value: 'seguimiento',
475
+ },
476
+ {
477
+ name: 'Otro',
478
+ value: 'otro',
479
+ },
480
+ ],
481
+ displayOptions: {
482
+ show: {
483
+ resource: ['lead'],
484
+ operation: ['addActivity'],
485
+ },
486
+ },
487
+ default: 'llamada',
488
+ description: 'Tipo de actividad',
489
+ },
490
+ {
491
+ displayName: 'Description',
492
+ name: 'activity_description',
493
+ type: 'string',
494
+ required: true,
495
+ typeOptions: {
496
+ rows: 4,
497
+ },
498
+ displayOptions: {
499
+ show: {
500
+ resource: ['lead'],
501
+ operation: ['addActivity'],
502
+ },
503
+ },
504
+ default: '',
505
+ description: 'Descripción de la actividad',
506
+ },
300
507
  // ============================================
301
508
  // PROPERTY OPERATIONS
302
509
  // ============================================
@@ -329,6 +536,24 @@ class AivenceRealty {
329
536
  description: 'Vista de agente (búsqueda avanzada)',
330
537
  action: 'Vista de agente',
331
538
  },
539
+ {
540
+ name: 'Get Similar',
541
+ value: 'getSimilar',
542
+ description: 'Obtener propiedades similares',
543
+ action: 'Obtener similares',
544
+ },
545
+ {
546
+ name: 'Natural Search',
547
+ value: 'naturalSearch',
548
+ description: 'Búsqueda con IA usando lenguaje natural',
549
+ action: 'Búsqueda natural',
550
+ },
551
+ {
552
+ name: 'Get Statistics',
553
+ value: 'statistics',
554
+ description: 'Obtener estadísticas de propiedades',
555
+ action: 'Obtener estadísticas',
556
+ },
332
557
  ],
333
558
  default: 'list',
334
559
  },
@@ -341,47 +566,29 @@ class AivenceRealty {
341
566
  displayOptions: {
342
567
  show: {
343
568
  resource: ['property'],
344
- operation: ['get', 'getAgentView'],
569
+ operation: ['get', 'getAgentView', 'getSimilar'],
345
570
  },
346
571
  },
347
572
  default: '',
348
573
  description: 'ID de la propiedad',
349
574
  },
350
- // ============================================
351
- // EMAIL OPERATIONS
352
- // ============================================
575
+ // Natural Search Query
353
576
  {
354
- displayName: 'Operación',
355
- name: 'operation',
356
- type: 'options',
357
- noDataExpression: true,
358
- displayOptions: {
359
- show: {
360
- resource: ['email'],
361
- },
577
+ displayName: 'Search Query',
578
+ name: 'naturalSearchQuery',
579
+ type: 'string',
580
+ required: true,
581
+ typeOptions: {
582
+ rows: 3,
362
583
  },
363
- options: [
364
- {
365
- name: 'Ingest',
366
- value: 'ingest',
367
- description: 'Ingestar email al CRM',
368
- action: 'Ingestar email',
369
- },
370
- ],
371
- default: 'ingest',
372
- },
373
- {
374
- displayName: 'Usar datos del nodo anterior',
375
- name: 'useJsonInput',
376
- type: 'boolean',
377
584
  displayOptions: {
378
585
  show: {
379
- resource: ['email'],
380
- operation: ['ingest'],
586
+ resource: ['property'],
587
+ operation: ['naturalSearch'],
381
588
  },
382
589
  },
383
- default: true,
384
- description: 'Si está activado, usará el JSON completo del nodo anterior',
590
+ default: '',
591
+ description: 'Búsqueda en lenguaje natural (ej: "Busco un apartamento de 3 dormitorios en Palermo con balcón")',
385
592
  },
386
593
  // ============================================
387
594
  // MAINTENANCE REQUEST OPERATIONS
@@ -427,6 +634,12 @@ class AivenceRealty {
427
634
  description: 'Agregar mensaje a solicitud',
428
635
  action: 'Agregar mensaje',
429
636
  },
637
+ {
638
+ name: 'Assign Contractor',
639
+ value: 'assignContractor',
640
+ description: 'Asignar contratista a solicitud',
641
+ action: 'Asignar contratista',
642
+ },
430
643
  ],
431
644
  default: 'list',
432
645
  },
@@ -439,12 +652,27 @@ class AivenceRealty {
439
652
  displayOptions: {
440
653
  show: {
441
654
  resource: ['maintenanceRequest'],
442
- operation: ['get', 'update', 'addMessage'],
655
+ operation: ['get', 'update', 'addMessage', 'assignContractor'],
443
656
  },
444
657
  },
445
658
  default: '',
446
659
  description: 'ID de la solicitud',
447
660
  },
661
+ // Contractor ID para assignContractor
662
+ {
663
+ displayName: 'Contractor ID',
664
+ name: 'contractorId',
665
+ type: 'string',
666
+ required: true,
667
+ displayOptions: {
668
+ show: {
669
+ resource: ['maintenanceRequest'],
670
+ operation: ['assignContractor'],
671
+ },
672
+ },
673
+ default: '',
674
+ description: 'ID del contratista a asignar',
675
+ },
448
676
  {
449
677
  displayName: 'Usar datos del nodo anterior',
450
678
  name: 'useJsonInput',
@@ -478,6 +706,18 @@ class AivenceRealty {
478
706
  description: 'Listar contractors',
479
707
  action: 'Listar contractors',
480
708
  },
709
+ {
710
+ name: 'Get',
711
+ value: 'get',
712
+ description: 'Obtener contractor por ID',
713
+ action: 'Obtener contractor',
714
+ },
715
+ {
716
+ name: 'Create',
717
+ value: 'create',
718
+ description: 'Crear contractor',
719
+ action: 'Crear contractor',
720
+ },
481
721
  {
482
722
  name: 'Get Next Available',
483
723
  value: 'getNextAvailable',
@@ -487,8 +727,37 @@ class AivenceRealty {
487
727
  ],
488
728
  default: 'list',
489
729
  },
730
+ // Contractor ID
731
+ {
732
+ displayName: 'Contractor ID',
733
+ name: 'contractorId',
734
+ type: 'string',
735
+ required: true,
736
+ displayOptions: {
737
+ show: {
738
+ resource: ['contractor'],
739
+ operation: ['get'],
740
+ },
741
+ },
742
+ default: '',
743
+ description: 'ID del contractor',
744
+ },
745
+ // Contractor Create: JSON from previous node
746
+ {
747
+ displayName: 'Usar datos del nodo anterior',
748
+ name: 'useJsonInput',
749
+ type: 'boolean',
750
+ displayOptions: {
751
+ show: {
752
+ resource: ['contractor'],
753
+ operation: ['create'],
754
+ },
755
+ },
756
+ default: true,
757
+ description: 'Si está activado, usará el JSON completo del nodo anterior con campos: name, email, phone, specialties, rating, availability',
758
+ },
490
759
  // ============================================
491
- // MAINTENANCE COST OPERATIONS
760
+ // TENANT OPERATIONS
492
761
  // ============================================
493
762
  {
494
763
  displayName: 'Operación',
@@ -497,31 +766,59 @@ class AivenceRealty {
497
766
  noDataExpression: true,
498
767
  displayOptions: {
499
768
  show: {
500
- resource: ['maintenanceCost'],
769
+ resource: ['tenant'],
501
770
  },
502
771
  },
503
772
  options: [
773
+ {
774
+ name: 'List',
775
+ value: 'list',
776
+ description: 'Listar inquilinos',
777
+ action: 'Listar inquilinos',
778
+ },
779
+ {
780
+ name: 'Get',
781
+ value: 'get',
782
+ description: 'Obtener inquilino por ID',
783
+ action: 'Obtener inquilino',
784
+ },
504
785
  {
505
786
  name: 'Create',
506
787
  value: 'create',
507
- description: 'Crear costo de mantenimiento',
508
- action: 'Crear costo',
788
+ description: 'Crear inquilino',
789
+ action: 'Crear inquilino',
509
790
  },
510
791
  ],
511
- default: 'create',
792
+ default: 'list',
793
+ },
794
+ // Tenant ID
795
+ {
796
+ displayName: 'Tenant ID',
797
+ name: 'tenantId',
798
+ type: 'string',
799
+ required: true,
800
+ displayOptions: {
801
+ show: {
802
+ resource: ['tenant'],
803
+ operation: ['get'],
804
+ },
805
+ },
806
+ default: '',
807
+ description: 'ID del inquilino',
512
808
  },
809
+ // Tenant Create: JSON from previous node
513
810
  {
514
811
  displayName: 'Usar datos del nodo anterior',
515
812
  name: 'useJsonInput',
516
813
  type: 'boolean',
517
814
  displayOptions: {
518
815
  show: {
519
- resource: ['maintenanceCost'],
816
+ resource: ['tenant'],
520
817
  operation: ['create'],
521
818
  },
522
819
  },
523
820
  default: true,
524
- description: 'Si está activado, usará el JSON completo del nodo anterior',
821
+ description: 'Si está activado, usará el JSON completo del nodo anterior con campos: name, email, phone, property_id, lease_start, lease_end, monthly_rent',
525
822
  },
526
823
  // ============================================
527
824
  // APPOINTMENT OPERATIONS
@@ -537,14 +834,38 @@ class AivenceRealty {
537
834
  },
538
835
  },
539
836
  options: [
837
+ {
838
+ name: 'List',
839
+ value: 'list',
840
+ description: 'Listar citas',
841
+ action: 'Listar citas',
842
+ },
540
843
  {
541
844
  name: 'Create',
542
845
  value: 'create',
543
846
  description: 'Crear cita',
544
847
  action: 'Crear cita',
545
848
  },
849
+ {
850
+ name: 'Get',
851
+ value: 'get',
852
+ description: 'Obtener cita por ID',
853
+ action: 'Obtener cita',
854
+ },
855
+ {
856
+ name: 'Update Status',
857
+ value: 'updateStatus',
858
+ description: 'Actualizar estado de cita',
859
+ action: 'Actualizar estado',
860
+ },
861
+ {
862
+ name: 'Delete',
863
+ value: 'delete',
864
+ description: 'Eliminar cita',
865
+ action: 'Eliminar cita',
866
+ },
546
867
  ],
547
- default: 'create',
868
+ default: 'list',
548
869
  },
549
870
  {
550
871
  displayName: 'Usar datos del nodo anterior',
@@ -559,6 +880,54 @@ class AivenceRealty {
559
880
  default: true,
560
881
  description: 'Si está activado, usará el JSON completo del nodo anterior',
561
882
  },
883
+ // Appointment ID para get, updateStatus y delete
884
+ {
885
+ displayName: 'Appointment ID',
886
+ name: 'appointmentId',
887
+ type: 'string',
888
+ required: true,
889
+ displayOptions: {
890
+ show: {
891
+ resource: ['appointment'],
892
+ operation: ['get', 'updateStatus', 'delete'],
893
+ },
894
+ },
895
+ default: '',
896
+ description: 'ID de la cita',
897
+ },
898
+ // Estado para updateStatus
899
+ {
900
+ displayName: 'Estado',
901
+ name: 'appointment_status',
902
+ type: 'options',
903
+ required: true,
904
+ options: [
905
+ {
906
+ name: 'Pending',
907
+ value: 'pending',
908
+ },
909
+ {
910
+ name: 'Confirmed',
911
+ value: 'confirmed',
912
+ },
913
+ {
914
+ name: 'Completed',
915
+ value: 'completed',
916
+ },
917
+ {
918
+ name: 'Cancelled',
919
+ value: 'cancelled',
920
+ },
921
+ ],
922
+ displayOptions: {
923
+ show: {
924
+ resource: ['appointment'],
925
+ operation: ['updateStatus'],
926
+ },
927
+ },
928
+ default: 'pending',
929
+ description: 'Nuevo estado de la cita',
930
+ },
562
931
  ],
563
932
  };
564
933
  }
@@ -601,12 +970,23 @@ class AivenceRealty {
601
970
  budget_min: this.getNodeParameter('budget_min', i, 0),
602
971
  budget_max: this.getNodeParameter('budget_max', i, 0),
603
972
  property_type: this.getNodeParameter('property_type', i, 'apartamento'),
973
+ conversation_id: this.getNodeParameter('conversation_id', i, ''),
974
+ status: this.getNodeParameter('status', i, 'new'),
975
+ score: this.getNodeParameter('score', i, 0),
976
+ category: this.getNodeParameter('category', i, 'warm'),
977
+ notes: this.getNodeParameter('notes', i, ''),
978
+ crm_id: this.getNodeParameter('crm_id', i, ''),
604
979
  };
605
980
  // Procesar preferred_areas (convertir string separado por comas a array)
606
981
  const areasString = this.getNodeParameter('preferred_areas', i, '');
607
982
  if (areasString) {
608
983
  body.preferred_areas = areasString.split(',').map((area) => area.trim());
609
984
  }
985
+ // Procesar tags (convertir string separado por comas a array)
986
+ const tagsString = this.getNodeParameter('tags', i, '');
987
+ if (tagsString) {
988
+ body.tags = tagsString.split(',').map((tag) => tag.trim());
989
+ }
610
990
  // Remover campos vacíos opcionales
611
991
  if (!body.message)
612
992
  delete body.message;
@@ -616,6 +996,16 @@ class AivenceRealty {
616
996
  delete body.budget_max;
617
997
  if (!body.preferred_areas || body.preferred_areas.length === 0)
618
998
  delete body.preferred_areas;
999
+ if (!body.conversation_id)
1000
+ delete body.conversation_id;
1001
+ if (!body.notes)
1002
+ delete body.notes;
1003
+ if (!body.crm_id)
1004
+ delete body.crm_id;
1005
+ if (!body.tags || body.tags.length === 0)
1006
+ delete body.tags;
1007
+ if (body.score === 0)
1008
+ delete body.score;
619
1009
  }
620
1010
  responseData = await this.helpers.httpRequest({
621
1011
  method: 'POST',
@@ -643,6 +1033,13 @@ class AivenceRealty {
643
1033
  const budget_max = this.getNodeParameter('budget_max', i, 0);
644
1034
  const property_type = this.getNodeParameter('property_type', i, '');
645
1035
  const areasString = this.getNodeParameter('preferred_areas', i, '');
1036
+ const conversation_id = this.getNodeParameter('conversation_id', i, '');
1037
+ const status = this.getNodeParameter('status', i, '');
1038
+ const score = this.getNodeParameter('score', i, 0);
1039
+ const category = this.getNodeParameter('category', i, '');
1040
+ const notes = this.getNodeParameter('notes', i, '');
1041
+ const crm_id = this.getNodeParameter('crm_id', i, '');
1042
+ const tagsString = this.getNodeParameter('tags', i, '');
646
1043
  if (name)
647
1044
  body.name = name;
648
1045
  if (email)
@@ -659,9 +1056,24 @@ class AivenceRealty {
659
1056
  body.budget_max = budget_max;
660
1057
  if (property_type)
661
1058
  body.property_type = property_type;
1059
+ if (conversation_id)
1060
+ body.conversation_id = conversation_id;
1061
+ if (status)
1062
+ body.status = status;
1063
+ if (score > 0)
1064
+ body.score = score;
1065
+ if (category)
1066
+ body.category = category;
1067
+ if (notes)
1068
+ body.notes = notes;
1069
+ if (crm_id)
1070
+ body.crm_id = crm_id;
662
1071
  if (areasString) {
663
1072
  body.preferred_areas = areasString.split(',').map((area) => area.trim());
664
1073
  }
1074
+ if (tagsString) {
1075
+ body.tags = tagsString.split(',').map((tag) => tag.trim());
1076
+ }
665
1077
  }
666
1078
  responseData = await this.helpers.httpRequest({
667
1079
  method: 'PATCH',
@@ -678,6 +1090,21 @@ class AivenceRealty {
678
1090
  json: true,
679
1091
  });
680
1092
  }
1093
+ else if (operation === 'addActivity') {
1094
+ const leadId = this.getNodeParameter('leadId', i);
1095
+ const activityType = this.getNodeParameter('activity_type', i);
1096
+ const description = this.getNodeParameter('activity_description', i);
1097
+ const body = {
1098
+ activity_type: activityType,
1099
+ description: description,
1100
+ };
1101
+ responseData = await this.helpers.httpRequest({
1102
+ method: 'POST',
1103
+ url: `${baseUrl}/api/v1/mariana/leads/${leadId}/activity`,
1104
+ body,
1105
+ json: true,
1106
+ });
1107
+ }
681
1108
  }
682
1109
  // ============================================
683
1110
  // PROPERTY RESOURCE
@@ -706,18 +1133,27 @@ class AivenceRealty {
706
1133
  json: true,
707
1134
  });
708
1135
  }
709
- }
710
- // ============================================
711
- // EMAIL RESOURCE
712
- // ============================================
713
- else if (resource === 'email') {
714
- if (operation === 'ingest') {
715
- const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
716
- const body = useJsonInput ? items[i].json : {};
1136
+ else if (operation === 'getSimilar') {
1137
+ const propertyId = this.getNodeParameter('propertyId', i);
1138
+ responseData = await this.helpers.httpRequest({
1139
+ method: 'GET',
1140
+ url: `${baseUrl}/api/v1/propiedades/${propertyId}/similares`,
1141
+ json: true,
1142
+ });
1143
+ }
1144
+ else if (operation === 'naturalSearch') {
1145
+ const query = this.getNodeParameter('naturalSearchQuery', i);
717
1146
  responseData = await this.helpers.httpRequest({
718
1147
  method: 'POST',
719
- url: `${baseUrl}/api/v1/emails/ingest`,
720
- body,
1148
+ url: `${baseUrl}/api/v1/propiedades/busqueda/natural`,
1149
+ body: { query },
1150
+ json: true,
1151
+ });
1152
+ }
1153
+ else if (operation === 'statistics') {
1154
+ responseData = await this.helpers.httpRequest({
1155
+ method: 'GET',
1156
+ url: `${baseUrl}/api/v1/propiedades/estadisticas`,
721
1157
  json: true,
722
1158
  });
723
1159
  }
@@ -773,6 +1209,16 @@ class AivenceRealty {
773
1209
  json: true,
774
1210
  });
775
1211
  }
1212
+ else if (operation === 'assignContractor') {
1213
+ const requestId = this.getNodeParameter('requestId', i);
1214
+ const contractorId = this.getNodeParameter('contractorId', i);
1215
+ responseData = await this.helpers.httpRequest({
1216
+ method: 'POST',
1217
+ url: `${baseUrl}/api/v1/solicitudes-mantenimiento/${requestId}/asignar-contratista`,
1218
+ body: { contractor_id: contractorId },
1219
+ json: true,
1220
+ });
1221
+ }
776
1222
  }
777
1223
  // ============================================
778
1224
  // CONTRACTOR RESOURCE
@@ -781,7 +1227,25 @@ class AivenceRealty {
781
1227
  if (operation === 'list') {
782
1228
  responseData = await this.helpers.httpRequest({
783
1229
  method: 'GET',
784
- url: `${baseUrl}/api/contractors`,
1230
+ url: `${baseUrl}/api/v1/contratistas`,
1231
+ json: true,
1232
+ });
1233
+ }
1234
+ else if (operation === 'get') {
1235
+ const contractorId = this.getNodeParameter('contractorId', i);
1236
+ responseData = await this.helpers.httpRequest({
1237
+ method: 'GET',
1238
+ url: `${baseUrl}/api/v1/contratistas/${contractorId}`,
1239
+ json: true,
1240
+ });
1241
+ }
1242
+ else if (operation === 'create') {
1243
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
1244
+ const body = useJsonInput ? items[i].json : {};
1245
+ responseData = await this.helpers.httpRequest({
1246
+ method: 'POST',
1247
+ url: `${baseUrl}/api/v1/contratistas`,
1248
+ body,
785
1249
  json: true,
786
1250
  });
787
1251
  }
@@ -794,15 +1258,30 @@ class AivenceRealty {
794
1258
  }
795
1259
  }
796
1260
  // ============================================
797
- // MAINTENANCE COST RESOURCE
1261
+ // TENANT RESOURCE
798
1262
  // ============================================
799
- else if (resource === 'maintenanceCost') {
800
- if (operation === 'create') {
1263
+ else if (resource === 'tenant') {
1264
+ if (operation === 'list') {
1265
+ responseData = await this.helpers.httpRequest({
1266
+ method: 'GET',
1267
+ url: `${baseUrl}/api/v1/inquilinos`,
1268
+ json: true,
1269
+ });
1270
+ }
1271
+ else if (operation === 'get') {
1272
+ const tenantId = this.getNodeParameter('tenantId', i);
1273
+ responseData = await this.helpers.httpRequest({
1274
+ method: 'GET',
1275
+ url: `${baseUrl}/api/v1/inquilinos/${tenantId}`,
1276
+ json: true,
1277
+ });
1278
+ }
1279
+ else if (operation === 'create') {
801
1280
  const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
802
1281
  const body = useJsonInput ? items[i].json : {};
803
1282
  responseData = await this.helpers.httpRequest({
804
1283
  method: 'POST',
805
- url: `${baseUrl}/api/maintenance-costs`,
1284
+ url: `${baseUrl}/api/v1/inquilinos`,
806
1285
  body,
807
1286
  json: true,
808
1287
  });
@@ -812,16 +1291,49 @@ class AivenceRealty {
812
1291
  // APPOINTMENT RESOURCE
813
1292
  // ============================================
814
1293
  else if (resource === 'appointment') {
815
- if (operation === 'create') {
1294
+ if (operation === 'list') {
1295
+ responseData = await this.helpers.httpRequest({
1296
+ method: 'GET',
1297
+ url: `${baseUrl}/api/v1/reservas`,
1298
+ json: true,
1299
+ });
1300
+ }
1301
+ else if (operation === 'create') {
816
1302
  const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
817
1303
  const body = useJsonInput ? items[i].json : {};
818
1304
  responseData = await this.helpers.httpRequest({
819
1305
  method: 'POST',
820
- url: `${baseUrl}/api/v1/appointments`,
1306
+ url: `${baseUrl}/api/v1/reservas`,
821
1307
  body,
822
1308
  json: true,
823
1309
  });
824
1310
  }
1311
+ else if (operation === 'get') {
1312
+ const appointmentId = this.getNodeParameter('appointmentId', i);
1313
+ responseData = await this.helpers.httpRequest({
1314
+ method: 'GET',
1315
+ url: `${baseUrl}/api/v1/reservas/${appointmentId}`,
1316
+ json: true,
1317
+ });
1318
+ }
1319
+ else if (operation === 'updateStatus') {
1320
+ const appointmentId = this.getNodeParameter('appointmentId', i);
1321
+ const status = this.getNodeParameter('appointment_status', i);
1322
+ responseData = await this.helpers.httpRequest({
1323
+ method: 'PUT',
1324
+ url: `${baseUrl}/api/v1/reservas/${appointmentId}/estado`,
1325
+ body: { estado: status },
1326
+ json: true,
1327
+ });
1328
+ }
1329
+ else if (operation === 'delete') {
1330
+ const appointmentId = this.getNodeParameter('appointmentId', i);
1331
+ responseData = await this.helpers.httpRequest({
1332
+ method: 'DELETE',
1333
+ url: `${baseUrl}/api/v1/reservas/${appointmentId}`,
1334
+ json: true,
1335
+ });
1336
+ }
825
1337
  }
826
1338
  // Formatear respuesta
827
1339
  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aivencerealtycrm",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",