n8n-nodes-aivencerealtycrm 1.2.0 → 1.4.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.
@@ -759,6 +759,145 @@ class AivenceRealty {
759
759
  default: '',
760
760
  description: 'ID del contratista a asignar',
761
761
  },
762
+ // ============================================
763
+ // MAINTENANCE REQUEST LIST FILTERS
764
+ // ============================================
765
+ {
766
+ displayName: 'Property ID Filter',
767
+ name: 'propertyIdFilter',
768
+ type: 'string',
769
+ displayOptions: {
770
+ show: {
771
+ resource: ['maintenanceRequest'],
772
+ operation: ['list'],
773
+ },
774
+ },
775
+ default: '',
776
+ description: 'Filtrar por ID de propiedad',
777
+ placeholder: '={{ $json.property_id }}',
778
+ },
779
+ {
780
+ displayName: 'Status Filter',
781
+ name: 'statusFilter',
782
+ type: 'options',
783
+ options: [
784
+ {
785
+ name: 'All',
786
+ value: '',
787
+ },
788
+ {
789
+ name: 'Pending',
790
+ value: 'pending',
791
+ },
792
+ {
793
+ name: 'In Progress',
794
+ value: 'in_progress',
795
+ },
796
+ {
797
+ name: 'Completed',
798
+ value: 'completed',
799
+ },
800
+ {
801
+ name: 'Cancelled',
802
+ value: 'cancelled',
803
+ },
804
+ ],
805
+ displayOptions: {
806
+ show: {
807
+ resource: ['maintenanceRequest'],
808
+ operation: ['list'],
809
+ },
810
+ },
811
+ default: '',
812
+ description: 'Filtrar por estado',
813
+ },
814
+ {
815
+ displayName: 'Tenant ID Filter',
816
+ name: 'tenantIdFilter',
817
+ type: 'string',
818
+ displayOptions: {
819
+ show: {
820
+ resource: ['maintenanceRequest'],
821
+ operation: ['list'],
822
+ },
823
+ },
824
+ default: '',
825
+ description: 'Filtrar por ID de inquilino',
826
+ placeholder: '={{ $json.tenant_id }}',
827
+ },
828
+ {
829
+ displayName: 'Priority Filter',
830
+ name: 'priorityFilter',
831
+ type: 'options',
832
+ options: [
833
+ {
834
+ name: 'All',
835
+ value: '',
836
+ },
837
+ {
838
+ name: 'Low',
839
+ value: 'low',
840
+ },
841
+ {
842
+ name: 'Medium',
843
+ value: 'medium',
844
+ },
845
+ {
846
+ name: 'High',
847
+ value: 'high',
848
+ },
849
+ {
850
+ name: 'Urgent',
851
+ value: 'urgent',
852
+ },
853
+ ],
854
+ displayOptions: {
855
+ show: {
856
+ resource: ['maintenanceRequest'],
857
+ operation: ['list'],
858
+ },
859
+ },
860
+ default: '',
861
+ description: 'Filtrar por prioridad',
862
+ },
863
+ {
864
+ displayName: 'Limit',
865
+ name: 'limitMaintenance',
866
+ type: 'number',
867
+ typeOptions: {
868
+ minValue: 1,
869
+ maxValue: 100,
870
+ },
871
+ displayOptions: {
872
+ show: {
873
+ resource: ['maintenanceRequest'],
874
+ operation: ['list'],
875
+ },
876
+ },
877
+ default: 10,
878
+ description: 'Número máximo de resultados (1-100)',
879
+ },
880
+ // ============================================
881
+ // ADD MESSAGE FIELD
882
+ // ============================================
883
+ {
884
+ displayName: 'Message',
885
+ name: 'message',
886
+ type: 'string',
887
+ typeOptions: {
888
+ rows: 4,
889
+ },
890
+ required: true,
891
+ displayOptions: {
892
+ show: {
893
+ resource: ['maintenanceRequest'],
894
+ operation: ['addMessage'],
895
+ },
896
+ },
897
+ default: '',
898
+ description: 'Mensaje a agregar a la solicitud',
899
+ placeholder: '={{ $json.mensaje }}',
900
+ },
762
901
  {
763
902
  displayName: 'Modo de entrada',
764
903
  name: 'useJsonInput',
@@ -766,7 +905,7 @@ class AivenceRealty {
766
905
  displayOptions: {
767
906
  show: {
768
907
  resource: ['maintenanceRequest'],
769
- operation: ['create', 'update', 'addMessage'],
908
+ operation: ['create', 'update'],
770
909
  },
771
910
  },
772
911
  default: false,
@@ -828,6 +967,99 @@ class AivenceRealty {
828
967
  default: '',
829
968
  description: 'ID del contractor',
830
969
  },
970
+ // ============================================
971
+ // CONTRACTOR LIST FILTERS
972
+ // ============================================
973
+ {
974
+ displayName: 'Specialization Filter',
975
+ name: 'specializationFilter',
976
+ type: 'string',
977
+ displayOptions: {
978
+ show: {
979
+ resource: ['contractor'],
980
+ operation: ['list', 'getNextAvailable'],
981
+ },
982
+ },
983
+ default: '',
984
+ description: 'Filtrar por especialización (plomería, electricidad, etc.)',
985
+ placeholder: '={{ $json.category }}',
986
+ },
987
+ {
988
+ displayName: 'Available Filter',
989
+ name: 'availableFilter',
990
+ type: 'boolean',
991
+ displayOptions: {
992
+ show: {
993
+ resource: ['contractor'],
994
+ operation: ['list'],
995
+ },
996
+ },
997
+ default: true,
998
+ description: 'Filtrar solo contractors disponibles',
999
+ },
1000
+ {
1001
+ displayName: 'City Filter',
1002
+ name: 'cityFilter',
1003
+ type: 'string',
1004
+ displayOptions: {
1005
+ show: {
1006
+ resource: ['contractor'],
1007
+ operation: ['list'],
1008
+ },
1009
+ },
1010
+ default: '',
1011
+ description: 'Filtrar por ciudad',
1012
+ placeholder: 'Buenos Aires',
1013
+ },
1014
+ {
1015
+ displayName: 'Rating Min Filter',
1016
+ name: 'ratingMinFilter',
1017
+ type: 'number',
1018
+ typeOptions: {
1019
+ minValue: 0,
1020
+ maxValue: 5,
1021
+ numberPrecision: 1,
1022
+ },
1023
+ displayOptions: {
1024
+ show: {
1025
+ resource: ['contractor'],
1026
+ operation: ['list'],
1027
+ },
1028
+ },
1029
+ default: 0,
1030
+ description: 'Calificación mínima (0-5)',
1031
+ },
1032
+ {
1033
+ displayName: 'Limit',
1034
+ name: 'limitContractor',
1035
+ type: 'number',
1036
+ typeOptions: {
1037
+ minValue: 1,
1038
+ maxValue: 100,
1039
+ },
1040
+ displayOptions: {
1041
+ show: {
1042
+ resource: ['contractor'],
1043
+ operation: ['list', 'getNextAvailable'],
1044
+ },
1045
+ },
1046
+ default: 10,
1047
+ description: 'Número máximo de resultados (1-100)',
1048
+ },
1049
+ {
1050
+ displayName: 'Exclude Contractor ID',
1051
+ name: 'excludeContractorId',
1052
+ type: 'string',
1053
+ displayOptions: {
1054
+ show: {
1055
+ resource: ['contractor'],
1056
+ operation: ['getNextAvailable'],
1057
+ },
1058
+ },
1059
+ default: '',
1060
+ description: 'ID del contratista a excluir de los resultados',
1061
+ placeholder: '={{ $json.contractor_id }}',
1062
+ },
831
1063
  // Contractor Create: JSON from previous node
832
1064
  {
833
1065
  displayName: 'Modo de entrada',
@@ -1302,13 +1534,30 @@ class AivenceRealty {
1302
1534
  }
1303
1535
  }
1304
1536
  // ============================================
1305
- // MAINTENANCE REQUEST RESOURCE
1537
+ // MAINTENANCE REQUEST RESOURCE (API Española)
1306
1538
  // ============================================
1307
1539
  else if (resource === 'maintenanceRequest') {
1308
1540
  if (operation === 'list') {
1541
+ const propertyIdFilter = this.getNodeParameter('propertyIdFilter', i, '');
1542
+ const statusFilter = this.getNodeParameter('statusFilter', i, '');
1543
+ const tenantIdFilter = this.getNodeParameter('tenantIdFilter', i, '');
1544
+ const priorityFilter = this.getNodeParameter('priorityFilter', i, '');
1545
+ const limitMaintenance = this.getNodeParameter('limitMaintenance', i, 10);
1546
+ const queryParams = [];
1547
+ if (propertyIdFilter)
1548
+ queryParams.push(`propiedad_id=${encodeURIComponent(propertyIdFilter)}`);
1549
+ if (statusFilter)
1550
+ queryParams.push(`estado=${encodeURIComponent(statusFilter)}`);
1551
+ if (tenantIdFilter)
1552
+ queryParams.push(`inquilino_id=${encodeURIComponent(tenantIdFilter)}`);
1553
+ if (priorityFilter)
1554
+ queryParams.push(`prioridad=${encodeURIComponent(priorityFilter)}`);
1555
+ if (limitMaintenance)
1556
+ queryParams.push(`por_pagina=${limitMaintenance}`);
1557
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
1309
1558
  responseData = await this.helpers.httpRequest({
1310
1559
  method: 'GET',
1311
- url: `${baseUrl}/api/maintenance-requests`,
1560
+ url: `${baseUrl}/api/v1/mantenimiento/solicitudes${queryString}`,
1312
1561
  json: true,
1313
1562
  });
1314
1563
  }
@@ -1316,7 +1565,7 @@ class AivenceRealty {
1316
1565
  const requestId = this.getNodeParameter('requestId', i);
1317
1566
  responseData = await this.helpers.httpRequest({
1318
1567
  method: 'GET',
1319
- url: `${baseUrl}/api/maintenance-requests/${requestId}`,
1568
+ url: `${baseUrl}/api/v1/mantenimiento/solicitudes/${requestId}`,
1320
1569
  json: true,
1321
1570
  });
1322
1571
  }
@@ -1325,7 +1574,7 @@ class AivenceRealty {
1325
1574
  const body = useJsonInput ? items[i].json : {};
1326
1575
  responseData = await this.helpers.httpRequest({
1327
1576
  method: 'POST',
1328
- url: `${baseUrl}/api/maintenance-requests`,
1577
+ url: `${baseUrl}/api/v1/mantenimiento/solicitudes`,
1329
1578
  body,
1330
1579
  json: true,
1331
1580
  });
@@ -1335,19 +1584,23 @@ class AivenceRealty {
1335
1584
  const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
1336
1585
  const body = useJsonInput ? items[i].json : {};
1337
1586
  responseData = await this.helpers.httpRequest({
1338
- method: 'PATCH',
1339
- url: `${baseUrl}/api/maintenance-requests/${requestId}`,
1587
+ method: 'POST',
1588
+ url: `${baseUrl}/api/v1/mantenimiento/solicitudes/${requestId}/confirmar`,
1340
1589
  body,
1341
1590
  json: true,
1342
1591
  });
1343
1592
  }
1344
1593
  else if (operation === 'addMessage') {
1345
1594
  const requestId = this.getNodeParameter('requestId', i);
1346
- const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
1347
- const body = useJsonInput ? items[i].json : {};
1595
+ const message = this.getNodeParameter('message', i);
1596
+ const body = {
1597
+ remitente: 'sistema',
1598
+ mensaje: message,
1599
+ canal: 'interno',
1600
+ };
1348
1601
  responseData = await this.helpers.httpRequest({
1349
- method: 'PATCH',
1350
- url: `${baseUrl}/api/maintenance-requests/${requestId}/add-message`,
1602
+ method: 'POST',
1603
+ url: `${baseUrl}/api/v1/mantenimiento/solicitudes/${requestId}/agregar-mensaje`,
1351
1604
  body,
1352
1605
  json: true,
1353
1606
  });
@@ -1358,7 +1611,7 @@ class AivenceRealty {
1358
1611
  responseData = await this.helpers.httpRequest({
1359
1612
  method: 'POST',
1360
1613
  url: `${baseUrl}/api/v1/solicitudes-mantenimiento/${requestId}/asignar-contratista`,
1361
- body: { contractor_id: contractorId },
1614
+ body: { contratista_id: contractorId },
1362
1615
  json: true,
1363
1616
  });
1364
1617
  }
@@ -1368,9 +1621,25 @@ class AivenceRealty {
1368
1621
  // ============================================
1369
1622
  else if (resource === 'contractor') {
1370
1623
  if (operation === 'list') {
1624
+ const specializationFilter = this.getNodeParameter('specializationFilter', i, '');
1625
+ const availableFilter = this.getNodeParameter('availableFilter', i, true);
1626
+ const cityFilter = this.getNodeParameter('cityFilter', i, '');
1627
+ const ratingMinFilter = this.getNodeParameter('ratingMinFilter', i, 0);
1628
+ const limitContractor = this.getNodeParameter('limitContractor', i, 10);
1629
+ const queryParams = [];
1630
+ if (specializationFilter)
1631
+ queryParams.push(`specialization=${encodeURIComponent(specializationFilter)}`);
1632
+ queryParams.push(`available=${availableFilter}`);
1633
+ if (cityFilter)
1634
+ queryParams.push(`city=${encodeURIComponent(cityFilter)}`);
1635
+ if (ratingMinFilter > 0)
1636
+ queryParams.push(`rating_min=${ratingMinFilter}`);
1637
+ if (limitContractor)
1638
+ queryParams.push(`limit=${limitContractor}`);
1639
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
1371
1640
  responseData = await this.helpers.httpRequest({
1372
1641
  method: 'GET',
1373
- url: `${baseUrl}/api/v1/contratistas`,
1642
+ url: `${baseUrl}/api/contractors${queryString}`,
1374
1643
  json: true,
1375
1644
  });
1376
1645
  }
@@ -1393,9 +1662,20 @@ class AivenceRealty {
1393
1662
  });
1394
1663
  }
1395
1664
  else if (operation === 'getNextAvailable') {
1665
+ const specializationFilter = this.getNodeParameter('specializationFilter', i, '');
1666
+ const excludeContractorId = this.getNodeParameter('excludeContractorId', i, '');
1667
+ const limitContractor = this.getNodeParameter('limitContractor', i, 3);
1668
+ const queryParams = [];
1669
+ if (specializationFilter)
1670
+ queryParams.push(`categoria=${encodeURIComponent(specializationFilter)}`);
1671
+ if (excludeContractorId)
1672
+ queryParams.push(`excluir_id=${encodeURIComponent(excludeContractorId)}`);
1673
+ if (limitContractor)
1674
+ queryParams.push(`limite=${limitContractor}`);
1675
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
1396
1676
  responseData = await this.helpers.httpRequest({
1397
1677
  method: 'GET',
1398
- url: `${baseUrl}/api/contractors/next-available`,
1678
+ url: `${baseUrl}/api/v1/mantenimiento/contratistas/mejor-match${queryString}`,
1399
1679
  json: true,
1400
1680
  });
1401
1681
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aivencerealtycrm",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",