From 575b994d6a0c0d9fdb39b5190241aeaf2d23d7cf Mon Sep 17 00:00:00 2001 From: wasaab Date: Sun, 28 Jan 2024 01:36:22 -0500 Subject: [PATCH 1/5] - graphql getUser query watchlist items limit increased (100 --> 1000). - deprecated default import of aws-amplify replaced with named import. --- .eslintignore | 1 + CHANGELOG.md | 7 ++ .../api/universalratings/schema.graphql | 2 +- .../amplify-dependent-resources-ref.d.ts | 84 +++++++++---------- amplify/team-provider-info.json | 3 + package.json | 2 +- pages/_app.js | 2 +- pages/index.jsx | 18 +++- 8 files changed, 72 insertions(+), 47 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..fcef398 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +amplify-codegen-temp\models\models \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aad02e..369db6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] - 2023-##-## +## [1.21.2] - 2024-01-28 +### Changed +- graphql getUser query watchlist items limit increased (100 --> 1000). + +### Fixed +- deprecated default import of aws-amplify replaced with named import. + ## [1.21.1] - 2023-10-17 ### Fixed - dense schedule view card width reduced for small mobile devices diff --git a/amplify/backend/api/universalratings/schema.graphql b/amplify/backend/api/universalratings/schema.graphql index 871bfeb..a3d1a84 100644 --- a/amplify/backend/api/universalratings/schema.graphql +++ b/amplify/backend/api/universalratings/schema.graphql @@ -25,7 +25,7 @@ type User @model color: String! themePref: String plexSearchEnabled: Boolean - watchlist: [WatchlistItem] @connection(fields: ["id"]) + watchlist: [WatchlistItem] @connection(fields: ["id"], limit: 1000) } type Review @model diff --git a/amplify/backend/types/amplify-dependent-resources-ref.d.ts b/amplify/backend/types/amplify-dependent-resources-ref.d.ts index 3443f15..2b6d8f9 100644 --- a/amplify/backend/types/amplify-dependent-resources-ref.d.ts +++ b/amplify/backend/types/amplify-dependent-resources-ref.d.ts @@ -1,47 +1,47 @@ export type AmplifyDependentResourcesAttributes = { - "auth": { - "universalratings5a980c73": { - "IdentityPoolId": "string", - "IdentityPoolName": "string", - "UserPoolId": "string", - "UserPoolArn": "string", - "UserPoolName": "string", - "AppClientIDWeb": "string", - "AppClientID": "string", - "CreatedSNSRole": "string" - }, - "userPoolGroups": { - "AdminGroupRole": "string" - } + "api": { + "universalratings": { + "GraphQLAPIEndpointOutput": "string", + "GraphQLAPIIdOutput": "string" + } + }, + "auth": { + "universalratings5a980c73": { + "AppClientID": "string", + "AppClientIDWeb": "string", + "CreatedSNSRole": "string", + "IdentityPoolId": "string", + "IdentityPoolName": "string", + "UserPoolArn": "string", + "UserPoolId": "string", + "UserPoolName": "string" + }, + "userPoolGroups": { + "AdminGroupRole": "string" + } + }, + "function": { + "ShowAddedDiscordWebhookPublisher": { + "Arn": "string", + "LambdaExecutionRole": "string", + "LambdaExecutionRoleArn": "string", + "Name": "string", + "Region": "string" }, - "api": { - "universalratings": { - "GraphQLAPIIdOutput": "string", - "GraphQLAPIEndpointOutput": "string" - } + "UpdateShowsMetadata": { + "Arn": "string", + "CloudWatchEventRule": "string", + "LambdaExecutionRole": "string", + "LambdaExecutionRoleArn": "string", + "Name": "string", + "Region": "string" }, - "function": { - "universalratings5a980c73PostConfirmation": { - "Name": "string", - "Arn": "string", - "LambdaExecutionRole": "string", - "Region": "string", - "LambdaExecutionRoleArn": "string" - }, - "ShowAddedDiscordWebhookPublisher": { - "Name": "string", - "Arn": "string", - "Region": "string", - "LambdaExecutionRole": "string", - "LambdaExecutionRoleArn": "string" - }, - "UpdateShowsMetadata": { - "Name": "string", - "Arn": "string", - "Region": "string", - "LambdaExecutionRole": "string", - "CloudWatchEventRule": "string", - "LambdaExecutionRoleArn": "string" - } + "universalratings5a980c73PostConfirmation": { + "Arn": "string", + "LambdaExecutionRole": "string", + "LambdaExecutionRoleArn": "string", + "Name": "string", + "Region": "string" } + } } \ No newline at end of file diff --git a/amplify/team-provider-info.json b/amplify/team-provider-info.json index 7103362..464205f 100644 --- a/amplify/team-provider-info.json +++ b/amplify/team-provider-info.json @@ -33,6 +33,9 @@ "deploymentBucketName": "amplify-amplify6604b332b57b4-staging-21636-deployment", "s3Key": "amplify-builds/UpdateShowsMetadata-376e52585a7a2f353170-build.zip" } + }, + "api": { + "universalratings": {} } } } diff --git a/package.json b/package.json index dfba133..59ec4ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "universal-ratings", - "version": "1.21.1", + "version": "1.21.2", "description": "A site for rating TV shows and movies", "repository": { "type": "git", diff --git a/pages/_app.js b/pages/_app.js index b5d5711..fa49d9f 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -4,7 +4,7 @@ import API, { graphqlOperation } from '@aws-amplify/api'; import { getUser } from '../src/graphql/custom-queries.js'; import { AmplifyAuthContainer, AmplifyAuthenticator } from '@aws-amplify/ui-react'; import { AuthState } from '@aws-amplify/ui-components'; -import amplify from 'aws-amplify'; +import { Amplify as amplify } from 'aws-amplify'; import amplifyConfig from '../src/aws-exports'; import { ThemeProvider } from '../components/ThemeProvider.jsx'; import '../resources/styles/global.css'; diff --git a/pages/index.jsx b/pages/index.jsx index cbe0641..2dc24c6 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -609,6 +609,19 @@ const Index = ({ authedUser }) => { } }; + /** + * Converts a watchlisted show to a rated show, by updating the source and rating. + * + * @param {Object} watchlistedShow - watchlisted show to convert to rated show + * @param {string} showId - ID of the show to update + */ + const convertToRatedShow = (watchlistedShow, showId) => { + API.graphql(graphqlOperation(updateShow, { input: { ...watchlistedShow, id: showId } })) + .catch((err) => { + console.error('Failed to convert watchlisted show to rated show. ', err); + }) + }; + /** * Creates a rated show. * @@ -627,13 +640,14 @@ const Index = ({ authedUser }) => { await maybeAddShowMetadata(show); + const isWatchlisted = show.rating === 0 || watchlistIdx !== -1 || await isInAnyUsersWatchlist(show.id); const ratedShow = { rating, source: rating ? 'UR' : 'WL' }; - if (rating && show.rating === 0) { // unrated WL item - API.graphql(graphqlOperation(updateShow, { input: { ...ratedShow, id: show.id } })); + if (rating && isWatchlisted) { // unrated WL item + convertToRatedShow(ratedShow, show.id); } else { // unrated show API.graphql(graphqlOperation(createShow, { input: { ...show, ...ratedShow } })) .catch((err) => { From 37662e6864d509c9b7152b02b4f42e944743ff0c Mon Sep 17 00:00:00 2001 From: wasaab Date: Sun, 28 Jan 2024 15:31:44 -0500 Subject: [PATCH 2/5] - plex svg width attribute using valid syntax (auto --> 100%). - missing semicolon added to index.jsx. --- CHANGELOG.md | 4 ++++ package.json | 2 +- pages/index.jsx | 2 +- resources/images/plex.svg | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 369db6f..6333da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] - 2023-##-## +## [1.21.3] - 2024-01-28 +### Fixed +- plex svg width attribute using valid syntax (auto --> 100%). + ## [1.21.2] - 2024-01-28 ### Changed - graphql getUser query watchlist items limit increased (100 --> 1000). diff --git a/package.json b/package.json index 59ec4ce..af10090 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "universal-ratings", - "version": "1.21.2", + "version": "1.21.3", "description": "A site for rating TV shows and movies", "repository": { "type": "git", diff --git a/pages/index.jsx b/pages/index.jsx index 2dc24c6..5c54ed8 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -619,7 +619,7 @@ const Index = ({ authedUser }) => { API.graphql(graphqlOperation(updateShow, { input: { ...watchlistedShow, id: showId } })) .catch((err) => { console.error('Failed to convert watchlisted show to rated show. ', err); - }) + }); }; /** diff --git a/resources/images/plex.svg b/resources/images/plex.svg index 68da5ec..65697a6 100644 --- a/resources/images/plex.svg +++ b/resources/images/plex.svg @@ -1,4 +1,4 @@ -