@csmart/ngc-smart-core 1.13.7 → 1.13.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.
@@ -613,40 +613,41 @@ class SmartStaffOffenderOptionsService {
613
613
  return;
614
614
  }
615
615
  if (jsonObject instanceof Array) {
616
- jsonObject.forEach(obj => {
616
+ jsonObject.forEach((obj) => {
617
617
  this.convertEmptyToNull(obj);
618
618
  });
619
619
  }
620
620
  const keys = Object.keys(jsonObject);
621
- keys.forEach(key => {
621
+ keys.forEach((key) => {
622
622
  if (typeof jsonObject[key] === 'object') {
623
623
  this.convertEmptyToNull(jsonObject[key]);
624
624
  }
625
- else if (typeof jsonObject[key] === 'string' && jsonObject[key].trim() === '') {
625
+ else if (typeof jsonObject[key] === 'string' &&
626
+ jsonObject[key].trim() === '') {
626
627
  jsonObject[key] = null;
627
628
  }
628
629
  });
629
630
  }
630
631
  getGraphQueryData(queryName, queryString) {
631
- return this.http
632
- .post(this.serviceApiUrl, { query: queryString })
633
- .pipe(map(({ data }) => {
632
+ return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
634
633
  return data[queryName];
635
634
  }));
636
635
  }
637
636
  getOffenderListOptions() {
638
- const queryName = 'findOffenderListOptions';
639
- const queryString = `{
640
- ${queryName} {
641
- data {
642
- offenderListOptionId
637
+ const queryString = `{findOffenderListOptions(input:{
638
+ where:{
639
+ deactivatedDate: null
640
+ }
641
+ }){
642
+ data{
643
+ offenderListOptionId
643
644
  name
644
645
  serviceApiFieldName
645
- }
646
- message
647
646
  }
648
- }`;
649
- return this.getGraphQueryData(queryName, queryString);
647
+ } }`;
648
+ return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
649
+ return data['findOffenderListOptions'];
650
+ }));
650
651
  }
651
652
  getStaffOffenderListOptions(staffId) {
652
653
  const queryString = `{findStaffOffenderListOptions(input:{
@@ -658,13 +659,12 @@ class SmartStaffOffenderOptionsService {
658
659
  offenderListOptionId
659
660
  }
660
661
  } }`;
661
- return this.http
662
- .post(this.serviceApiUrl, { query: queryString })
663
- .pipe(map(({ data }) => {
662
+ return this.http.post(this.serviceApiUrl, { query: queryString }).pipe(map(({ data }) => {
664
663
  return data.findStaffOffenderListOptions.data;
665
664
  }));
666
665
  }
667
666
  saveStaffOffenderListOptionsData(dataToSave) {
667
+ //}: Observable<any> {
668
668
  // this.convertEmptyToNull(dataToSave);
669
669
  const queryName = 'upsertStaffOffenderListOption';
670
670
  const query = `mutation {
@@ -672,9 +672,7 @@ class SmartStaffOffenderOptionsService {
672
672
  message
673
673
  }
674
674
  }`;
675
- ;
676
- return this.http
677
- .post(this.serviceApiUrl, { query });
675
+ return this.http.post(this.serviceApiUrl, { query });
678
676
  /*.pipe(
679
677
  map(({ data }) => {
680
678
  return data[queryName];
@@ -687,7 +685,7 @@ class SmartStaffOffenderOptionsService {
687
685
  }
688
686
  if (obj instanceof Array) {
689
687
  result += ' [';
690
- obj.forEach(eObj => {
688
+ obj.forEach((eObj) => {
691
689
  result += this.convertToString(eObj);
692
690
  });
693
691
  result += '],';