Help wanted #23

Merged
danieljsummers merged 20 commits from help-wanted into main 2021-09-01 01:16:43 +00:00
4 changed files with 19 additions and 19 deletions
Showing only changes of commit 1753628019 - Show all commits

View File

@ -463,16 +463,16 @@ let allEndpoints = [
subRoute "/citizen" [ subRoute "/citizen" [
GET_HEAD [ GET_HEAD [
routef "/log-on/%s" Citizen.logOn routef "/log-on/%s" Citizen.logOn
routef "/get/%O" Citizen.get routef "/%O" Citizen.get
] ]
DELETE [ route "" Citizen.delete ] DELETE [ route "" Citizen.delete ]
] ]
GET_HEAD [ route "/continent/all" Continent.all ] GET_HEAD [ route "/continents" Continent.all ]
subRoute "/listing" [ subRoute "/listing" [
GET_HEAD [ GET_HEAD [
routef "/%O" Listing.get routef "/%O" Listing.get
route "/search" Listing.search route "/search" Listing.search
routef "/view/%O" Listing.view routef "/%O/view" Listing.view
route "s/mine" Listing.mine route "s/mine" Listing.mine
] ]
POST [ POST [
@ -486,20 +486,20 @@ let allEndpoints = [
GET_HEAD [ GET_HEAD [
route "" Profile.current route "" Profile.current
route "/count" Profile.count route "/count" Profile.count
routef "/get/%O" Profile.get routef "/%O" Profile.get
routef "/view/%O" Profile.view routef "/%O/view" Profile.view
route "/public-search" Profile.publicSearch route "/public-search" Profile.publicSearch
route "/search" Profile.search route "/search" Profile.search
] ]
PATCH [ route "/employment-found" Profile.employmentFound ] PATCH [ route "/employment-found" Profile.employmentFound ]
POST [ route "/save" Profile.save ] POST [ route "" Profile.save ]
] ]
subRoute "/success" [ subRoute "/success" [
GET_HEAD [ GET_HEAD [
routef "/%O" Success.get routef "/%O" Success.get
route "/list" Success.all route "es" Success.all
] ]
POST [ route "/save" Success.save ] POST [ route "" Success.save ]
] ]
] ]
] ]

View File

