chore: cleanup temporary files and update gitignore
- Remove temporary DOCUMENTATION_UPDATES.md after merging content - Remove obsolete internal/database/connection.go file - Update .gitignore to exclude build artifacts - Clean up generated files and temporary directories
This commit is contained in:
+16
-114
@@ -1,120 +1,22 @@
|
||||
# ---> Go
|
||||
# If you prefer to allow list template instead of deny list, see community template:
|
||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||
#
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
# Ignore build artifacts and logs
|
||||
bookmann/
|
||||
bookmann.*
|
||||
!bookmann/
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
# Temporary files
|
||||
tmp/
|
||||
temp/
|
||||
*.tmp
|
||||
|
||||
# Output of go coverage tool, specifically when used with LiteIDE
|
||||
# Testing coverage
|
||||
*.out
|
||||
*.cover
|
||||
coverage.html
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
go.work.sum
|
||||
|
||||
# env file
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# ---> Node (not applicable to Go web app)
|
||||
# Logs
|
||||
# .cache
|
||||
# *.log
|
||||
# npm-debug.log*
|
||||
# yarn-debug.log*
|
||||
# lerna-debug.log*
|
||||
# .pnpm-debug.log*
|
||||
# Diagnostic reports
|
||||
# report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
# Runtime data
|
||||
# pids
|
||||
# *.pid
|
||||
# *.seed
|
||||
# *.pid.lock
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
# lib-cov
|
||||
# Coverage directory used by tools like istanbul
|
||||
# coverage
|
||||
# *.lcov
|
||||
# nyc test coverage
|
||||
# .nyc_output
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
# .grunt
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
# bower_components
|
||||
# jspm_packages/
|
||||
# node-waf configuration
|
||||
# .lock-wscript
|
||||
# Compiled binary addons (https://node.js.org/api/addons.html)
|
||||
# build/Release
|
||||
# Dependency directories
|
||||
# node_modules/
|
||||
# bower_components/
|
||||
# jspm_packages/
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
# web_modules/
|
||||
# TypeScript cache
|
||||
# *.tsbuildinfo
|
||||
# Optional npm cache directory
|
||||
# .npm
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
# .cache
|
||||
# .parcel-cache
|
||||
# Svelte build outputs (Go templates use different pattern)
|
||||
# dist/
|
||||
# build/
|
||||
# .svelte-kit/
|
||||
# /package/
|
||||
# /output
|
||||
# Next.js build output
|
||||
# .next
|
||||
# out
|
||||
# Nuxt.js build / generate output
|
||||
# .nuxt
|
||||
# dist
|
||||
# Gatsby files
|
||||
# .gatsby
|
||||
# public
|
||||
# vuepress build output
|
||||
# .vuepress/dist
|
||||
# .vitepress/build output
|
||||
# **/.vitepress/dist
|
||||
# .vitepress/cache directory
|
||||
# Docusaurus cache and generated files
|
||||
# .docusaurus
|
||||
# Serverless directories
|
||||
# .serverless/
|
||||
# FuseBox cache
|
||||
# .fusebox/
|
||||
# DynamoDB Local files
|
||||
# .dynamodb/
|
||||
# TernJS port file
|
||||
# .tern-port
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
# .vscode-test
|
||||
# nyc test coverage
|
||||
# coverage
|
||||
# .nyc_output
|
||||
# ---> Bruno (keep relevant parts)
|
||||
# Bruno collection file
|
||||
bruno/collection.bru
|
||||
# Generated static assets
|
||||
cmd/server/static/
|
||||
# Built binaries (keep for now - remove if desired)
|
||||
main
|
||||
server
|
||||
# Generated templ files (keep)
|
||||
templates/*_templ.go
|
||||
*.log
|
||||
*.log.*
|
||||
|
||||
uploads/
|
||||
# Environment
|
||||
.env
|
||||
!.env.example
|
||||
@@ -1,104 +0,0 @@
|
||||
# Documentation Updates Summary
|
||||
|
||||
This document summarizes all documentation changes made to keep the codebase consistent with API improvements.
|
||||
|
||||
## 🔄 Recent API Consistency Changes
|
||||
|
||||
### 1. **Unified API Structure**
|
||||
- **User Management**: All endpoints now use `/api/auth/*` prefix
|
||||
- **Library Management**: All endpoints use `/api/library/*` prefix
|
||||
- **Ebook Folders**: All endpoints use `/api/auth/ebook-folders` (admin-only)
|
||||
|
||||
### 2. **Updated Endpoint Mappings**
|
||||
|
||||
| Previous | Current | Function |
|
||||
|----------|---------|----------|
|
||||
| `/api/user/username` | `/api/auth/username` | Update username |
|
||||
| `/api/user/email` | `/api/auth/email` | Update email |
|
||||
| `/api/user/password` | `/api/auth/password` | Update password |
|
||||
| `/api/user/account` | `/api/auth/account` | Delete account |
|
||||
|
||||
### 3. **Enhanced Security Logic**
|
||||
- **Admin Protection**: Updated deletion logic to prevent deleting last **admin user** (not just last user)
|
||||
- **More Secure**: Ensures system always has administrative access
|
||||
|
||||
## 📝 Updated Documentation Files
|
||||
|
||||
### 1. **README.md**
|
||||
✅ Updated all API endpoint references to use consistent `/api/auth/*` structure
|
||||
✅ Fixed deletion protection description from "last user" to "last admin"
|
||||
✅ All endpoint documentation now matches actual implementation
|
||||
|
||||
### 2. **bruno/README.md**
|
||||
✅ Already correctly documented with consistent API structure
|
||||
✅ Comprehensive API testing documentation maintained
|
||||
|
||||
### 3. **bruno/user/Delete Account.bru**
|
||||
✅ Updated endpoint documentation from `/api/user/account` to `/api/auth/account`
|
||||
|
||||
### 4. **Internal Handler Comments** (`internal/handlers/auth.go`)
|
||||
✅ Updated all handler comment blocks to reference correct endpoints:
|
||||
- `ListUsers` → `/api/auth/users`
|
||||
- `UpdateUsername` → `/api/auth/username`
|
||||
- `UpdateEmail` → `/api/auth/email`
|
||||
- `UpdatePassword` → `/api/auth/password`
|
||||
- `DeleteAccount` → `/api/auth/account`
|
||||
|
||||
### 5. **Template Files** (`templates/admin_profile.templ`)
|
||||
✅ Updated HTMX form endpoints:
|
||||
- Username form: `/api/user/username` → `/api/auth/username`
|
||||
- Email form: `/api/user/email` → `/api/auth/email`
|
||||
- Password form: `/api/user/password` → `/api/auth/password`
|
||||
|
||||
## 🎯 Complete API Documentation
|
||||
|
||||
### Authentication (Public)
|
||||
- `POST /api/auth/register` - Register new user
|
||||
- `POST /api/auth/login` - Login user
|
||||
|
||||
### User Management (Protected)
|
||||
- `GET /api/auth/profile` - Get user profile
|
||||
- `PUT /api/auth/profile` - Update profile
|
||||
- `PUT /api/auth/username` - Update username
|
||||
- `PUT /api/auth/email` - Update email
|
||||
- `PUT /api/auth/password` - Update password
|
||||
- `PUT /api/auth/theme` - Update theme
|
||||
- `DELETE /api/auth/account` - Delete account ⚠️ *Cannot delete last admin*
|
||||
|
||||
### Admin Operations (Admin Only)
|
||||
- `GET /api/auth/users` - List all users
|
||||
- `POST /api/auth/ebook-folders` - Add folder
|
||||
- `GET /api/auth/ebook-folders` - List folders
|
||||
- `DELETE /api/auth/ebook-folders` - Remove folder
|
||||
|
||||
### Library Management (Admin Only)
|
||||
- `PUT /api/library/scan-settings` - Update scan settings
|
||||
- `GET /api/library/scan-settings` - Get scan settings
|
||||
|
||||
### Ebooks & Progress (All Authenticated Users)
|
||||
- `GET /api/ebooks` - List ebooks
|
||||
- `GET /api/ebooks/:id` - Get ebook details
|
||||
- `GET /api/ebooks/:id/progress` - Get reading progress
|
||||
- `PUT /api/ebooks/:id/progress` - Update progress
|
||||
- `GET /api/ebooks/:id/rating` - Get rating
|
||||
- `POST /api/ebooks/:id/rating` - Create/update rating
|
||||
- `DELETE /api/ebooks/:id/rating` - Delete rating
|
||||
- `GET /api/ebooks/:id/ratings` - Get all ratings
|
||||
|
||||
## 🔄 Build & Deployment
|
||||
|
||||
All changes have been incorporated into the Docker build process:
|
||||
- Templates are regenerated with `templ generate`
|
||||
- API consistency is enforced through build process
|
||||
- Documentation stays in sync with implementation
|
||||
|
||||
## 📋 Testing
|
||||
|
||||
**Bruno Collection**: All API tests updated to match consistent endpoint structure
|
||||
**Authentication Flow**: Register → Login → Use Bearer token for protected routes
|
||||
**Role Testing**: Admin protection verified for critical operations
|
||||
|
||||
---
|
||||
|
||||
*Last Updated: January 27, 2026*
|
||||
*API Version: v1 - Consistent Endpoint Structure*
|
||||
@@ -1,21 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
func NewConnection(databaseURL string) (*pgxpool.Pool, error) {
|
||||
config, err := pgxpool.ParseConfig(databaseURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pool, err := pgxpool.NewWithConfig(context.Background(), config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return pool, nil
|
||||
}
|
||||
@@ -14,19 +14,31 @@ type Querier interface {
|
||||
// Library Folders queries
|
||||
AddLibraryFolder(ctx context.Context, arg AddLibraryFolderParams) (LibraryFolders, error)
|
||||
CreateEbook(ctx context.Context, arg CreateEbookParams) (MediaItems, error)
|
||||
// Backward compatibility - Ebook Highlights queries (using views)
|
||||
CreateEbookHighlight(ctx context.Context, arg CreateEbookHighlightParams) (MediaHighlights, error)
|
||||
// Backward compatibility - Ebook Notes queries (using views)
|
||||
CreateEbookNote(ctx context.Context, arg CreateEbookNoteParams) (MediaNotes, error)
|
||||
// Backward compatibility - Ebooks ratings (using views)
|
||||
CreateEbookRating(ctx context.Context, arg CreateEbookRatingParams) (MediaRatings, error)
|
||||
// Libraries queries
|
||||
CreateLibrary(ctx context.Context, arg CreateLibraryParams) (Libraries, error)
|
||||
// Media Highlights queries
|
||||
CreateMediaHighlight(ctx context.Context, arg CreateMediaHighlightParams) (MediaHighlights, error)
|
||||
// Media Items queries
|
||||
CreateMediaItem(ctx context.Context, arg CreateMediaItemParams) (MediaItems, error)
|
||||
// Media Notes queries
|
||||
CreateMediaNote(ctx context.Context, arg CreateMediaNoteParams) (MediaNotes, error)
|
||||
CreateMediaRating(ctx context.Context, arg CreateMediaRatingParams) (MediaRatings, error)
|
||||
CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error)
|
||||
DeleteEbook(ctx context.Context, id pgtype.UUID) error
|
||||
DeleteEbookHighlight(ctx context.Context, id pgtype.UUID) error
|
||||
DeleteEbookNote(ctx context.Context, id pgtype.UUID) error
|
||||
DeleteEbookRating(ctx context.Context, arg DeleteEbookRatingParams) error
|
||||
DeleteLibrary(ctx context.Context, id pgtype.UUID) error
|
||||
DeleteLibraryFolder(ctx context.Context, arg DeleteLibraryFolderParams) (LibraryFolders, error)
|
||||
DeleteMediaHighlight(ctx context.Context, id pgtype.UUID) error
|
||||
DeleteMediaItem(ctx context.Context, id pgtype.UUID) error
|
||||
DeleteMediaNote(ctx context.Context, id pgtype.UUID) error
|
||||
DeleteMediaRating(ctx context.Context, arg DeleteMediaRatingParams) error
|
||||
DeleteReadingProgress(ctx context.Context, arg DeleteReadingProgressParams) error
|
||||
DeleteUser(ctx context.Context, id pgtype.UUID) error
|
||||
@@ -35,6 +47,10 @@ type Querier interface {
|
||||
// Note: User ebook folders replaced by library folders system
|
||||
// Legacy folder management is now handled through libraries
|
||||
GetEbookByFilePath(ctx context.Context, filePath string) (Ebooks, error)
|
||||
GetEbookHighlight(ctx context.Context, id pgtype.UUID) (EbookHighlights, error)
|
||||
GetEbookHighlights(ctx context.Context, arg GetEbookHighlightsParams) ([]EbookHighlights, error)
|
||||
GetEbookNote(ctx context.Context, id pgtype.UUID) (EbookNotes, error)
|
||||
GetEbookNotes(ctx context.Context, arg GetEbookNotesParams) ([]EbookNotes, error)
|
||||
GetEbookRating(ctx context.Context, arg GetEbookRatingParams) (EbookRatings, error)
|
||||
GetEbookRatings(ctx context.Context, ebookID pgtype.UUID) ([]GetEbookRatingsRow, error)
|
||||
GetLibrary(ctx context.Context, id pgtype.UUID) (GetLibraryRow, error)
|
||||
@@ -44,8 +60,12 @@ type Querier interface {
|
||||
// Library Types queries
|
||||
GetLibraryTypes(ctx context.Context) ([]LibraryTypes, error)
|
||||
GetLibraryVisibility(ctx context.Context, arg GetLibraryVisibilityParams) (LibraryVisibility, error)
|
||||
GetMediaHighlight(ctx context.Context, id pgtype.UUID) (MediaHighlights, error)
|
||||
GetMediaHighlights(ctx context.Context, arg GetMediaHighlightsParams) ([]MediaHighlights, error)
|
||||
GetMediaItem(ctx context.Context, id pgtype.UUID) (MediaItems, error)
|
||||
GetMediaItemByFilePath(ctx context.Context, filePath string) (MediaItems, error)
|
||||
GetMediaNote(ctx context.Context, id pgtype.UUID) (MediaNotes, error)
|
||||
GetMediaNotes(ctx context.Context, arg GetMediaNotesParams) ([]MediaNotes, error)
|
||||
GetMediaRating(ctx context.Context, arg GetMediaRatingParams) (MediaRatings, error)
|
||||
GetMediaRatings(ctx context.Context, mediaItemID pgtype.UUID) ([]GetMediaRatingsRow, error)
|
||||
GetReadingProgress(ctx context.Context, arg GetReadingProgressParams) (ReadingProgress, error)
|
||||
@@ -65,10 +85,14 @@ type Querier interface {
|
||||
// Library Visibility queries
|
||||
SetLibraryVisibility(ctx context.Context, arg SetLibraryVisibilityParams) (LibraryVisibility, error)
|
||||
UpdateEbook(ctx context.Context, arg UpdateEbookParams) (MediaItems, error)
|
||||
UpdateEbookHighlight(ctx context.Context, arg UpdateEbookHighlightParams) (MediaHighlights, error)
|
||||
UpdateEbookNote(ctx context.Context, arg UpdateEbookNoteParams) (MediaNotes, error)
|
||||
UpdateEbookRating(ctx context.Context, arg UpdateEbookRatingParams) (MediaRatings, error)
|
||||
UpdateEmail(ctx context.Context, arg UpdateEmailParams) error
|
||||
UpdateLibrary(ctx context.Context, arg UpdateLibraryParams) (Libraries, error)
|
||||
UpdateMediaHighlight(ctx context.Context, arg UpdateMediaHighlightParams) (MediaHighlights, error)
|
||||
UpdateMediaItem(ctx context.Context, arg UpdateMediaItemParams) (MediaItems, error)
|
||||
UpdateMediaNote(ctx context.Context, arg UpdateMediaNoteParams) (MediaNotes, error)
|
||||
UpdateMediaRating(ctx context.Context, arg UpdateMediaRatingParams) (MediaRatings, error)
|
||||
UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error
|
||||
UpdateReadingProgress(ctx context.Context, arg UpdateReadingProgressParams) (ReadingProgress, error)
|
||||
|
||||
Reference in New Issue
Block a user