From 985e4540ce0be0345069a60a287a3f923a3ff47b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Dec 2025 04:28:35 +0900 Subject: refactor(graphql): change directory structure --- Dockerfile | 2 +- backend/gqlgen.yml | 2 +- backend/graphql/generated.go | 2 +- common/graphql/schema.graphql | 181 ------------------------------------ frontend/src/graphql/schema.graphql | 2 +- graphql/schema.graphql | 181 ++++++++++++++++++++++++++++++++++++ 6 files changed, 185 insertions(+), 185 deletions(-) delete mode 100644 common/graphql/schema.graphql create mode 100644 graphql/schema.graphql diff --git a/Dockerfile b/Dockerfile index aecd0c5..9b08ef4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ COPY frontend/package.json frontend/package-lock.json ./ RUN npm install COPY frontend/ ./ -COPY common/graphql/schema.graphql src/graphql/schema.graphql +COPY graphql/schema.graphql src/graphql/schema.graphql RUN npm run build ########################################## diff --git a/backend/gqlgen.yml b/backend/gqlgen.yml index cc4472d..c09e9e2 100644 --- a/backend/gqlgen.yml +++ b/backend/gqlgen.yml @@ -1,5 +1,5 @@ schema: - - ../common/graphql/schema.graphql + - ../graphql/schema.graphql exec: package: graphql diff --git a/backend/graphql/generated.go b/backend/graphql/generated.go index 9f45445..72379bc 100644 --- a/backend/graphql/generated.go +++ b/backend/graphql/generated.go @@ -492,7 +492,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "../../common/graphql/schema.graphql", Input: `scalar DateTime + {Name: "../../graphql/schema.graphql", Input: `scalar DateTime """ Represents a feed subscription in the system diff --git a/common/graphql/schema.graphql b/common/graphql/schema.graphql deleted file mode 100644 index e37d729..0000000 --- a/common/graphql/schema.graphql +++ /dev/null @@ -1,181 +0,0 @@ -scalar DateTime - -""" -Represents a feed subscription in the system -""" -type Feed { - """ - Unique identifier for the feed - """ - id: ID! - - """ - URL of the RSS/Atom feed - """ - url: String! - - """ - Title of the feed (extracted from feed metadata) - """ - title: String! - - """ - Timestamp when the feed was last fetched - """ - fetchedAt: DateTime! - - """ - Whether the user is currently subscribed to this feed - """ - isSubscribed: Boolean! - - """ - Articles belonging to this feed - """ - articles: [Article!]! -} - -""" -Represents an individual article/post from a feed -""" -type Article { - """ - Unique identifier for the article - """ - id: ID! - - """ - ID of the feed this article belongs to - """ - feedId: ID! - - """ - GUID from the RSS/Atom feed (unique identifier from feed) - """ - guid: String! - - """ - Title of the article - """ - title: String! - - """ - URL/link to the original article - """ - url: String! - - """ - Whether the article has been marked as read - """ - isRead: Boolean! - - """ - The feed this article belongs to - """ - feed: Feed! -} - -""" -Represents a user in the system -""" -type User { - """ - Unique identifier for the user - """ - id: ID! - - """ - Username of the user - """ - username: String! -} - -""" -Authentication payload returned from login mutation -""" -type AuthPayload { - """ - The authenticated user - """ - user: User! -} - -""" -Root query type for reading data -""" -type Query { - """ - Get all feeds with their metadata - """ - feeds: [Feed!]! - - """ - Get all unread articles across all feeds - """ - unreadArticles: [Article!]! - - """ - Get all read articles across all feeds - """ - readArticles: [Article!]! - - """ - Get a specific feed by ID - """ - feed(id: ID!): Feed - - """ - Get a specific article by ID - """ - article(id: ID!): Article - - """ - Get the currently authenticated user - """ - currentUser: User -} - -""" -Root mutation type for modifying data -""" -type Mutation { - """ - Add a new feed subscription - """ - addFeed(url: String!): Feed! - - """ - Unsubscribe from a feed (preserves feed and article data) - """ - unsubscribeFeed(id: ID!): Boolean! - - """ - Mark an article as read - """ - markArticleRead(id: ID!): Article! - - """ - Mark an article as unread - """ - markArticleUnread(id: ID!): Article! - - """ - Mark all articles in a feed as read - """ - markFeedRead(id: ID!): Feed! - - """ - Mark all articles in a feed as unread - """ - markFeedUnread(id: ID!): Feed! - - """ - Login with username and password. Creates a session cookie. - """ - login(username: String!, password: String!): AuthPayload! - - """ - Logout the current user and destroy the session - """ - logout: Boolean! -} diff --git a/frontend/src/graphql/schema.graphql b/frontend/src/graphql/schema.graphql index 4271904..5771f01 120000 --- a/frontend/src/graphql/schema.graphql +++ b/frontend/src/graphql/schema.graphql @@ -1 +1 @@ -../../../common/graphql/schema.graphql \ No newline at end of file +../../../graphql/schema.graphql \ No newline at end of file diff --git a/graphql/schema.graphql b/graphql/schema.graphql new file mode 100644 index 0000000..e37d729 --- /dev/null +++ b/graphql/schema.graphql @@ -0,0 +1,181 @@ +scalar DateTime + +""" +Represents a feed subscription in the system +""" +type Feed { + """ + Unique identifier for the feed + """ + id: ID! + + """ + URL of the RSS/Atom feed + """ + url: String! + + """ + Title of the feed (extracted from feed metadata) + """ + title: String! + + """ + Timestamp when the feed was last fetched + """ + fetchedAt: DateTime! + + """ + Whether the user is currently subscribed to this feed + """ + isSubscribed: Boolean! + + """ + Articles belonging to this feed + """ + articles: [Article!]! +} + +""" +Represents an individual article/post from a feed +""" +type Article { + """ + Unique identifier for the article + """ + id: ID! + + """ + ID of the feed this article belongs to + """ + feedId: ID! + + """ + GUID from the RSS/Atom feed (unique identifier from feed) + """ + guid: String! + + """ + Title of the article + """ + title: String! + + """ + URL/link to the original article + """ + url: String! + + """ + Whether the article has been marked as read + """ + isRead: Boolean! + + """ + The feed this article belongs to + """ + feed: Feed! +} + +""" +Represents a user in the system +""" +type User { + """ + Unique identifier for the user + """ + id: ID! + + """ + Username of the user + """ + username: String! +} + +""" +Authentication payload returned from login mutation +""" +type AuthPayload { + """ + The authenticated user + """ + user: User! +} + +""" +Root query type for reading data +""" +type Query { + """ + Get all feeds with their metadata + """ + feeds: [Feed!]! + + """ + Get all unread articles across all feeds + """ + unreadArticles: [Article!]! + + """ + Get all read articles across all feeds + """ + readArticles: [Article!]! + + """ + Get a specific feed by ID + """ + feed(id: ID!): Feed + + """ + Get a specific article by ID + """ + article(id: ID!): Article + + """ + Get the currently authenticated user + """ + currentUser: User +} + +""" +Root mutation type for modifying data +""" +type Mutation { + """ + Add a new feed subscription + """ + addFeed(url: String!): Feed! + + """ + Unsubscribe from a feed (preserves feed and article data) + """ + unsubscribeFeed(id: ID!): Boolean! + + """ + Mark an article as read + """ + markArticleRead(id: ID!): Article! + + """ + Mark an article as unread + """ + markArticleUnread(id: ID!): Article! + + """ + Mark all articles in a feed as read + """ + markFeedRead(id: ID!): Feed! + + """ + Mark all articles in a feed as unread + """ + markFeedUnread(id: ID!): Feed! + + """ + Login with username and password. Creates a session cookie. + """ + login(username: String!, password: String!): AuthPayload! + + """ + Logout the current user and destroy the session + """ + logout: Boolean! +} -- cgit v1.2.3-70-g09d2