From f6f2fb3a35604c5e1de205e6b6e4064180cd77aa Mon Sep 17 00:00:00 2001 From: Web-serfer Date: Wed, 15 Apr 2026 19:32:21 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BD=D0=B0=20=D1=81=D0=B0=D0=B9?= =?UTF-8?q?=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pb_migrations/1776262072_updated_users.js | 47 ++++++++++++++++ .../pb_migrations/1776262083_updated_users.js | 53 +++++++++++++++++++ .../src/components/layout/header/Header.astro | 3 +- frontend/src/lib/pb.ts | 2 +- frontend/src/pages/api/auth/sign-in.ts | 2 +- frontend/src/pages/api/posts/index.ts | 4 +- frontend/tsconfig.json | 1 - 7 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 backend/pb_migrations/1776262072_updated_users.js create mode 100644 backend/pb_migrations/1776262083_updated_users.js diff --git a/backend/pb_migrations/1776262072_updated_users.js b/backend/pb_migrations/1776262072_updated_users.js new file mode 100644 index 0000000..30f9e35 --- /dev/null +++ b/backend/pb_migrations/1776262072_updated_users.js @@ -0,0 +1,47 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "oauth2": { + "mappedFields": { + "name": "" + } + } + }, collection) + + // remove field + collection.fields.removeById("text1579384326") + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "oauth2": { + "mappedFields": { + "name": "name" + } + } + }, collection) + + // add field + collection.fields.addAt(6, new Field({ + "autogeneratePattern": "", + "hidden": false, + "id": "text1579384326", + "max": 255, + "min": 0, + "name": "name", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + })) + + return app.save(collection) +}) diff --git a/backend/pb_migrations/1776262083_updated_users.js b/backend/pb_migrations/1776262083_updated_users.js new file mode 100644 index 0000000..16b9d84 --- /dev/null +++ b/backend/pb_migrations/1776262083_updated_users.js @@ -0,0 +1,53 @@ +/// +migrate((app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "oauth2": { + "mappedFields": { + "avatarURL": "" + } + } + }, collection) + + // remove field + collection.fields.removeById("file376926767") + + return app.save(collection) +}, (app) => { + const collection = app.findCollectionByNameOrId("_pb_users_auth_") + + // update collection data + unmarshal({ + "oauth2": { + "mappedFields": { + "avatarURL": "avatar" + } + } + }, collection) + + // add field + collection.fields.addAt(8, new Field({ + "hidden": false, + "id": "file376926767", + "maxSelect": 1, + "maxSize": 0, + "mimeTypes": [ + "image/jpeg", + "image/png", + "image/svg+xml", + "image/gif", + "image/webp" + ], + "name": "avatar", + "presentable": false, + "protected": false, + "required": false, + "system": false, + "thumbs": null, + "type": "file" + })) + + return app.save(collection) +}) diff --git a/frontend/src/components/layout/header/Header.astro b/frontend/src/components/layout/header/Header.astro index f86c75c..a45972f 100644 --- a/frontend/src/components/layout/header/Header.astro +++ b/frontend/src/components/layout/header/Header.astro @@ -350,10 +350,11 @@ import { COMPANY } from "@constants"; // Скрываем телефон, показываем аватар и кнопку выхода if (phoneEl) phoneEl.style.display = 'none'; + const displayName = user.name || user.email || 'Пользователь'; authSection.innerHTML = `
-
${firstLetter}
+
${firstLetter}