refactor: remove user management tables and unused account/notification_preference tables
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// sqlc v1.31.1
|
||||
|
||||
package database
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// sqlc v1.31.1
|
||||
|
||||
package database
|
||||
|
||||
@@ -9,14 +9,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
Provider string `json:"provider"`
|
||||
ProviderAccountID string `json:"provider_account_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type Anime struct {
|
||||
ID int64 `json:"id"`
|
||||
TitleOriginal string `json:"title_original"`
|
||||
@@ -61,13 +53,6 @@ type JikanCache struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type NotificationPreference struct {
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
NotifyNewEpisodes bool `json:"notify_new_episodes"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// sqlc v1.31.1
|
||||
|
||||
package database
|
||||
|
||||
@@ -11,13 +11,10 @@ import (
|
||||
type Querier interface {
|
||||
CountPendingAnimeFetchRetries(ctx context.Context) (int64, error)
|
||||
CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
|
||||
CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
|
||||
DeleteAnimeFetchRetry(ctx context.Context, animeID int64) error
|
||||
DeleteContinueWatchingEntry(ctx context.Context, arg DeleteContinueWatchingEntryParams) error
|
||||
DeleteExpiredJikanCache(ctx context.Context) error
|
||||
DeleteSession(ctx context.Context, id string) error
|
||||
DeleteUser(ctx context.Context, id string) error
|
||||
DeleteUserSessions(ctx context.Context, userID string) error
|
||||
DeleteWatchListEntry(ctx context.Context, arg DeleteWatchListEntryParams) error
|
||||
EnqueueAnimeFetchRetry(ctx context.Context, arg EnqueueAnimeFetchRetryParams) error
|
||||
GetAnime(ctx context.Context, id int64) (Anime, error)
|
||||
@@ -34,7 +31,6 @@ type Querier interface {
|
||||
GetUserWatchList(ctx context.Context, userID string) ([]GetUserWatchListRow, error)
|
||||
GetWatchListEntry(ctx context.Context, arg GetWatchListEntryParams) (WatchListEntry, error)
|
||||
GetWatchingAnime(ctx context.Context, userID string) ([]GetWatchingAnimeRow, error)
|
||||
ListUsers(ctx context.Context) ([]User, error)
|
||||
MarkAnimeFetchRetryFailed(ctx context.Context, arg MarkAnimeFetchRetryFailedParams) error
|
||||
MarkRelationsSynced(ctx context.Context, id int64) error
|
||||
SaveWatchProgress(ctx context.Context, arg SaveWatchProgressParams) error
|
||||
|
||||
@@ -4,17 +4,6 @@ SELECT * FROM user WHERE id = ? LIMIT 1;
|
||||
-- name: GetUserByUsername :one
|
||||
SELECT * FROM user WHERE username = ? LIMIT 1;
|
||||
|
||||
-- name: ListUsers :many
|
||||
SELECT * FROM user ORDER BY created_at DESC;
|
||||
|
||||
-- name: DeleteUser :exec
|
||||
DELETE FROM user WHERE id = ?;
|
||||
|
||||
-- name: CreateUser :one
|
||||
INSERT INTO user (id, username, password_hash)
|
||||
VALUES (?, ?, ?)
|
||||
RETURNING *;
|
||||
|
||||
-- name: CreateSession :one
|
||||
INSERT INTO session (id, user_id, expires_at)
|
||||
VALUES (?, ?, ?)
|
||||
@@ -26,9 +15,6 @@ SELECT * FROM session WHERE id = ? LIMIT 1;
|
||||
-- name: DeleteSession :exec
|
||||
DELETE FROM session WHERE id = ?;
|
||||
|
||||
-- name: DeleteUserSessions :exec
|
||||
DELETE FROM session WHERE user_id = ?;
|
||||
|
||||
-- name: UpsertAnime :one
|
||||
INSERT INTO anime (id, title_original, title_english, title_japanese, image_url, airing)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// sqlc v1.31.1
|
||||
// source: queries.sql
|
||||
|
||||
package database
|
||||
@@ -48,30 +48,6 @@ func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (S
|
||||
return i, err
|
||||
}
|
||||
|
||||
const createUser = `-- name: CreateUser :one
|
||||
INSERT INTO user (id, username, password_hash)
|
||||
VALUES (?, ?, ?)
|
||||
RETURNING id, username, password_hash, created_at
|
||||
`
|
||||
|
||||
type CreateUserParams struct {
|
||||
ID string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
|
||||
row := q.db.QueryRowContext(ctx, createUser, arg.ID, arg.Username, arg.PasswordHash)
|
||||
var i User
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Username,
|
||||
&i.PasswordHash,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteAnimeFetchRetry = `-- name: DeleteAnimeFetchRetry :exec
|
||||
DELETE FROM anime_fetch_retry
|
||||
WHERE anime_id = ?
|
||||
@@ -115,24 +91,6 @@ func (q *Queries) DeleteSession(ctx context.Context, id string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteUser = `-- name: DeleteUser :exec
|
||||
DELETE FROM user WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteUser(ctx context.Context, id string) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteUser, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteUserSessions = `-- name: DeleteUserSessions :exec
|
||||
DELETE FROM session WHERE user_id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteUserSessions(ctx context.Context, userID string) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteUserSessions, userID)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteWatchListEntry = `-- name: DeleteWatchListEntry :exec
|
||||
DELETE FROM watch_list_entry
|
||||
WHERE user_id = ? AND anime_id = ?
|
||||
@@ -697,38 +655,6 @@ func (q *Queries) GetWatchingAnime(ctx context.Context, userID string) ([]GetWat
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listUsers = `-- name: ListUsers :many
|
||||
SELECT id, username, password_hash, created_at FROM user ORDER BY created_at DESC
|
||||
`
|
||||
|
||||
func (q *Queries) ListUsers(ctx context.Context) ([]User, error) {
|
||||
rows, err := q.db.QueryContext(ctx, listUsers)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []User
|
||||
for rows.Next() {
|
||||
var i User
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Username,
|
||||
&i.PasswordHash,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const markAnimeFetchRetryFailed = `-- name: MarkAnimeFetchRetryFailed :exec
|
||||
UPDATE anime_fetch_retry
|
||||
SET attempts = attempts + 1,
|
||||
|
||||
2
migrations/013_drop_account.sql
Normal file
2
migrations/013_drop_account.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS account;
|
||||
DROP TABLE IF EXISTS notification_preference;
|
||||
Reference in New Issue
Block a user