feat: Archivum skeleton — Go/GraphQL backend + Vue 3 PWA frontend
Full project scaffold: multi-stage Dockerfile (ARM64/AMD64), AsciiDoc↔TipTap bridge, Setup Wizard, CodeMirror source editor, Git-backed storage layer, LDAP+JWT auth skeleton, Tailwind mobile-first layout, and VS Code build/push tasks targeting registry at 192.168.0.19:5000. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
16
backend/internal/graph/resolver.go
Normal file
16
backend/internal/graph/resolver.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package graph
|
||||
|
||||
// Resolver is the root resolver — all query/mutation methods live here.
|
||||
// Fields are populated by NewServer via dependency injection.
|
||||
type Resolver struct {
|
||||
cfg interface{} // *config.Config — placeholder until gqlgen generation
|
||||
auth interface{} // *auth.Manager
|
||||
storage interface{} // *storage.Store
|
||||
git interface{} // *git.Repo
|
||||
}
|
||||
|
||||
// TODO: Run `go generate ./...` after adding gqlgen to go.mod to generate
|
||||
// the type-safe resolver stubs from schema.graphql.
|
||||
//
|
||||
// The generated code lands in graph/generated.go (gitignored for now).
|
||||
// Implement each method on *Resolver once the stubs exist.
|
||||
87
backend/internal/graph/schema.graphql
Normal file
87
backend/internal/graph/schema.graphql
Normal file
@@ -0,0 +1,87 @@
|
||||
type Query {
|
||||
# Returns REQUIRE_SETUP if config is missing.
|
||||
systemStatus: SystemStatus!
|
||||
|
||||
# Fetch a document by its slug path.
|
||||
document(slug: String!): Document
|
||||
|
||||
# List documents under an optional path prefix.
|
||||
documents(prefix: String): [DocumentMeta!]!
|
||||
|
||||
# Commit history for a document.
|
||||
history(slug: String!): [CommitEntry!]!
|
||||
|
||||
# Unified diff between two commits for a document.
|
||||
diff(slug: String!, fromHash: String!, toHash: String!): String!
|
||||
|
||||
# Raw content of a document at a specific commit.
|
||||
documentAtCommit(slug: String!, hash: String!): String!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
# First-run setup.
|
||||
setup(input: SetupInput!): Boolean!
|
||||
|
||||
# Authenticate and receive a bearer token.
|
||||
login(username: String!, password: String!): String!
|
||||
|
||||
# Invalidate the current session.
|
||||
logout: Boolean!
|
||||
|
||||
# Save (create or update) a document.
|
||||
saveDocument(input: SaveDocumentInput!): Document!
|
||||
|
||||
# Delete a document.
|
||||
deleteDocument(slug: String!): Boolean!
|
||||
}
|
||||
|
||||
# ── Types ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
enum SystemStatus {
|
||||
OK
|
||||
REQUIRE_SETUP
|
||||
}
|
||||
|
||||
type Document {
|
||||
slug: String!
|
||||
content: String!
|
||||
meta: DocumentMeta!
|
||||
}
|
||||
|
||||
type DocumentMeta {
|
||||
slug: String!
|
||||
title: String!
|
||||
updatedAt: String!
|
||||
}
|
||||
|
||||
type CommitEntry {
|
||||
hash: String!
|
||||
author: String!
|
||||
email: String!
|
||||
date: String!
|
||||
subject: String!
|
||||
}
|
||||
|
||||
# ── Inputs ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
input SetupInput {
|
||||
storagePath: String!
|
||||
adminUser: String!
|
||||
adminPass: String!
|
||||
ldap: LDAPInput
|
||||
jwtSecret: String!
|
||||
}
|
||||
|
||||
input LDAPInput {
|
||||
host: String!
|
||||
port: Int!
|
||||
baseDN: String!
|
||||
bindDN: String!
|
||||
bindPassword: String!
|
||||
}
|
||||
|
||||
input SaveDocumentInput {
|
||||
slug: String!
|
||||
content: String!
|
||||
commitMessage: String!
|
||||
}
|
||||
28
backend/internal/graph/server.go
Normal file
28
backend/internal/graph/server.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package graph
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/brasse-b/archivum/internal/config"
|
||||
)
|
||||
|
||||
// NewServer wires up the HTTP handler for the GraphQL endpoint.
|
||||
// Replace the stub handler with the gqlgen-generated handler once
|
||||
// `go generate ./...` has been run.
|
||||
func NewServer(cfg *config.Config) http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
// Placeholder — replace with generated gqlgen handler.
|
||||
mux.HandleFunc("/graphql", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte(`{"data":{"systemStatus":"REQUIRE_SETUP"}}`))
|
||||
})
|
||||
|
||||
// Simple health check.
|
||||
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
})
|
||||
|
||||
return mux
|
||||
}
|
||||
Reference in New Issue
Block a user