diff --git a/templates/ords-remix-jwt-sample/Database/Modules/concert_app.euser.v2.sql b/templates/ords-remix-jwt-sample/Database/Modules/concert_app.euser.v2.sql new file mode 100644 index 0000000..f621175 --- /dev/null +++ b/templates/ords-remix-jwt-sample/Database/Modules/concert_app.euser.v2.sql @@ -0,0 +1,399 @@ +-- Copyright (c) 2024, Oracle and/or its affiliates. +-- All rights reserved +-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +-- Generated by ORDS REST Data Services 24.2.3.r2011847 +-- Schema: CONCERT_SAMPLE_APP Date: Mon Aug 26 10:21:44 2024 +-- + +BEGIN + ORDS.ENABLE_SCHEMA( + p_enabled => TRUE, + p_schema => 'CONCERT_SAMPLE_APP', + p_url_mapping_type => 'BASE_PATH', + p_url_mapping_pattern => 'concert_sample_app', + p_auto_rest_auth => FALSE); + + ORDS.DEFINE_MODULE( + p_module_name => 'concert_app.euser.v2', + p_base_path => '/euser/v2/', + p_items_per_page => 0, + p_status => 'PUBLISHED', + p_comments => 'end user APIs Version 1'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artists/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artists/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT + A.ARTIST_ID, + A.NAME, + A.DESCRIPTION, + LISTAGG(MG.NAME, '', '') WITHIN GROUP( + ORDER BY + MG.NAME + ) AS MUSIC_GENRES + FROM + ARTISTS A + LEFT JOIN ARTIST_CLASSIFICATIONS AA ON A.ARTIST_ID = AA.ARTIST_ID + LEFT JOIN MUSIC_GENRES MG ON AA.MUSIC_GENRE_ID = MG.MUSIC_GENRE_ID + GROUP BY + A.ARTIST_ID, + A.NAME, + A.DESCRIPTION + ORDER BY + A.NAME'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artist/:id', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artist/:id', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT + A.ARTIST_ID, + A.NAME, + A.DESCRIPTION, + A.BIO, + LISTAGG(MG.NAME, '', '') WITHIN GROUP( + ORDER BY + MG.NAME + ) AS MUSIC_GENRES + FROM + ARTISTS A + LEFT JOIN ARTIST_CLASSIFICATIONS AA ON A.ARTIST_ID = AA.ARTIST_ID + LEFT JOIN MUSIC_GENRES MG ON AA.MUSIC_GENRE_ID = MG.MUSIC_GENRE_ID + WHERE A.ARTIST_ID = :id + GROUP BY + A.ARTIST_ID, + A.NAME, + A.DESCRIPTION, + A.BIO + ORDER BY + A.NAME'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artists/:artist_name', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artists/:artist_name', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM ARTISTS + WHERE NAME LIKE ''%'' || :artist_name || ''%'''); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venues/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venues/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM VENUES ORDER BY NAME DESC'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venues/:venue_name', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venues/:venue_name', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM VENUES + WHERE NAME LIKE ''%'' || :venue_name || ''%'''); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'cities/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Cities resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'cities/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT C.CITY_ID, C.NAME, C.DESCRIPTION, COUNT(E.EVENT_ID) AS EVENT_COUNT + FROM CITIES C + LEFT JOIN VENUES V ON C.CITY_ID = V.CITY_ID + LEFT JOIN EVENTS E ON V.VENUE_ID = E.VENUE_ID + GROUP BY C.CITY_ID, C.NAME, C.DESCRIPTION + ORDER BY EVENT_COUNT DESC'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venues_by_city/:city_name', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venues_by_city/:city_name', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT V.* + FROM VENUES V JOIN CITIES C + ON V.CITY_ID = C.CITY_ID + WHERE C.CITY_NAME = :CITY_NAME + '); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venue/:venue_id', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'venue/:venue_id', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM VENUES WHERE VENUE_ID = :VENUE_ID'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'events/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'events/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM EVENTS'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'events/:event_name', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Events for the homepage'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'events/:event_name', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM EVENTS_VIEW + WHERE ARTIST_NAME LIKE ''%'' || :event_name || ''%'' + ORDER BY EVENT_DATE ASC'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'event/:event_id', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Artist resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'event/:event_id', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM EVENTS_VIEW WHERE EVENT_ID = :event_id'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'landing_page_global_stats/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Banner stats for end users.'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'landing_page_global_stats/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM BANNER_VIEW'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'eventsHome/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Events for the homepage'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'eventsHome/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM EVENTS_VIEW ORDER BY EVENT_DATE ASC'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artistEvents/:id', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Events for a particular Artist.'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'artistEvents/:id', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM EVENTS_VIEW WHERE ARTIST_ID = :id ORDER BY EVENT_DATE ASC'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'cityEvents/:cityName', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Events for a particular City.'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'cityEvents/:cityName', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM EVENTS_VIEW WHERE CITY_NAME=:cityName ORDER BY EVENT_DATE ASC'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'eventStatus/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => 'Event status resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'eventStatus/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM EVENT_STATUS'); + + ORDS.DEFINE_TEMPLATE( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'musicGenres/', + p_priority => 0, + p_etag_type => 'HASH', + p_etag_query => NULL, + p_comments => ' music genres resource for end users'); + + ORDS.DEFINE_HANDLER( + p_module_name => 'concert_app.euser.v2', + p_pattern => 'musicGenres/', + p_method => 'GET', + p_source_type => 'json/collection', + p_items_per_page => 10, + p_mimes_allowed => NULL, + p_comments => NULL, + p_source => +'SELECT * FROM MUSIC_GENRES'); + +COMMIT; + +END; \ No newline at end of file diff --git a/templates/ords-remix-jwt-sample/Database/Modules/concert_app.euser.v1.sql b/templates/ords-remix-jwt-sample/Database/Modules/concert_app_euser.v1.sql similarity index 100% rename from templates/ords-remix-jwt-sample/Database/Modules/concert_app.euser.v1.sql rename to templates/ords-remix-jwt-sample/Database/Modules/concert_app_euser.v1.sql diff --git a/templates/ords-remix-jwt-sample/app/root.tsx b/templates/ords-remix-jwt-sample/app/root.tsx index 23c3041..9f0b814 100644 --- a/templates/ords-remix-jwt-sample/app/root.tsx +++ b/templates/ords-remix-jwt-sample/app/root.tsx @@ -30,7 +30,6 @@ import { } from './utils/auth.server'; import NavBar from './components/navbar/NavBar'; import { - BASIC_SCHEMA_AUTH, CITIES_ENDPOINT, } from './routes/constants/index.server'; import TooltipButton from './components/tooltips/TooltipButton'; @@ -42,12 +41,12 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { const userProfile = await auth.isAuthenticated(request); const profile = userProfile?.profile || null; const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; - const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS); + const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS!); if (cities.items.length === 0) { const errorMessage = 'The cities endpoint has no elements. Review your database configuration and try again.'; throw new Response(errorMessage, { diff --git a/templates/ords-remix-jwt-sample/app/routes/artists.$id.tsx b/templates/ords-remix-jwt-sample/app/routes/artists.$id.tsx index 3c8b3db..17867cc 100644 --- a/templates/ords-remix-jwt-sample/app/routes/artists.$id.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/artists.$id.tsx @@ -22,7 +22,6 @@ import { ARTISTS_ENDPOINT, ARTIST_ENDPOINT, ARTIST_EVENT_ENDPOINT, - BASIC_SCHEMA_AUTH, CITIES_ENDPOINT, LIKED_ARTIST_ENDPOINT, } from './constants/index.server'; @@ -87,13 +86,13 @@ export const loader = async ({ const userProfile = await auth.isAuthenticated(request); const profile = userProfile?.profile || null; const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; const { id: artistID } = params; let likedArtist = false; - const artist = await ORDSFetcher(`${ARTIST_ENDPOINT}/${artistID}`, USER_CREDENTIALS) as ORDSResponse; + const artist = await ORDSFetcher(`${ARTIST_ENDPOINT}/${artistID}`, USER_CREDENTIALS!) as ORDSResponse; if (artist.items.length === 0) { const errorMessage = 'The Artist you were looking for does not exist, might have been removed or had its id changed.'; throw new Response(errorMessage, { @@ -101,12 +100,12 @@ export const loader = async ({ statusText: 'Not Found', } as ErrorResponse); } - const artistEvents = await ORDSFetcher(`${ARTIST_EVENT_ENDPOINT}/${artistID}`, USER_CREDENTIALS); - const similarArtists = await ORDSFetcher(ARTISTS_ENDPOINT, USER_CREDENTIALS); - const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS); + const artistEvents = await ORDSFetcher(`${ARTIST_EVENT_ENDPOINT}/${artistID}`, USER_CREDENTIALS!); + const similarArtists = await ORDSFetcher(ARTISTS_ENDPOINT, USER_CREDENTIALS!); + const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS!); if (profile) { const userID = profile.id; - const userLikedArtist = await ORDSFetcher(`${LIKED_ARTIST_ENDPOINT}/${userID}/${artistID}`, USER_CREDENTIALS); + const userLikedArtist = await ORDSFetcher(`${LIKED_ARTIST_ENDPOINT}/${userID}/${artistID}`, USER_CREDENTIALS!); likedArtist = userLikedArtist.likedartist === 1; } return json({ diff --git a/templates/ords-remix-jwt-sample/app/routes/concerts.$concertID.tsx b/templates/ords-remix-jwt-sample/app/routes/concerts.$concertID.tsx index a1de00a..dfe2619 100644 --- a/templates/ords-remix-jwt-sample/app/routes/concerts.$concertID.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/concerts.$concertID.tsx @@ -29,7 +29,6 @@ import ConcertDetails from '../components/concerts/ConcertDetails'; import { EVENT_ENDPOINT, LIKED_EVENT_ENDPOINT, - BASIC_SCHEMA_AUTH, } from './constants/index.server'; import { UserActions } from '../utils/UserActions'; import ORDSFetcher from '../utils/ORDSFetcher'; @@ -93,12 +92,12 @@ export const loader = async ({ const userProfile = await auth.isAuthenticated(request); const profile = userProfile?.profile || null; const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; const { concertID } = params; - const concert = await ORDSFetcher(`${EVENT_ENDPOINT}/${concertID}`, USER_CREDENTIALS) as ORDSResponse; + const concert = await ORDSFetcher(`${EVENT_ENDPOINT}/${concertID}`, USER_CREDENTIALS!) as ORDSResponse; if (concert.items.length === 0) { const errorMessage = 'The Concert you were looking for does not exist, might have been removed or had its id changed.'; throw new Response(errorMessage, { @@ -109,7 +108,7 @@ export const loader = async ({ let likedConcert = false; if (profile !== null) { const userID = profile.id; - const userLikedConcert = await ORDSFetcher(`${LIKED_EVENT_ENDPOINT}/${userID}/${concertID}`, USER_CREDENTIALS); + const userLikedConcert = await ORDSFetcher(`${LIKED_EVENT_ENDPOINT}/${userID}/${concertID}`, USER_CREDENTIALS!); likedConcert = userLikedConcert.likedevent === 1; } diff --git a/templates/ords-remix-jwt-sample/app/routes/home.tsx b/templates/ords-remix-jwt-sample/app/routes/home.tsx index ace0f9a..a8fd2a0 100644 --- a/templates/ords-remix-jwt-sample/app/routes/home.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/home.tsx @@ -23,7 +23,6 @@ import { } from '../utils/auth.server'; import { STATS_ENDPOINT, - BASIC_SCHEMA_AUTH, EVENTS_ENDPOINT, ARTISTS_ENDPOINT, CONCERTS_BY_CITY_ENDPOINT, @@ -43,7 +42,7 @@ import featureDescriptions from '../utils/ORDSFeaturesDescription'; export const loader = async ({ request }: LoaderFunctionArgs) => { const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; @@ -51,9 +50,9 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { const hasCityName = searchParams.has('cityName'); const cityName = searchParams.get('cityName'); const eventsQuery = hasCityName ? `${CONCERTS_BY_CITY_ENDPOINT}/${cityName}` : EVENTS_ENDPOINT; - const stats = await ORDSFetcher(STATS_ENDPOINT, USER_CREDENTIALS); - const events = await ORDSFetcher(eventsQuery, USER_CREDENTIALS); - const artists = await ORDSFetcher(ARTISTS_ENDPOINT, USER_CREDENTIALS); + const stats = await ORDSFetcher(STATS_ENDPOINT, USER_CREDENTIALS!); + const events = await ORDSFetcher(eventsQuery, USER_CREDENTIALS!); + const artists = await ORDSFetcher(ARTISTS_ENDPOINT, USER_CREDENTIALS!); return json({ error, stats, diff --git a/templates/ords-remix-jwt-sample/app/routes/resources.artists.tsx b/templates/ords-remix-jwt-sample/app/routes/resources.artists.tsx index 4d62804..f307058 100644 --- a/templates/ords-remix-jwt-sample/app/routes/resources.artists.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/resources.artists.tsx @@ -15,7 +15,6 @@ import { } from '~/utils/auth.server'; import { ARTISTS_ENDPOINT, - BASIC_SCHEMA_AUTH, } from './constants/index.server'; import ORDSFetcher from '../utils/ORDSFetcher'; @@ -29,11 +28,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { artistsURL.searchParams.append('limit', limit.toString()); const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; - const artists = await ORDSFetcher(artistsURL, USER_CREDENTIALS); + const artists = await ORDSFetcher(artistsURL, USER_CREDENTIALS!); return json({ error, artists, diff --git a/templates/ords-remix-jwt-sample/app/routes/resources.cities.tsx b/templates/ords-remix-jwt-sample/app/routes/resources.cities.tsx index 8301287..9fc431f 100644 --- a/templates/ords-remix-jwt-sample/app/routes/resources.cities.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/resources.cities.tsx @@ -15,7 +15,6 @@ import { } from '~/utils/auth.server'; import { CITIES_ENDPOINT, - BASIC_SCHEMA_AUTH, } from './constants/index.server'; import ORDSFetcher from '../utils/ORDSFetcher'; @@ -29,11 +28,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { citiesURL.searchParams.append('limit', limit.toString()); const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; - const cities = await ORDSFetcher(citiesURL, USER_CREDENTIALS); + const cities = await ORDSFetcher(citiesURL, USER_CREDENTIALS!); return json({ error, cities, diff --git a/templates/ords-remix-jwt-sample/app/routes/resources.concerts.tsx b/templates/ords-remix-jwt-sample/app/routes/resources.concerts.tsx index 27f02ab..8c1994a 100644 --- a/templates/ords-remix-jwt-sample/app/routes/resources.concerts.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/resources.concerts.tsx @@ -15,7 +15,6 @@ import { } from '~/utils/auth.server'; import { EVENTS_ENDPOINT, - BASIC_SCHEMA_AUTH, CONCERTS_BY_CITY_ENDPOINT, } from './constants/index.server'; import ORDSFetcher from '../utils/ORDSFetcher'; @@ -33,11 +32,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { eventsURL.searchParams.append('limit', limit.toString()); const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; - const events = await ORDSFetcher(eventsURL, USER_CREDENTIALS); + const events = await ORDSFetcher(eventsURL, USER_CREDENTIALS!); return json({ error, events, diff --git a/templates/ords-remix-jwt-sample/app/routes/resources.musicGenres.tsx b/templates/ords-remix-jwt-sample/app/routes/resources.musicGenres.tsx index 633c50b..c17f99d 100644 --- a/templates/ords-remix-jwt-sample/app/routes/resources.musicGenres.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/resources.musicGenres.tsx @@ -14,7 +14,6 @@ import { getSession, } from '~/utils/auth.server'; import { - BASIC_SCHEMA_AUTH, MUSIC_GENRES_ENDPOINT, } from './constants/index.server'; import ORDSFetcher from '../utils/ORDSFetcher'; @@ -31,13 +30,13 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { musicGenresURL.searchParams.append('limit', limit.toString()); const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; const musicGenres = await ORDSFetcher( musicGenresURL, - USER_CREDENTIALS, + USER_CREDENTIALS!, ) as ORDSResponse; return json({ error, diff --git a/templates/ords-remix-jwt-sample/app/routes/resources.venues.tsx b/templates/ords-remix-jwt-sample/app/routes/resources.venues.tsx index 98f5262..d82c090 100644 --- a/templates/ords-remix-jwt-sample/app/routes/resources.venues.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/resources.venues.tsx @@ -15,7 +15,6 @@ import { } from '~/utils/auth.server'; import { VENUES_ENDPOINT, - BASIC_SCHEMA_AUTH, } from './constants/index.server'; import ORDSFetcher from '../utils/ORDSFetcher'; import ORDSResponse from '../models/ORDSResponse'; @@ -31,11 +30,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { venuesURL.searchParams.append('limit', limit.toString()); const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; - const venues = await ORDSFetcher(venuesURL, USER_CREDENTIALS) as ORDSResponse; + const venues = await ORDSFetcher(venuesURL, USER_CREDENTIALS!) as ORDSResponse; return json({ error, venues, diff --git a/templates/ords-remix-jwt-sample/app/routes/search.$searchKind.$searchParam.tsx b/templates/ords-remix-jwt-sample/app/routes/search.$searchKind.$searchParam.tsx index b7c72cf..f497299 100644 --- a/templates/ords-remix-jwt-sample/app/routes/search.$searchKind.$searchParam.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/search.$searchKind.$searchParam.tsx @@ -11,7 +11,6 @@ import type { import { json } from '@remix-run/node'; import { auth } from '~/utils/auth.server'; import { - BASIC_SCHEMA_AUTH, ARTISTS_ENDPOINT, VENUES_ENDPOINT, EVENTS_BY_NAME_ENDPOINT, @@ -30,14 +29,14 @@ export const loader = async ({ const { searchKind, searchParam } = params; const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; // eslint-disable-next-line no-magic-numbers const FOLLOWERS = [69420, 99876, 45632, 32496, 98765, 12776, 100000, 88999, 99999]; switch (searchKind) { case 'Artists': { - const artists = await ORDSFetcher(`${ARTISTS_ENDPOINT}/${searchParam}`, USER_CREDENTIALS); + const artists = await ORDSFetcher(`${ARTISTS_ENDPOINT}/${searchParam}`, USER_CREDENTIALS!); const SearchResult = artists.items.map((artist: Artist, index : number) => ({ id: artist.artist_id, kind: 'artists', @@ -50,7 +49,7 @@ export const loader = async ({ }); } case 'Events': { - const events = await ORDSFetcher(`${EVENTS_BY_NAME_ENDPOINT}/${searchParam}`, USER_CREDENTIALS); + const events = await ORDSFetcher(`${EVENTS_BY_NAME_ENDPOINT}/${searchParam}`, USER_CREDENTIALS!); const SearchResult = events.items.map((event: Concert) => ({ id: event.event_id, kind: 'concerts', @@ -63,7 +62,7 @@ export const loader = async ({ }); } case 'Venues': { - const venues = await ORDSFetcher(`${VENUES_ENDPOINT}/${searchParam}`, USER_CREDENTIALS); + const venues = await ORDSFetcher(`${VENUES_ENDPOINT}/${searchParam}`, USER_CREDENTIALS!); const SearchResult = venues.items.map((venue: Venue) => ({ id: venue.venue_id, kind: 'venues', @@ -79,7 +78,7 @@ export const loader = async ({ headers: { 'Content-Type': 'application/json', Accept: 'application/json', - Authorization: USER_CREDENTIALS, + Authorization: USER_CREDENTIALS!, }, }); const artists = await getArtist.json(); diff --git a/templates/ords-remix-jwt-sample/app/routes/search.artists.tsx b/templates/ords-remix-jwt-sample/app/routes/search.artists.tsx index 472c7d7..e8f3b67 100644 --- a/templates/ords-remix-jwt-sample/app/routes/search.artists.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/search.artists.tsx @@ -20,7 +20,6 @@ import { auth, getSession, } from '../utils/auth.server'; import { - BASIC_SCHEMA_AUTH, MUSIC_GENRES_ENDPOINT, AUTO_REST_SEARCH_ARTISTS_ENDPOINT, } from './constants/index.server'; @@ -34,7 +33,7 @@ import DiscoverArtists from '../components/search/DiscoverArtists'; export const loader = async ({ request }: LoaderFunctionArgs) => { const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; @@ -51,11 +50,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { searchURL.searchParams.append('offset', offset.toString()); const searchResult = await ORDSFetcher( searchURL, - USER_CREDENTIALS, + USER_CREDENTIALS!, ) as ORDSResponse; const musicGenres = await ORDSFetcher( MUSIC_GENRES_ENDPOINT, - USER_CREDENTIALS, + USER_CREDENTIALS!, ) as ORDSResponse; return json({ diff --git a/templates/ords-remix-jwt-sample/app/routes/search.concerts.tsx b/templates/ords-remix-jwt-sample/app/routes/search.concerts.tsx index ec939b9..271b6ea 100644 --- a/templates/ords-remix-jwt-sample/app/routes/search.concerts.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/search.concerts.tsx @@ -20,7 +20,6 @@ import { auth, getSession, } from '../utils/auth.server'; import { - BASIC_SCHEMA_AUTH, AUTO_REST_SEARCH_ENDPOINT, CITIES_ENDPOINT, ARTISTS_ENDPOINT, @@ -38,7 +37,7 @@ import Artist from '../models/Artist'; export const loader = async ({ request }: LoaderFunctionArgs) => { const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; @@ -55,11 +54,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { searchURL.searchParams.append('offset', offset.toString()); const searchResult = await ORDSFetcher( searchURL, - USER_CREDENTIALS, + USER_CREDENTIALS!, ) as ORDSResponse; - const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS) as ORDSResponse; - const venues = await ORDSFetcher(VENUES_ENDPOINT, USER_CREDENTIALS) as ORDSResponse; - const artists = await ORDSFetcher(ARTISTS_ENDPOINT, USER_CREDENTIALS) as ORDSResponse; + const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS!) as ORDSResponse; + const venues = await ORDSFetcher(VENUES_ENDPOINT, USER_CREDENTIALS!) as ORDSResponse; + const artists = await ORDSFetcher(ARTISTS_ENDPOINT, USER_CREDENTIALS!) as ORDSResponse; return json({ error, diff --git a/templates/ords-remix-jwt-sample/app/routes/search.venues.tsx b/templates/ords-remix-jwt-sample/app/routes/search.venues.tsx index 3e36d2b..e84c624 100644 --- a/templates/ords-remix-jwt-sample/app/routes/search.venues.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/search.venues.tsx @@ -20,7 +20,6 @@ import { auth, getSession, } from '../utils/auth.server'; import { - BASIC_SCHEMA_AUTH, AUTO_REST_SEARCH_VENUES_ENDPOINT, CITIES_ENDPOINT, } from './constants/index.server'; @@ -34,7 +33,7 @@ import ORDSResponse from '../models/ORDSResponse'; export const loader = async ({ request }: LoaderFunctionArgs) => { const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; @@ -51,9 +50,9 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { searchURL.searchParams.append('offset', offset.toString()); const searchResult = await ORDSFetcher( searchURL, - USER_CREDENTIALS, + USER_CREDENTIALS!, ) as ORDSResponse; - const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS) as ORDSResponse; + const cities = await ORDSFetcher(CITIES_ENDPOINT, USER_CREDENTIALS!) as ORDSResponse; return json({ error, diff --git a/templates/ords-remix-jwt-sample/app/routes/venues.tsx b/templates/ords-remix-jwt-sample/app/routes/venues.tsx index 3595dca..8734abc 100644 --- a/templates/ords-remix-jwt-sample/app/routes/venues.tsx +++ b/templates/ords-remix-jwt-sample/app/routes/venues.tsx @@ -11,7 +11,7 @@ import { auth, getSession, } from '~/utils/auth.server'; -import { BASIC_SCHEMA_AUTH, VENUES_ENDPOINT } from './constants/index.server'; +import { VENUES_ENDPOINT } from './constants/index.server'; import { LoaderError } from '../models/LoaderError'; import ORDSFetcher from '../utils/ORDSFetcher'; import Venue from '../models/Venue'; @@ -22,11 +22,11 @@ export const loader = async ({ }: LoaderFunctionArgs) => { const userProfile = await auth.isAuthenticated(request); const USER_CREDENTIALS = userProfile === null - ? BASIC_SCHEMA_AUTH + ? null : `${userProfile.tokenType} ${userProfile.accessToken}`; const session = await getSession(request.headers.get('Cookie')); const error = session.get(auth.sessionErrorKey) as LoaderError; - const venues = await ORDSFetcher(`${VENUES_ENDPOINT}`, USER_CREDENTIALS) as ORDSResponse; + const venues = await ORDSFetcher(`${VENUES_ENDPOINT}`, USER_CREDENTIALS!) as ORDSResponse; return json({ venues, error, diff --git a/templates/ords-remix-jwt-sample/app/utils/ORDSFetcher.ts b/templates/ords-remix-jwt-sample/app/utils/ORDSFetcher.ts index f685ae9..b278180 100644 --- a/templates/ords-remix-jwt-sample/app/utils/ORDSFetcher.ts +++ b/templates/ords-remix-jwt-sample/app/utils/ORDSFetcher.ts @@ -19,6 +19,11 @@ import { isServletError } from '../models/ServletError'; */ async function ORDSFetcher(endpoint : string | URL, authCredentials: string) { let url; + const headers = { + 'Content-Type': 'application/json', + Accept: 'application/json', + }; + Object.assign(headers, authCredentials && { Authorization: authCredentials }); if (typeof endpoint === 'string') { try { url = new URL(endpoint); @@ -35,11 +40,7 @@ async function ORDSFetcher(endpoint : string | URL, authCredentials: string) { url = endpoint; } const getItems = await fetch(url!, { - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - Authorization: authCredentials, - }, + headers, }); if (!getItems.ok) { const errorMessage = 'Something went wrong while trying to query one of our ORDS endpoints.'; diff --git a/templates/ords-remix-jwt-sample/app/utils/auth.server.ts b/templates/ords-remix-jwt-sample/app/utils/auth.server.ts index 283ae76..19353f6 100644 --- a/templates/ords-remix-jwt-sample/app/utils/auth.server.ts +++ b/templates/ords-remix-jwt-sample/app/utils/auth.server.ts @@ -45,7 +45,7 @@ const auth0Strategy = new Auth0Strategy( clientSecret: AUTH0_CLIENT_SECRET, domain: AUTH0_DOMAIN, audience: AUTH0_AUDIENCE, - scope: ['openid', 'email', 'profile', 'concert_app_euser', 'concert_app_authuser', 'concert_app_admin', 'oracle.dbtools.autorest.privilege.CONCERT_SAMPLE_APP.SEARCH_VIEW', 'oracle.dbtools.autorest.privilege.CONCERT_SAMPLE_APP.SEARCH_ARTIST_VIEW', 'oracle.dbtools.autorest.privilege.CONCERT_SAMPLE_APP.SEARCH_VENUES_VIEW'], + scope: ['openid', 'email', 'profile', 'concert_app_authuser', 'concert_app_admin'], }, async ({ accessToken, profile, diff --git a/templates/ords-remix-jwt-sample/ords/migrateScripts/autoRESTEnableObjects.js b/templates/ords-remix-jwt-sample/ords/migrateScripts/autoRESTEnableObjects.js index 0101842..16cff6f 100644 --- a/templates/ords-remix-jwt-sample/ords/migrateScripts/autoRESTEnableObjects.js +++ b/templates/ords-remix-jwt-sample/ords/migrateScripts/autoRESTEnableObjects.js @@ -72,24 +72,24 @@ async function autoRESTEnableObjects(schemaName, endpoint, basicAuth) { objectName: 'SEARCH_VIEW', objectType: VIEW_OBJECT_TYPE, objectAlias: 'search_view', - isAutoRestAuth: true, + isAutoRestAuth: false, }, { objectName: 'SEARCH_ARTIST_VIEW', objectType: VIEW_OBJECT_TYPE, objectAlias: 'search_artist_view', - isAutoRestAuth: true, + isAutoRestAuth: false, }, { objectName: 'SEARCH_VENUES_VIEW', objectType: VIEW_OBJECT_TYPE, objectAlias: 'search_venues_view', - isAutoRestAuth: true, + isAutoRestAuth: false, }, ]; const autoRESTenableStatements = ` BEGIN - ${objectsToRESTEnable.filter((object) => object.isAutoRestAuth).map((object) => enableObject(schemaName, object.objectName, object.objectType, object.objectAlias, object.isAutoRestAuth)).join(' ')} + ${objectsToRESTEnable.map((object) => enableObject(schemaName, object.objectName, object.objectType, object.objectAlias, object.isAutoRestAuth)).join(' ')} COMMIT; END; / @@ -97,7 +97,7 @@ async function autoRESTEnableObjects(schemaName, endpoint, basicAuth) { const statementsResponse = await postRequest(endpoint, autoRESTenableStatements, basicAuth); printResponse(statementsResponse); // Add the SQL Developer role to the objects that where autoREST Enabled. - objectsToRESTEnable.map(async (object) => { + objectsToRESTEnable.filter((object) => object.isAutoRestAuth).map(async (object) => { const grantSQLDevStmt = grantSQLDeveloperRole( schemaName, object.objectName, diff --git a/templates/ords-remix-jwt-sample/ords/migrateScripts/protectEndpoints.js b/templates/ords-remix-jwt-sample/ords/migrateScripts/protectEndpoints.js index 0d2078d..07ca153 100644 --- a/templates/ords-remix-jwt-sample/ords/migrateScripts/protectEndpoints.js +++ b/templates/ords-remix-jwt-sample/ords/migrateScripts/protectEndpoints.js @@ -50,13 +50,6 @@ async function protectEndpoints( 'concert_app.adminuser.v1', )} - ${definePrivilege( - 'concert_app_euser', - 'Non authenticated end user privilege', - 'Provides limited access to the concert app endpoints', - 'concert_app.euser.v1', - )} - COMMIT; END; / diff --git a/templates/ords-remix-jwt-sample/ords/openAPI Catalog/concert_app.euser.v2.json b/templates/ords-remix-jwt-sample/ords/openAPI Catalog/concert_app.euser.v2.json new file mode 100644 index 0000000..0f7c4bd --- /dev/null +++ b/templates/ords-remix-jwt-sample/ords/openAPI Catalog/concert_app.euser.v2.json @@ -0,0 +1,1119 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "ORDS generated API for concert_app.euser.v1", + "version": "1.0.0", + "description": "end user APIs Version 1" + }, + "paths": { + "/artist/{id}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "bio": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "description": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genres": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/artistEvents/{id}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "artist_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "city_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_date": { + "$ref": "#/components/schemas/DATE" + }, + "event_details": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genres": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "venue_name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/artists/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "description": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genres": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/artists/{artist_name}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "bio": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "description": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "artist_name", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/cities/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "city_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "description": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_count": { + "$ref": "#/components/schemas/NUMBER" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/cityEvents/{cityName}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "artist_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "city_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_date": { + "$ref": "#/components/schemas/DATE" + }, + "event_details": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genres": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "venue_name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "cityName", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/event/{event_id}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "artist_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "city_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_date": { + "$ref": "#/components/schemas/DATE" + }, + "event_details": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genres": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "venue_name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "event_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/eventStatus/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "event_status_description": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_status_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/events/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_date": { + "$ref": "#/components/schemas/DATE" + }, + "event_details": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/events/{event_name}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "artist_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "city_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_date": { + "$ref": "#/components/schemas/DATE" + }, + "event_details": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genres": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "venue_name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "event_name", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/eventsHome/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artist_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "artist_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "city_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_date": { + "$ref": "#/components/schemas/DATE" + }, + "event_details": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "event_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "event_status_name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genres": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "venue_name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/landing_page_global_stats/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "artists_count": { + "$ref": "#/components/schemas/NUMBER" + }, + "events_count": { + "$ref": "#/components/schemas/NUMBER" + }, + "venues_count": { + "$ref": "#/components/schemas/NUMBER" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/musicGenres/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "description": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "music_genre_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/venue/{venue_id}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "city_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "location": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "venue_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/venues/": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "city_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "location": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + } + } + } + } + } + } + } + } + } + }, + "parameters": [] + } + }, + "/venues/{venue_name}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "city_id": { + "$ref": "#/components/schemas/NUMBER" + }, + "location": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "name": { + "$ref": "#/components/schemas/VARCHAR2" + }, + "venue_id": { + "$ref": "#/components/schemas/NUMBER" + } + } + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "venue_name", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + }, + "/venues_by_city/{city_name}": { + "get": { + "description": "Retrieve records from concert_app.euser.v1", + "security": [ + { + "BasicAuth": [] + }, + { + "BearerAuth": [] + }, + { + "OAuth2": [] + } + ], + "responses": { + "200": { + "description": "The queried record.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "CITY_NAME", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Implicit parameter" + }, + { + "name": "city_name", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[^/]+$" + }, + "description": "implicit" + } + ] + } + } + }, + "components": { + "securitySchemes": { + "BasicAuth": { + "type": "http", + "scheme": "basic" + }, + "BearerAuth": { + "type": "http", + "scheme": "bearer" + }, + "OAuth2": { + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "", + "scopes": {} + }, + "authorizationCode": { + "authorizationUrl": "", + "tokenUrl": "", + "scopes": {} + }, + "clientCredentials": { + "tokenUrl": "", + "scopes": {} + } + } + } + }, + "schemas": { + "DATE": { + "type": "string", + "format": "date-time", + "pattern": "^\\d{4}-[01]\\d-[0123]\\dT[012]\\d:[0-5]\\d:[0-5]\\d(.\\d+)?(Z|([-+][012]\\d:[0-5]\\d))$" + }, + "NUMBER": { + "type": "number" + }, + "VARCHAR2": { + "type": "string" + } + } + } +} \ No newline at end of file