Новые правки на сайте
This commit is contained in:
parent
261d5db2d7
commit
f6f2fb3a35
7 changed files with 106 additions and 6 deletions
47
backend/pb_migrations/1776262072_updated_users.js
Normal file
47
backend/pb_migrations/1776262072_updated_users.js
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
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)
|
||||||
|
})
|
||||||
53
backend/pb_migrations/1776262083_updated_users.js
Normal file
53
backend/pb_migrations/1776262083_updated_users.js
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
|
@ -350,10 +350,11 @@ import { COMPANY } from "@constants";
|
||||||
|
|
||||||
// Скрываем телефон, показываем аватар и кнопку выхода
|
// Скрываем телефон, показываем аватар и кнопку выхода
|
||||||
if (phoneEl) phoneEl.style.display = 'none';
|
if (phoneEl) phoneEl.style.display = 'none';
|
||||||
|
const displayName = user.name || user.email || 'Пользователь';
|
||||||
|
|
||||||
authSection.innerHTML = `
|
authSection.innerHTML = `
|
||||||
<div class="user-display">
|
<div class="user-display">
|
||||||
<div class="user-avatar" title="${user.name || user.email}">${firstLetter}</div>
|
<div class="user-avatar" title="${displayName}">${firstLetter}</div>
|
||||||
<button class="logout-btn" id="logout-btn" title="Выйти">
|
<button class="logout-btn" id="logout-btn" title="Выйти">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
|
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export async function getPosts(options?: {
|
||||||
return {
|
return {
|
||||||
posts: (result.items || []) as unknown as Post[],
|
posts: (result.items || []) as unknown as Post[],
|
||||||
total: result.totalItems || 0,
|
total: result.totalItems || 0,
|
||||||
page: (result.pageInfo?.page || 1),
|
page: result.page || 1,
|
||||||
totalPages: result.totalPages || 1,
|
totalPages: result.totalPages || 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export const POST: APIRoute = async ({ request, cookies }) => {
|
||||||
token: authData.token,
|
token: authData.token,
|
||||||
user: {
|
user: {
|
||||||
id: authData.record.id,
|
id: authData.record.id,
|
||||||
name: authData.record.name || authData.record.firstName,
|
name: authData.record.firstName,
|
||||||
email: authData.record.email,
|
email: authData.record.email,
|
||||||
}
|
}
|
||||||
}), { status: 200 });
|
}), { status: 200 });
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ export const GET: APIRoute = async ({ url }) => {
|
||||||
image: getImageUrl(post),
|
image: getImageUrl(post),
|
||||||
})),
|
})),
|
||||||
total: result.totalItems,
|
total: result.totalItems,
|
||||||
page: result.pageInfo.page,
|
page: result.page,
|
||||||
perPage: result.pageInfo.perPage,
|
perPage: result.perPage,
|
||||||
totalPages: result.totalPages,
|
totalPages: result.totalPages,
|
||||||
}), { status: 200 });
|
}), { status: 200 });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
"include": [".astro/types.d.ts", "**/*"],
|
"include": [".astro/types.d.ts", "**/*"],
|
||||||
"exclude": ["dist"],
|
"exclude": ["dist"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"ignoreDeprecations": "6.0",
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@styles/*": ["src/styles/*"],
|
"@styles/*": ["src/styles/*"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue