-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added getEmployee method to resolve #14
- Loading branch information
1 parent
2b1cabe
commit 9d20c7f
Showing
7 changed files
with
242 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
## getEmployee(employeeId: string) | ||
|
||
### response | ||
```javascript | ||
{ | ||
Id: '596b6c2e-4ac7-44e9-b1d4-a4299030cb04', | ||
WorldId: 'ad3ec8a4-246e-4abb-84a9-9dbc43bb6ae6', | ||
ClassCertifications: [ | ||
{ | ||
Id: 'adfd4518-2b7f-4f2e-890e-cb55978a0d7c', | ||
PeopleId: '596b6c2e-4ac7-44e9-b1d4-a4299030cb04', | ||
AircraftClassId: '243b9470-6fe5-4084-871d-2fc3fc8b2232', | ||
AircraftClass: [ | ||
{ | ||
Id: '243b9470-6fe5-4084-871d-2fc3fc8b2232', | ||
ShortName: 'SEPL', | ||
Name: 'Single Engine Piston Land', | ||
Order: 1 | ||
} | ||
], | ||
LastValidation: '2021-08-29T02:12:45.287', | ||
Comments: '' | ||
}, | ||
{ | ||
Id: '8e774d4e-a45d-44a1-b6b4-0a123127dee4', | ||
PeopleId: '596b6c2e-4ac7-44e9-b1d4-a4299030cb04', | ||
AircraftClassId: 'b4a35db6-f20a-4320-8f0c-ec9956da11a6', | ||
AircraftClass: [Object], | ||
LastValidation: '2021-08-29T02:53:55.393' | ||
}, | ||
{ | ||
Id: '2c88f3e2-5a63-4db6-a0bb-0af600640600', | ||
PeopleId: '596b6c2e-4ac7-44e9-b1d4-a4299030cb04', | ||
AircraftClassId: '607d854a-18f7-42ae-99f6-63b4b7f07f1a', | ||
AircraftClass: [Object], | ||
LastValidation: '2021-09-01T02:06:40.847' | ||
}, | ||
{ | ||
Id: 'ef4b948d-10e8-4985-a444-16b82d35dc5d', | ||
PeopleId: '596b6c2e-4ac7-44e9-b1d4-a4299030cb04', | ||
AircraftClassId: '3460504f-db41-4ea6-a765-2a6867a2f88d', | ||
AircraftClass: [Object], | ||
LastValidation: '2021-08-30T15:17:15.04' | ||
}, | ||
{ | ||
Id: '36295c8f-fe5a-4e2e-8bf1-f3dea13918ed', | ||
PeopleId: '596b6c2e-4ac7-44e9-b1d4-a4299030cb04', | ||
AircraftClassId: '04422853-db1a-425b-85c8-fdf3fdb54c66', | ||
AircraftClass: [Object], | ||
LastValidation: '2021-09-14T22:35:47.107' | ||
} | ||
], | ||
Pseudo: 'NDBoost', | ||
UserID: 'cdb79871-47af-42e7-8cea-0caaea7ec6e9', | ||
CompanyId: 'c3d8e51d-f2e9-4918-a286-c3f2cd5ab141', | ||
FlightHoursTotalBeforeHiring: 30000, | ||
FlightHoursInCompany: 52.32027138888886, | ||
Weight: 190, | ||
BirthDate: '1981-04-01T00:00:00', | ||
Fatigue: 0, | ||
Punctuality: 0, | ||
Comfort: 0, | ||
Happiness: 0, | ||
CurrentAirportId: '105b84e5-8ae8-4039-a0d3-358883ad29e2', | ||
CurrentAirport: { | ||
Id: '105b84e5-8ae8-4039-a0d3-358883ad29e2', | ||
ICAO: 'KFFZ', | ||
HasNoRunways: false, | ||
TimeOffsetInSec: -25200, | ||
LocalTimeOpenInHoursSinceMidnight: 5, | ||
LocalTimeCloseInHoursSinceMidnight: 23.5, | ||
IATA: 'MSC', | ||
Name: 'Falcon Fld', | ||
State: 'Arizona', | ||
CountryCode: 'K2', | ||
CountryName: 'USA', | ||
City: 'Mesa', | ||
Latitude: 33.460842, | ||
Longitude: -111.728325, | ||
Elevation: 1377.99, | ||
HasLandRunway: true, | ||
HasWaterRunway: false, | ||
HasHelipad: false, | ||
Size: 2, | ||
TransitionAltitude: 18000, | ||
IsNotInVanillaFSX: false, | ||
IsNotInVanillaP3D: false, | ||
IsNotInVanillaXPLANE: false, | ||
IsNotInVanillaFS2020: false, | ||
IsClosed: false, | ||
IsValid: true, | ||
MagVar: 12, | ||
IsAddon: false, | ||
RandomSeed: 908588882, | ||
LastRandomSeedGeneration: '2022-01-29T12:02:07.223', | ||
IsMilitary: false, | ||
HasLights: true, | ||
AirportSource: 0, | ||
LastVeryShortRequestDate: '2020-11-02T23:07:57.193', | ||
LastSmallTripRequestDate: '2020-12-06T18:35:59.587', | ||
LastMediumTripRequestDate: '2020-11-17T15:21:44.947', | ||
LastShortHaulRequestDate: '2021-01-02T00:25:32', | ||
LastMediumHaulRequestDate: '2020-11-11T20:53:58.133', | ||
LastLongHaulRequestDate: '2020-10-21T13:42:05.273', | ||
DisplayName: 'KFFZ (Falcon Fld)', | ||
UTCTimeOpenInHoursSinceMidnight: 12, | ||
UTCTimeCloseInHoursSinceMidnight: 30.5 | ||
}, | ||
HomeAirportId: '105b84e5-8ae8-4039-a0d3-358883ad29e2', | ||
HomeAirport: { | ||
Id: '105b84e5-8ae8-4039-a0d3-358883ad29e2', | ||
ICAO: 'KFFZ', | ||
HasNoRunways: false, | ||
TimeOffsetInSec: -25200, | ||
LocalTimeOpenInHoursSinceMidnight: 5, | ||
LocalTimeCloseInHoursSinceMidnight: 23.5, | ||
IATA: 'MSC', | ||
Name: 'Falcon Fld', | ||
State: 'Arizona', | ||
CountryCode: 'K2', | ||
CountryName: 'USA', | ||
City: 'Mesa', | ||
Latitude: 33.460842, | ||
Longitude: -111.728325, | ||
Elevation: 1377.99, | ||
HasLandRunway: true, | ||
HasWaterRunway: false, | ||
HasHelipad: false, | ||
Size: 2, | ||
TransitionAltitude: 18000, | ||
IsNotInVanillaFSX: false, | ||
IsNotInVanillaP3D: false, | ||
IsNotInVanillaXPLANE: false, | ||
IsNotInVanillaFS2020: false, | ||
IsClosed: false, | ||
IsValid: true, | ||
MagVar: 12, | ||
IsAddon: false, | ||
RandomSeed: 908588882, | ||
LastRandomSeedGeneration: '2022-01-29T12:02:07.223', | ||
IsMilitary: false, | ||
HasLights: true, | ||
AirportSource: 0, | ||
LastVeryShortRequestDate: '2020-11-02T23:07:57.193', | ||
LastSmallTripRequestDate: '2020-12-06T18:35:59.587', | ||
LastMediumTripRequestDate: '2020-11-17T15:21:44.947', | ||
LastShortHaulRequestDate: '2021-01-02T00:25:32', | ||
LastMediumHaulRequestDate: '2020-11-11T20:53:58.133', | ||
LastLongHaulRequestDate: '2020-10-21T13:42:05.273', | ||
DisplayName: 'KFFZ (Falcon Fld)', | ||
UTCTimeOpenInHoursSinceMidnight: 12, | ||
UTCTimeCloseInHoursSinceMidnight: 30.5 | ||
}, | ||
PerFlightHourWages: 0, | ||
WeeklyGarantedSalary: 0, | ||
PerFlightHourSalary: 0, | ||
Category: 1, | ||
Status: 0, | ||
LastStatusChange: '2022-01-25T14:57:20.837', | ||
FlightDutyStart: '2021-08-29T02:35:50.317', | ||
CurrentTotalFlightHoursInDuty: 52.32027138888886, | ||
AvatarImageName: 'male\\avatarm15.png', | ||
IsOnline: false, | ||
FlightDutyEnd: '2021-08-29T16:35:50.317', | ||
FlightHoursGrandTotal: 30052.32027138889 | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import onAirRequest, { PeopleResponse } from './onAirRequest'; | ||
import { People } from '../types'; | ||
import { uuid4 } from '../utils'; | ||
|
||
export const getEmployee = async (employeeId: string, apiKey: string, world: string): Promise<People> => { | ||
if (!uuid4.test(employeeId) ) { | ||
throw new Error('People ID is incorrect! It should be a 36 character UUID'); | ||
} | ||
|
||
try { | ||
const response = await onAirRequest<PeopleResponse>( | ||
`https://${world}.onair.company/api/v1/employee/${employeeId}`, | ||
apiKey | ||
); | ||
|
||
if (typeof response.data.Content !== 'undefined') { | ||
return response.data.Content as People; | ||
} else { | ||
throw new Error(response.data.Error ? response.data.Error : `People ID ${employeeId} not found`); | ||
} | ||
} catch (e) { | ||
throw new Error(e.message); | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters