n8n-nodes-aivencerealtycrm 1.2.0 → 1.3.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,85 @@ 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'],
1044
+ },
1045
+ },
1046
+ default: 10,
1047
+ description: 'Número máximo de resultados (1-100)',
1048
+ },
831
1049
  // Contractor Create: JSON from previous node
832
1050
  {
833
1051
  displayName: 'Modo de entrada',
@@ -1306,9 +1524,26 @@ class AivenceRealty {
1306
1524
  // ============================================
1307
1525
  else if (resource === 'maintenanceRequest') {
1308
1526
  if (operation === 'list') {
1527
+ const propertyIdFilter = this.getNodeParameter('propertyIdFilter', i, '');
1528
+ const statusFilter = this.getNodeParameter('statusFilter', i, '');
1529
+ const tenantIdFilter = this.getNodeParameter('tenantIdFilter', i, '');
1530
+ const priorityFilter = this.getNodeParameter('priorityFilter', i, '');
1531
+ const limitMaintenance = this.getNodeParameter('limitMaintenance', i, 10);
1532
+ const queryParams = [];
1533
+ if (propertyIdFilter)
1534
+ queryParams.push(`property_id=${encodeURIComponent(propertyIdFilter)}`);
1535
+ if (statusFilter)
1536
+ queryParams.push(`status=${encodeURIComponent(statusFilter)}`);
1537
+ if (tenantIdFilter)
1538
+ queryParams.push(`tenant_id=${encodeURIComponent(tenantIdFilter)}`);
1539
+ if (priorityFilter)
1540
+ queryParams.push(`priority=${encodeURIComponent(priorityFilter)}`);
1541
+ if (limitMaintenance)
1542
+ queryParams.push(`per_page=${limitMaintenance}`);
1543
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
1309
1544
  responseData = await this.helpers.httpRequest({
1310
1545
  method: 'GET',
1311
- url: `${baseUrl}/api/maintenance-requests`,
1546
+ url: `${baseUrl}/api/maintenance-requests${queryString}`,
1312
1547
  json: true,
1313
1548
  });
1314
1549
  }
@@ -1343,8 +1578,10 @@ class AivenceRealty {
1343
1578
  }
1344
1579
  else if (operation === 'addMessage') {
1345
1580
  const requestId = this.getNodeParameter('requestId', i);
1346
- const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
1347
- const body = useJsonInput ? items[i].json : {};
1581
+ const message = this.getNodeParameter('message', i);
1582
+ const body = {
1583
+ message: message,
1584
+ };
1348
1585
  responseData = await this.helpers.httpRequest({
1349
1586
  method: 'PATCH',
1350
1587
  url: `${baseUrl}/api/maintenance-requests/${requestId}/add-message`,
@@ -1368,9 +1605,25 @@ class AivenceRealty {
1368
1605
  // ============================================
1369
1606
  else if (resource === 'contractor') {
1370
1607
  if (operation === 'list') {
1608
+ const specializationFilter = this.getNodeParameter('specializationFilter', i, '');
1609
+ const availableFilter = this.getNodeParameter('availableFilter', i, true);
1610
+ const cityFilter = this.getNodeParameter('cityFilter', i, '');
1611
+ const ratingMinFilter = this.getNodeParameter('ratingMinFilter', i, 0);
1612
+ const limitContractor = this.getNodeParameter('limitContractor', i, 10);
1613
+ const queryParams = [];
1614
+ if (specializationFilter)
1615
+ queryParams.push(`specialization=${encodeURIComponent(specializationFilter)}`);
1616
+ queryParams.push(`available=${availableFilter}`);
1617
+ if (cityFilter)
1618
+ queryParams.push(`city=${encodeURIComponent(cityFilter)}`);
1619
+ if (ratingMinFilter > 0)
1620
+ queryParams.push(`rating_min=${ratingMinFilter}`);
1621
+ if (limitContractor)
1622
+ queryParams.push(`limit=${limitContractor}`);
1623
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
1371
1624
  responseData = await this.helpers.httpRequest({
1372
1625
  method: 'GET',
1373
- url: `${baseUrl}/api/v1/contratistas`,
1626
+ url: `${baseUrl}/api/contractors${queryString}`,
1374
1627
  json: true,
1375
1628
  });
1376
1629
  }
@@ -1393,9 +1646,14 @@ class AivenceRealty {
1393
1646
  });
1394
1647
  }
1395
1648
  else if (operation === 'getNextAvailable') {
1649
+ const specializationFilter = this.getNodeParameter('specializationFilter', i, '');
1650
+ const queryParams = [];
1651
+ if (specializationFilter)
1652
+ queryParams.push(`category=${encodeURIComponent(specializationFilter)}`);
1653
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
1396
1654
  responseData = await this.helpers.httpRequest({
1397
1655
  method: 'GET',
1398
- url: `${baseUrl}/api/contractors/next-available`,
1656
+ url: `${baseUrl}/api/contractors/next-available${queryString}`,
1399
1657
  json: true,
1400
1658
  });
1401
1659
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aivencerealtycrm",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",