Skip to content

Commit

Permalink
Merge pull request #270 from navikt/cvToIntegration
Browse files Browse the repository at this point in the history
Added CV classes and custommetadata from nks-integ
  • Loading branch information
annolse authored Dec 6, 2023
2 parents 4977038 + 5526117 commit ca726a4
Show file tree
Hide file tree
Showing 42 changed files with 443 additions and 0 deletions.
29 changes: 29 additions & 0 deletions force-app/cv/classes/CV_Service.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @description
* Service class to retrieve CV via API
*/
public with sharing class CV_Service {
private static final Boolean ER_MANUELL = true;
private static final String BASE_CONFIG = 'CV_API';

/**
* @description: Get CV for a person by person ident
* @author Sara Mohammadi | 06-01-2022
* @param fodselsnummer
* @return CV-Response
**/
public static HttpResponse getCV(String fodselsnummer) {
ApiController apiCtrl = new ApiController();
String serviceName = 'GET_CV';

Map<String, String> pathParamMap = new Map<String, String>{ 'fodselsnummer' => fodselsnummer };
Map<String, String> queryParamMap = new Map<String, String>{ 'erManuell' => String.valueOf(ER_MANUELL) };

apiCtrl.initRequest(BASE_CONFIG, serviceName, pathParamMap);
apiCtrl.addServiceAuthHeader('CV').addHeader('Content-Type', 'application/json');
apiCtrl.setUrlParams(queryParamMap);
apiCtrl.doCallout();

return apiCtrl.getResponse();
}
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/CV_Service.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
21 changes: 21 additions & 0 deletions force-app/cv/classes/CV_ServiceTest.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@IsTest
private with sharing class CV_ServiceTest{
@isTest
static void testGetCV() {
String fodselsnummer = '12345678901';
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());

HttpResponse res = CV_Service.getCV(fodselsnummer);
System.assertEquals(200, res.getStatusCode());
}

private class MockHttpResponseGenerator implements HttpCalloutMock {
public HTTPResponse respond(HTTPRequest req) {
HttpResponse res = new HttpResponse();
res.setBody('{"mockResponse": "success"}');
res.setHeader('Content-Type', 'application/json');
res.setStatusCode(200);
return res;
}
}
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/CV_ServiceTest.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
36 changes: 36 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @description
* CV-wrapper class
*/
public with sharing class CV {
@AuraEnabled
public Datetime sistEndret;
@AuraEnabled
public Boolean synligForArbeidsgiver;
@AuraEnabled
public Boolean sistEndretAvNav;
@AuraEnabled
public String sammendrag;
@AuraEnabled
public List<CV_Arbeidserfaring> arbeidserfaring;
@AuraEnabled
public List<CV_Utdanning> utdanning;
@AuraEnabled
public List<CV_Fagdokumentasjon> fagdokumentasjoner;
@AuraEnabled
public List<CV_Godkjenning> godkjenninger;
@AuraEnabled
public List<CV_AnnenErfaring> annenErfaring;
@AuraEnabled
public List<CV_Forerkort> forerkort;
@AuraEnabled
public List<CV_Kurs> kurs;
@AuraEnabled
public List<CV_Sertifikat> sertifikater;
@AuraEnabled
public List<CV_Sertifikat> andreGodkjenninger;
@AuraEnabled
public List<CV_Sprak> sprak;
@AuraEnabled
public CV_Jobbprofil jobbprofil;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
10 changes: 10 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_AnnenErfaring.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public with sharing class CV_AnnenErfaring {
@AuraEnabled
public String rolle;
@AuraEnabled
public String beskrivelse;
@AuraEnabled
public String fraDato;
@AuraEnabled
public String tilDato;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
4 changes: 4 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Ansettelsesform.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public with sharing class CV_Ansettelsesform {
@AuraEnabled
public String tittel;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
14 changes: 14 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Arbeidserfaring.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public with sharing class CV_Arbeidserfaring {
@AuraEnabled
public String tittel;
@AuraEnabled
public String arbeidsgiver;
@AuraEnabled
public String sted;
@AuraEnabled
public String beskrivelse;
@AuraEnabled
public String fraDato;
@AuraEnabled
public String tilDato;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
4 changes: 4 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Arbeidssted.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public with sharing class CV_Arbeidssted {
@AuraEnabled
public String stedsnavn;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Arbeidssted.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
4 changes: 4 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Arbeidstidsordning.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public with sharing class CV_Arbeidstidsordning {
@AuraEnabled
public String tittel;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
6 changes: 6 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Fagdokumentasjon.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public with sharing class CV_Fagdokumentasjon {
@AuraEnabled
public String tittel;
@AuraEnabled
public String type;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
8 changes: 8 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Forerkort.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public with sharing class CV_Forerkort {
@AuraEnabled
public String klasse;
@AuraEnabled
public Date fraDato;
@AuraEnabled
public Date utloperDato;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Forerkort.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
10 changes: 10 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Godkjenning.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public with sharing class CV_Godkjenning {
@AuraEnabled
public String tittel;
@AuraEnabled
public String utsteder;
@AuraEnabled
public Date gjennomfortDato;
@AuraEnabled
public Date utloperDato;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Godkjenning.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
6 changes: 6 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_HeltidDeltid.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public with sharing class CV_HeltidDeltid {
@AuraEnabled
public Boolean heltid;
@AuraEnabled
public Boolean deltid;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_HeltidDeltid.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
16 changes: 16 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Jobbprofil.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
public with sharing class CV_Jobbprofil {
@AuraEnabled
public Datetime sistEndret;
@AuraEnabled
public List<CV_Yrke> onsketYrke;
@AuraEnabled
public List<CV_Arbeidssted> onsketArbeidssted;
@AuraEnabled
public List<CV_Ansettelsesform> onsketAnsettelsesform;
@AuraEnabled
public List<CV_Arbeidstidsordning> onsketArbeidstidsordning;
@AuraEnabled
public CV_HeltidDeltid heltidDeltid;
@AuraEnabled
public List<CV_Kompetanse> kompetanse;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Jobbprofil.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
4 changes: 4 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Kompetanse.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public with sharing class CV_Kompetanse {
@AuraEnabled
public String tittel;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Kompetanse.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
10 changes: 10 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Kurs.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public with sharing class CV_Kurs {
@AuraEnabled
public String tittel;
@AuraEnabled
public String arrangor;
@AuraEnabled
public String fraDato;
@AuraEnabled
public CV_Kursvarighet varighet;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Kurs.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
6 changes: 6 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Kursvarighet.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public with sharing class CV_Kursvarighet {
@AuraEnabled
public Integer varighet;
@AuraEnabled
public String tidsenhet;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Kursvarighet.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
10 changes: 10 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Sertifikat.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public with sharing class CV_Sertifikat {
@AuraEnabled
public String tittel;
@AuraEnabled
public String utsteder;
@AuraEnabled
public String gjennomfortDato;
@AuraEnabled
public String utloperDato;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Sertifikat.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
8 changes: 8 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Sprak.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public with sharing class CV_Sprak {
@AuraEnabled
public String sprak;
@AuraEnabled
public String muntligNiva;
@AuraEnabled
public String skriftligNiva;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Sprak.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
12 changes: 12 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Utdanning.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public with sharing class CV_Utdanning {
@AuraEnabled
public String tittel;
@AuraEnabled
public String studiested;
@AuraEnabled
public String beskrivelse;
@AuraEnabled
public String fraDato;
@AuraEnabled
public String tilDato;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Utdanning.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
4 changes: 4 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Yrke.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public with sharing class CV_Yrke {
@AuraEnabled
public String tittel;
}
5 changes: 5 additions & 0 deletions force-app/cv/classes/cv-wrappers/CV_Yrke.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<CustomMetadata
xmlns="http://soap.sforce.com/2006/04/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<label>CV API</label>
<protected>false</protected>
<values>
<field>Base_Endpoint_Test__c</field>
<value xsi:nil="true" />
</values>
<values>
<field>Base_Endpoint__c</field>
<value xsi:nil="true" />
</values>
<values>
<field>Named_Credential_Test__c</field>
<value xsi:type="xsd:string">API_GW</value>
</values>
<values>
<field>Named_Credential__c</field>
<value xsi:type="xsd:string">API_GW</value>
</values>
<values>
<field>Salesforce_API__c</field>
<value xsi:type="xsd:boolean">false</value>
</values>
<values>
<field>Use_Gateway__c</field>
<value xsi:type="xsd:boolean">true</value>
</values>
</CustomMetadata>
Loading

0 comments on commit ca726a4

Please sign in to comment.