Consolidate frontend REST calls with GraphQL
Some checks failed
Deploy with Docker Compose / deploy (push) Failing after 1s

Replace 5 separate REST calls on home page load with a single GraphQL
query. Add homeData store that fetches posts, favorites, activities,
spotify, and auth in one request. Convert all admin mutations and
auth flows to use GraphQL. Add album images to Spotify GraphQL schema.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 15:29:04 +00:00
parent 36817277f9
commit 0360b1f7f1
40 changed files with 8963 additions and 157 deletions

View File

@@ -0,0 +1,14 @@
type Activity {
id: ID!
createdAt: Time!
updatedAt: Time!
type: String!
name: String!
link: String
}
input CreateActivityInput {
type: String!
name: String!
link: String
}

View File

@@ -0,0 +1,8 @@
input LoginInput {
username: String!
password: String!
}
type AuthPayload {
user: User!
}

View File

@@ -0,0 +1,14 @@
type Favorite {
id: ID!
createdAt: Time!
updatedAt: Time!
type: String!
name: String!
link: String
}
input CreateFavoriteInput {
type: String!
name: String!
link: String
}

View File

@@ -0,0 +1,7 @@
type Message {
id: ID!
content: String!
authorId: Int!
fileUrl: String
createdAt: Time!
}

View File

@@ -0,0 +1,18 @@
type Post {
id: ID!
createdAt: Time!
updatedAt: Time!
title: String!
author: User
content: String!
}
input CreatePostInput {
title: String!
content: String!
}
input UpdatePostInput {
title: String!
content: String!
}

View File

@@ -0,0 +1,9 @@
type Rowing {
id: ID!
createdAt: Time!
date: Time!
time: Int!
distance: Int!
timePer500m: Float!
calories: Float!
}

View File

@@ -0,0 +1,29 @@
scalar Time
type Query {
users: [User!]!
user(id: ID!): User
posts: [Post!]!
post(id: ID!): Post
activities: [Activity!]!
favorites: [Favorite!]!
rowingSessions: [Rowing!]!
messages: [Message!]!
spotifyListening: SpotifyPlaying
spotifyRecent: [SpotifyRecentItem!]!
me: User
}
type Mutation {
login(input: LoginInput!): AuthPayload!
logout: Boolean!
refreshToken: AuthPayload!
createPost(input: CreatePostInput!): Post!
updatePost(id: ID!, input: UpdatePostInput!): Post!
deletePost(id: ID!): Post!
createUser(input: CreateUserInput!): User!
deleteUser(id: ID!): User!
setUserAdmin(id: ID!, admin: Boolean!): User!
createFavorite(input: CreateFavoriteInput!): Favorite!
createActivity(input: CreateActivityInput!): Activity!
}

View File

@@ -0,0 +1,28 @@
type SpotifyArtist {
name: String!
}
type SpotifyImage {
url: String!
}
type SpotifyAlbum {
name: String!
images: [SpotifyImage!]!
}
type SpotifyTrack {
name: String!
artists: [SpotifyArtist!]!
album: SpotifyAlbum!
}
type SpotifyPlaying {
playing: Boolean!
track: SpotifyTrack
}
type SpotifyRecentItem {
track: SpotifyTrack!
playedAt: Time!
}

View File

@@ -0,0 +1,12 @@
type User {
id: ID!
createdAt: Time!
updatedAt: Time!
username: String!
admin: Boolean!
}
input CreateUserInput {
username: String!
password: String!
}