From 175362801909318b336a7f2c5c8ea38569915eb3 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sun, 15 Aug 2021 21:22:26 -0400 Subject: [PATCH] Refine API URLs --- src/JobsJobsJobs/Api/Handlers.fs | 18 +++++++++--------- src/JobsJobsJobs/App/package-lock.json | 2 +- src/JobsJobsJobs/App/package.json | 2 +- src/JobsJobsJobs/App/src/api/index.ts | 16 ++++++++-------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/JobsJobsJobs/Api/Handlers.fs b/src/JobsJobsJobs/Api/Handlers.fs index affe238..555ef1a 100644 --- a/src/JobsJobsJobs/Api/Handlers.fs +++ b/src/JobsJobsJobs/Api/Handlers.fs @@ -463,16 +463,16 @@ let allEndpoints = [ subRoute "/citizen" [ GET_HEAD [ routef "/log-on/%s" Citizen.logOn - routef "/get/%O" Citizen.get + routef "/%O" Citizen.get ] DELETE [ route "" Citizen.delete ] ] - GET_HEAD [ route "/continent/all" Continent.all ] + GET_HEAD [ route "/continents" Continent.all ] subRoute "/listing" [ GET_HEAD [ routef "/%O" Listing.get route "/search" Listing.search - routef "/view/%O" Listing.view + routef "/%O/view" Listing.view route "s/mine" Listing.mine ] POST [ @@ -486,20 +486,20 @@ let allEndpoints = [ GET_HEAD [ route "" Profile.current route "/count" Profile.count - routef "/get/%O" Profile.get - routef "/view/%O" Profile.view + routef "/%O" Profile.get + routef "/%O/view" Profile.view route "/public-search" Profile.publicSearch route "/search" Profile.search ] PATCH [ route "/employment-found" Profile.employmentFound ] - POST [ route "/save" Profile.save ] + POST [ route "" Profile.save ] ] subRoute "/success" [ GET_HEAD [ - routef "/%O" Success.get - route "/list" Success.all + routef "/%O" Success.get + route "es" Success.all ] - POST [ route "/save" Success.save ] + POST [ route "" Success.save ] ] ] ] diff --git a/src/JobsJobsJobs/App/package-lock.json b/src/JobsJobsJobs/App/package-lock.json index df77974..809eb10 100644 --- a/src/JobsJobsJobs/App/package-lock.json +++ b/src/JobsJobsJobs/App/package-lock.json @@ -1,6 +1,6 @@ { "name": "jobs-jobs-jobs", - "version": "1.9.0", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/JobsJobsJobs/App/package.json b/src/JobsJobsJobs/App/package.json index 7d7fac9..d41e50b 100644 --- a/src/JobsJobsJobs/App/package.json +++ b/src/JobsJobsJobs/App/package.json @@ -1,6 +1,6 @@ { "name": "jobs-jobs-jobs", - "version": "1.9.0", + "version": "2.0.0", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/JobsJobsJobs/App/src/api/index.ts b/src/JobsJobsJobs/App/src/api/index.ts index fe76259..0198e50 100644 --- a/src/JobsJobsJobs/App/src/api/index.ts +++ b/src/JobsJobsJobs/App/src/api/index.ts @@ -117,7 +117,7 @@ export default { * @returns The citizen, or an error */ retrieve: async (id : string, user : LogOnSuccess) : Promise => - apiResult(await fetch(apiUrl(`citizen/get/${id}`), reqInit('GET', user)), `retrieving citizen ${id}`), + apiResult(await fetch(apiUrl(`citizen/${id}`), reqInit('GET', user)), `retrieving citizen ${id}`), /** * Delete the current citizen's entire Jobs, Jobs, Jobs record @@ -138,7 +138,7 @@ export default { * @returns All continents, or an error */ all: async () : Promise => - apiResult(await fetch(apiUrl('continent/all'), { method: 'GET' }), 'retrieving continents') + apiResult(await fetch(apiUrl('continents'), { method: 'GET' }), 'retrieving continents') }, /** 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 */ retreiveForView: async (id : string, user : LogOnSuccess) : Promise => - apiResult(await fetch(apiUrl(`listing/view/${id}`), reqInit('GET', user)), + apiResult(await fetch(apiUrl(`listing/${id}/view`), reqInit('GET', user)), 'retrieving job listing'), /** @@ -253,7 +253,7 @@ export default { * @returns The profile (if found), undefined (if not found), or an error string */ retreive: async (id : string | undefined, user : LogOnSuccess) : Promise => { - const url = id ? `profile/get/${id}` : 'profile' + const url = id ? `profile/${id}` : 'profile' const resp = await fetch(apiUrl(url), reqInit('GET', user)) if (resp.status === 200) return await resp.json() as Profile 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 */ retreiveForView: async (id : string, user : LogOnSuccess) : Promise => - apiResult(await fetch(apiUrl(`profile/view/${id}`), reqInit('GET', user)), 'retrieving profile'), + apiResult(await fetch(apiUrl(`profile/${id}/view`), reqInit('GET', user)), 'retrieving profile'), /** * Save a user's profile data @@ -277,7 +277,7 @@ export default { * @returns True if the save was successful, an error string if not */ save: async (data : ProfileForm, user : LogOnSuccess) : Promise => - 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 @@ -331,7 +331,7 @@ export default { * @returns All success stories (if any exist), undefined (if none exist), or an error */ list: async (user : LogOnSuccess) : Promise => - apiResult(await fetch(apiUrl('success/list'), reqInit('GET', user)), 'retrieving success stories'), + apiResult(await fetch(apiUrl('successes'), reqInit('GET', user)), 'retrieving success stories'), /** * Retrieve a success story by its ID @@ -351,7 +351,7 @@ export default { * @returns True if successful, an error string if not */ save: async (data : StoryForm, user : LogOnSuccess) : Promise => - 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') } }