diff --git a/README.md b/README.md
index 396d4bf..7de4925 100644
--- a/README.md
+++ b/README.md
@@ -71,17 +71,19 @@ For `PATCH /api/company/:id`:
| Method | Signature | Returns |
| --- | --- | --- |
| `add` | `(email)` | `id` |
-| `getByEmail` | `(email)` | `{ id, email, picture, sub, createdAt, selectedCompanyId } \| undefined` |
-| `listAllowedEmails` | `()` | `{ id, email, picture, sub, createdAt, selectedCompanyId }[]` |
+| `getByEmail` | `(email)` | `{ id, email, picture, pictureBinary, sub, createdAt, selectedCompanyId } \| undefined` |
+| `getById` | `(googleAuthId)` | `{ id, email, picture, pictureBinary, sub, createdAt, selectedCompanyId } \| undefined` |
+| `listAllowedEmails` | `()` | `{ id, email, picture, sub, createdAt, selectedCompanyId }[]` (no `pictureBinary`) |
| `removeAllowedEmail` | `(email)` | `void` |
| `setSelectedCompany` | `(googleAuthId, companyId)` | `void` |
-| `setProfile` | `(googleAuthId, { picture?: string \| null, sub?: string \| null })` | `void` |
+| `setProfile` | `(googleAuthId, { picture?: string \| null, pictureBinary?: Buffer \| null, sub?: string \| null })` | `void` |
-`picture` / `sub` come from the Google ID token (`payload.picture`, `payload.sub`). `sub` is Google’s stable subject id (unique when set). `setProfile` overwrites both columns (pass `null` to clear). Errors: `User not found`.
+`picture` is the Google profile image URL (kept for change detection / re-fetch). `picturebinary` stores the downloaded image bytes (`pictureBinary` in JS, `Buffer` from mssql). `sub` is Google’s stable subject id (unique when set). `setProfile` overwrites `picture`, `pictureBinary`, and `sub` (pass `null` to clear). Non-Buffer `pictureBinary` → `Invalid pictureBinary`. Errors: `User not found`.
Backend mapping:
-- Login: `getByEmail(email)` then `setProfile(id, { picture, sub })` from the verified token
+- Login: `getByEmail(email)` then download `payload.picture` → `setProfile(id, { picture, pictureBinary, sub })`
+- `/auth/me`: `getById(googleAuthId)` → base64-encode `pictureBinary` for the response
- CLI user manager: `listAllowedEmails()` / `removeAllowedEmail(email)` / `add(email)`
- `PUT /api/auth/selected-company`: `setSelectedCompany(googleAuthId, companyId)`
diff --git a/schema-graph.dot b/schema-graph.dot
index 61ab8a2..1b5d6f3 100644
--- a/schema-graph.dot
+++ b/schema-graph.dot
@@ -17,7 +17,7 @@ digraph schema {
meta [label=<
>];
customergroup [label=<>];
companysetting [label=<>];
- google_auth [label=<>];
+ google_auth [label=< |
|
|
|
|
| picturebinary? | VARBINARY(MAX) |
|
|
|
>];
}
subgraph cluster_i18n {
label="Localization"; labeljust="l"; fontsize=15;
@@ -72,7 +72,7 @@ digraph schema {
__legend [label=<| Legend |
| PK | primary key |
| FK | foreign key |
| ? | nullable column |
| — | FOREIGN KEY constraint |
| - - | naming convention only, no constraint |
>];
- google_auth:selected_company:sw -> company:in8:n [color="#c53030", fontcolor="#c53030", tooltip="FK_google_auth_selected_company"];
+ google_auth:selected_company:w -> company:in8:n [color="#c53030", fontcolor="#c53030", tooltip="FK_google_auth_selected_company"];
category:parent_id:e -> category:id:e [color="#2f855a", fontcolor="#2f855a", tooltip="FK_category_parent"];
company:root_category_id:w -> category:in5:n [color="#2b6cb0", fontcolor="#2b6cb0", tooltip="FK_company_root_category"];
company:default_language_id:w -> language:in3:n [color="#b7791f", fontcolor="#b7791f", tooltip="FK_company_default_language"];
diff --git a/schema-graph.svg b/schema-graph.svg
index 765783f..947dd0e 100644
--- a/schema-graph.svg
+++ b/schema-graph.svg
@@ -4,30 +4,30 @@
-