nkbmusic/admin/README.md
metatroncubeswdev cf645071aa Add NK Admin dashboard (Flutter web) for admin.nkbmusic.com
Email-code sign-in for admins only; Overview with a needs-attention list;
Songs with search, playback, editing, approve/hide and bulk edit; Albums
and Singers with merge; creator applications queue. Adds the admin views,
functions and creator_applications table, a deploy-admin script and a
how-to guide. The admin nginx config no longer caches unhashed JS and
sends its security headers again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 11:35:44 -04:00

65 lines
3.5 KiB
Markdown

# NK Admin
The website at **https://admin.nkbmusic.com** for managing the Nanga Kathai catalog. Only admin accounts can sign in.
## Signing in
1. Open https://admin.nkbmusic.com and enter your email.
2. Type the 6-digit code from the email ("Your Nanga Kathai sign-in code").
3. Only accounts with the admin role get in. Anyone else is signed straight out.
**To make someone an admin**, they first sign up in the app. Then open Studio (https://app.nkbmusic.com) → SQL editor and run:
```sql
update profiles set role = 'admin'
where id = (select id from auth.users where email = 'person@example.com');
```
## Pages
| Page | What you do there |
|------|-------------------|
| **Overview** | Counts, plus a **Needs attention** list (songs to review, creator applications, songs without a singer or album, empty albums). Click a line to open the matching list. |
| **Songs** | Search by title, singer or album and filter with the chips (Waiting for review, Live, Hidden, No singer, No album…). Use ▶ to listen. Click a row to edit its title, Tamil title, meaning, year, album, occasion, singers and status. |
| **Albums** | Rename albums or add new ones. Click an album to see its songs. Use **⋮ → Merge** for duplicates and **Delete** for empty albums. |
| **Singers** | Edit names, village/hatti and bio, and mark singers *Verified*. Click a singer to see their songs. Use **⋮ → Merge** when someone was entered twice. |
| **Creators** | Applications from people who say they are singers or creators. Check their links and **View ID**, then **Approve**, **Ask for more** or **Reject**. |
### Publishing songs
- A song only appears in the app once its status is **Live**. Use **✓** on the row or **Approve** in the bulk bar.
- **Hide** (the crossed-out eye) takes a song out of the app at once and keeps it in the catalog.
- A song without an audio file can't be approved.
### Editing many songs at once
1. Tick the songs. The header checkbox selects the whole page.
2. In the bar that appears, use **Approve**, **Hide** or **Edit…**.
3. In **Edit…**, tick only the fields to change: album, occasion, singers or status.
- **Singers → Add to existing** keeps the current singers and adds yours.
- **Singers → Replace all** removes the current singers and sets yours.
In the album and singer boxes, type to search. If the name isn't there, pick **New album "…"** or **New singer "…"** to create it on the spot. Drag singers to change their order (the first is the lead).
### Approving a creator
When you approve someone, choose their existing singer profile if they are already in the catalog. Their songs are then linked to their account. If you choose nobody, a new verified singer is created. Approval also gives their account the *artist* role. The ID document is private: **View ID** opens a link that works for 10 minutes.
## Publishing a new version (developers)
Run from your own computer in the repo root (needs Flutter, ssh and tar; Git Bash on Windows):
```sh
sh admin/deploy-admin.sh
```
It builds the site with the app's `env.json`, uploads it into `~/APPS/nk-backend/supabase-project/nk/admin` on the server and reloads the `nk-admin` container (127.0.0.1:18080). HestiaCP proxies admin.nkbmusic.com to that container. The script warns if the database migration is missing.
Database changes (`supabase/migrations/*_admin.sql`) go out the usual way: push to git, then on the server run
```sh
sh ~/APPS/nanga_kathai/server/update.sh
```
To run it locally: `cd admin && flutter run -d chrome --dart-define-from-file=../env.json`.