Add initial database setup and user/artist management functionality

This commit is contained in:
zardzul
2026-03-13 20:42:50 +01:00
parent 5fa23b0d1c
commit f81b28417e
26 changed files with 585 additions and 64 deletions
+6
View File
@@ -0,0 +1,6 @@
-- albums.sql
-- name: GetAlbumByID :one
SELECT * FROM albums WHERE id = $1;
-- name: GetAllAlbums :many
SELECT * FROM albums;
+9
View File
@@ -0,0 +1,9 @@
-- artists.sql
-- name: GetArtistByID :one
SELECT * FROM artists WHERE id = $1;
-- name: GetAllArtists :many
SELECT * FROM artists;
-- name: CreateArtist :one
INSERT INTO artists (id, name, genre, bio, artist_image_url) VALUES ($1, $2, $3, $4, $5) RETURNING id;
+9
View File
@@ -0,0 +1,9 @@
-- user_albums.sql
-- name: UpdateUserAlbumStatus :exec
INSERT INTO user_albums (user_id, album_id, album_owned, album_want,
is_vinyl, is_cd) VALUES ($1, $2, $3, $4, $5, $6)
ON CONFLICT (user_id, album_id) DO UPDATE SET
album_owned = EXCLUDED.album_owned,
album_want = EXCLUDED.album_want,
is_vinyl = EXCLUDED.is_vinyl,
is_cd = EXCLUDED.is_cd;
+5 -2
View File
@@ -2,5 +2,8 @@
-- name: GetUsernameByID :one
SELECT user_name FROM users WHERE id = $1;
-- name: checkUserExistsByEmail :one
SELECT id FROM users WHERE user_mail = $1;
-- name: CheckUserExistsByEmail :one
SELECT id FROM users WHERE user_mail = $1;
-- name: CreateUser :one
INSERT INTO users (id, user_name, user_mail, password) VALUES ($1, $2, $3, $4) RETURNING id;