@ -1,6 +1,6 @@
{ {
"name": "jobs-jobs-jobs", "name": "jobs-jobs-jobs",
"version": "1.9.0", "version": "2.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "jobs-jobs-jobs", "name": "jobs-jobs-jobs",
"version": "1.9.0", "version": "2.0.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

@ -117,7 +117,7 @@ export default {
* @returns The citizen, or an error * @returns The citizen, or an error
*/ */
retrieve: async (id : string, user : LogOnSuccess) : Promise<Citizen | string | undefined> => retrieve: async (id : string, user : LogOnSuccess) : Promise<Citizen | string | undefined> =>
apiResult<Citizen>(await fetch(apiUrl(`citizen/get/${id}`), reqInit('GET', user)), `retrieving citizen ${id}`), apiResult<Citizen>(await fetch(apiUrl(`citizen/${id}`), reqInit('GET', user)), `retrieving citizen ${id}`),
/** /**
* Delete the current citizen's entire Jobs, Jobs, Jobs record * Delete the current citizen's entire Jobs, Jobs, Jobs record
@ -138,7 +138,7 @@ export default {
* @returns All continents, or an error * @returns All continents, or an error
*/ */
all: async () : Promise<Continent[] | string | undefined> => all: async () : Promise<Continent[] | string | undefined> =>
apiResult<Continent[]>(await fetch(apiUrl('continent/all'), { method: 'GET' }), 'retrieving continents') apiResult<Continent[]>(await fetch(apiUrl('continents'), { method: 'GET' }), 'retrieving continents')
}, },
/** API functions for job listings */ /** API functions for job listings */
@ -182,7 +182,7 @@ export default {
* @returns The job listing (if found), undefined (if not found), or an error string * @returns The job listing (if found), undefined (if not found), or an error string
*/ */
retreiveForView: async (id : string, user : LogOnSuccess) : Promise<ListingForView | undefined | string> => retreiveForView: async (id : string, user : LogOnSuccess) : Promise<ListingForView | undefined | string> =>
apiResult<ListingForView>(await fetch(apiUrl(`listing/view/${id}`), reqInit('GET', user)), apiResult<ListingForView>(await fetch(apiUrl(`listing/${id}/view`), reqInit('GET', user)),
'retrieving job listing'), 'retrieving job listing'),
/** /**
@ -253,7 +253,7 @@ export default {
* @returns The profile (if found), undefined (if not found), or an error string * @returns The profile (if found), undefined (if not found), or an error string
*/ */
retreive: async (id : string | undefined, user : LogOnSuccess) : Promise<Profile | undefined | string> => { retreive: async (id : string | undefined, user : LogOnSuccess) : Promise<Profile | undefined | string> => {
const url = id ? `profile/get/${id}` : 'profile' const url = id ? `profile/${id}` : 'profile'
const resp = await fetch(apiUrl(url), reqInit('GET', user)) const resp = await fetch(apiUrl(url), reqInit('GET', user))
if (resp.status === 200) return await resp.json() as Profile if (resp.status === 200) return await resp.json() as Profile
if (resp.status !== 204) return `Error retrieving profile - ${await resp.text()}` if (resp.status !== 204) return `Error retrieving profile - ${await resp.text()}`
@ -267,7 +267,7 @@ export default {
* @returns The profile (if found), undefined (if not found), or an error string * @returns The profile (if found), undefined (if not found), or an error string
*/ */
retreiveForView: async (id : string, user : LogOnSuccess) : Promise<ProfileForView | string | undefined> => retreiveForView: async (id : string, user : LogOnSuccess) : Promise<ProfileForView | string | undefined> =>
apiResult<ProfileForView>(await fetch(apiUrl(`profile/view/${id}`), reqInit('GET', user)), 'retrieving profile'), apiResult<ProfileForView>(await fetch(apiUrl(`profile/${id}/view`), reqInit('GET', user)), 'retrieving profile'),
/** /**
* Save a user's profile data * Save a user's profile data
@ -277,7 +277,7 @@ export default {
* @returns True if the save was successful, an error string if not * @returns True if the save was successful, an error string if not
*/ */
save: async (data : ProfileForm, user : LogOnSuccess) : Promise<boolean | string> => save: async (data : ProfileForm, user : LogOnSuccess) : Promise<boolean | string> =>
apiSend(await fetch(apiUrl('profile/save'), reqInit('POST', user, data)), 'saving profile'), apiSend(await fetch(apiUrl('profile'), reqInit('POST', user, data)), 'saving profile'),
/** /**
* Search for profiles using the given parameters * Search for profiles using the given parameters
@ -331,7 +331,7 @@ export default {
* @returns All success stories (if any exist), undefined (if none exist), or an error * @returns All success stories (if any exist), undefined (if none exist), or an error
*/ */
list: async (user : LogOnSuccess) : Promise<StoryEntry[] | string | undefined> => list: async (user : LogOnSuccess) : Promise<StoryEntry[] | string | undefined> =>
apiResult<StoryEntry[]>(await fetch(apiUrl('success/list'), reqInit('GET', user)), 'retrieving success stories'), apiResult<StoryEntry[]>(await fetch(apiUrl('successes'), reqInit('GET', user)), 'retrieving success stories'),
/** /**
* Retrieve a success story by its ID * Retrieve a success story by its ID
@ -351,7 +351,7 @@ export default {
* @returns True if successful, an error string if not * @returns True if successful, an error string if not
*/ */
save: async (data : StoryForm, user : LogOnSuccess) : Promise<boolean | string> => save: async (data : StoryForm, user : LogOnSuccess) : Promise<boolean | string> =>
apiSend(await fetch(apiUrl('success/save'), reqInit('POST', user, data)), 'saving success story') apiSend(await fetch(apiUrl('success'), reqInit('POST', user, data)), 'saving success story')
} }
} }