mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-03 20:12:58 +00:00
954a1a1080
- Replace Redis with DragonflyDB for better performance and memory efficiency - Remove redundant environment variables (POSTGRES_*, ENCRYPTION_KEY, OAUTH_SERVICE_URL) - Consolidate database configuration to use single DB_* variables - Use JWT_SECRET for both JWT tokens and encryption - Remove PORT variable redundancy, use BACKEND_PORT consistently - Clean up docker-compose configurations for dev/prod consistency - Add DragonflyDB configuration with optimized memory usage - Remove redis.conf as it's no longer needed - Update health checks to use Redis-compatible CLI for DragonflyDB - Add missing VITE_API_URL to production frontend - Fix GitHub Actions to use correct go.sum path - Clean up development directories and unused files
59 lines
2.1 KiB
SQL
59 lines
2.1 KiB
SQL
-- name: GetBookmarkByID :one
|
|
SELECT id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
|
|
FROM bookmarks
|
|
WHERE id = $1 AND user_id = $2 LIMIT 1;
|
|
|
|
-- name: GetBookmarksByUser :many
|
|
SELECT id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
|
|
FROM bookmarks
|
|
WHERE user_id = $1
|
|
ORDER BY created_at DESC
|
|
LIMIT $2 OFFSET $3;
|
|
|
|
-- name: GetBookmarksByTag :many
|
|
SELECT b.id, b.title, b.url, b.description, b.favicon_url, b.screenshot_url, b.user_id, b.is_archived, b.is_favorite, b.created_at, b.updated_at
|
|
FROM bookmarks b
|
|
INNER JOIN bookmark_tags bt ON b.id = bt.bookmark_id
|
|
INNER JOIN tags t ON bt.tag_id = t.id
|
|
WHERE t.id = $1 AND b.user_id = $2
|
|
ORDER BY b.created_at DESC
|
|
LIMIT $3 OFFSET $4;
|
|
|
|
-- name: SearchBookmarks :many
|
|
SELECT id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
|
|
FROM bookmarks
|
|
WHERE user_id = $1 AND (
|
|
title ILIKE $2 OR
|
|
description ILIKE $2 OR
|
|
url ILIKE $2
|
|
)
|
|
ORDER BY created_at DESC
|
|
LIMIT $3 OFFSET $4;
|
|
|
|
-- name: CreateBookmark :one
|
|
INSERT INTO bookmarks (title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
|
RETURNING id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at;
|
|
|
|
-- name: UpdateBookmark :one
|
|
UPDATE bookmarks
|
|
SET title = $2,
|
|
url = $3,
|
|
description = $4,
|
|
favicon_url = $5,
|
|
screenshot_url = $6,
|
|
is_archived = $7,
|
|
is_favorite = $8,
|
|
updated_at = CURRENT_TIMESTAMP
|
|
WHERE id = $1 AND user_id = $9
|
|
RETURNING id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at;
|
|
|
|
-- name: DeleteBookmark :exec
|
|
DELETE FROM bookmarks WHERE id = $1 AND user_id = $2;
|
|
|
|
-- name: AddBookmarkTag :exec
|
|
INSERT INTO bookmark_tags (bookmark_id, tag_id) VALUES ($1, $2) ON CONFLICT DO NOTHING;
|
|
|
|
-- name: RemoveBookmarkTag :exec
|
|
DELETE FROM bookmark_tags WHERE bookmark_id = $1 AND tag_id = $2;
|