summaryrefslogtreecommitdiffhomepage
path: root/backend
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-13 00:52:57 +0900
committernsfisis <nsfisis@gmail.com>2025-07-13 01:09:54 +0900
commit732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda (patch)
tree619d28354e48f55fd5efe9a0298c7d61b6d7393f /backend
parent756b66b31fd02215fc2d8a30ae263a3bf08a90a6 (diff)
downloadfeedaka-732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda.tar.gz
feedaka-732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda.tar.zst
feedaka-732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda.zip
feat(container): fix Docker build
Diffstat (limited to 'backend')
-rw-r--r--backend/graphql/generated.go214
-rw-r--r--backend/main.go30
-rw-r--r--backend/public/dummy.txt4
3 files changed, 121 insertions, 127 deletions
diff --git a/backend/graphql/generated.go b/backend/graphql/generated.go
index b09d4d8..e4790bd 100644
--- a/backend/graphql/generated.go
+++ b/backend/graphql/generated.go
@@ -436,140 +436,140 @@ var sources = []*ast.Source{
Represents a feed subscription in the system
"""
type Feed {
- """
- Unique identifier for the feed
- """
- id: ID!
+ """
+ Unique identifier for the feed
+ """
+ id: ID!
- """
- URL of the RSS/Atom feed
- """
- url: String!
+ """
+ URL of the RSS/Atom feed
+ """
+ url: String!
- """
- Title of the feed (extracted from feed metadata)
- """
- title: String!
+ """
+ Title of the feed (extracted from feed metadata)
+ """
+ title: String!
- """
- Timestamp when the feed was last fetched
- """
- fetchedAt: DateTime!
+ """
+ Timestamp when the feed was last fetched
+ """
+ fetchedAt: DateTime!
- """
- Whether the user is currently subscribed to this feed
- """
- isSubscribed: Boolean!
+ """
+ Whether the user is currently subscribed to this feed
+ """
+ isSubscribed: Boolean!
- """
- Articles belonging to this feed
- """
- articles: [Article!]!
+ """
+ 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!
+ """
+ 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!
}
"""
Root query type for reading data
"""
type Query {
- """
- Get all feeds with their metadata
- """
- feeds: [Feed!]!
+ """
+ Get all feeds with their metadata
+ """
+ feeds: [Feed!]!
- """
- Get all unread articles across all feeds
- """
- unreadArticles: [Article!]!
+ """
+ Get all unread articles across all feeds
+ """
+ unreadArticles: [Article!]!
- """
- Get all read articles across all feeds
- """
- readArticles: [Article!]!
+ """
+ Get all read articles across all feeds
+ """
+ readArticles: [Article!]!
- """
- Get a specific feed by ID
- """
- feed(id: ID!): Feed
+ """
+ Get a specific feed by ID
+ """
+ feed(id: ID!): Feed
- """
- Get a specific article by ID
- """
- article(id: ID!): Article
+ """
+ Get a specific article by ID
+ """
+ article(id: ID!): Article
}
"""
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!
+ """
+ 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!
}
`, BuiltIn: false},
}
diff --git a/backend/main.go b/backend/main.go
index 150e0af..0efe66a 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -34,28 +34,14 @@ import (
var (
database *sql.DB
queries *db.Queries
- //go:embed static/*
- staticFS embed.FS
+ //go:embed public/*
+ publicFS embed.FS
+ //go:embed db/schema.sql
+ dbSchema string
)
func initDB(db *sql.DB) error {
- _, err := db.Exec(`
-CREATE TABLE IF NOT EXISTS feeds (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- url TEXT NOT NULL,
- title TEXT NOT NULL,
- fetched_at TEXT NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS articles (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- feed_id INTEGER NOT NULL,
- guid TEXT NOT NULL,
- title TEXT NOT NULL,
- url TEXT NOT NULL,
- is_read INTEGER NOT NULL
-);
-`)
+ _, err := db.Exec(dbSchema)
return err
}
@@ -186,7 +172,11 @@ func main() {
e.Use(middleware.Recover())
e.Use(middleware.CORS())
- e.GET("/static/*", echo.WrapHandler(http.FileServer(http.FS(staticFS))))
+ e.Use(middleware.StaticWithConfig(middleware.StaticConfig{
+ HTML5: true,
+ Root: "public",
+ Filesystem: http.FS(publicFS),
+ }))
// Setup GraphQL server
srv := handler.New(graphql.NewExecutableSchema(graphql.Config{Resolvers: &resolver.Resolver{DB: database, Queries: queries}}))
diff --git a/backend/public/dummy.txt b/backend/public/dummy.txt
new file mode 100644
index 0000000..1c5c535
--- /dev/null
+++ b/backend/public/dummy.txt
@@ -0,0 +1,4 @@
+The public directory stores the build artifacts of the frontend.
+However, in the local environment, the frontend side runs a development server to serve those files, so this public directory is not used.
+Go does not allow specifying an empty directory with go:embed, so we place a dummy file here.
+This dummy file is not used in production builds.