feat: user signature (设置页编辑 + 帖子底部显示)
- schema: users.signature column (upstream aligned) - API: posts query JOIN signature, /auth/me returns signature, PUT /users/:id updates signature - Settings: signature textarea (Markdown hint), saved with profile - PostDetail: signature shown under post content with divider - README: remove upstream DB schema note (fixed upstream)
This commit is contained in:
1 parent
c8dcf32dd4
commit
694fa2bfaf
6 files changed
+16
-8
No files matched your search
@@ -9,7 +9,7 @@ export async function GET(req) {
|
||||
}
|
||||
try {
|
||||
const r = await pool.query(
|
||||
'SELECT id, username, avatar_url, bio, role, created_at FROM users WHERE id = $1',
|
||||
'SELECT id, username, avatar_url, bio, signature, role, created_at FROM users WHERE id = $1',
|
||||
[user.id]
|
||||
);
|
||||
if (!r.rows[0]) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function PUT(req, { params }) {
|
||||
return Response.json({ error: '无权限修改他人资料' }, { status: 403 });
|
||||
}
|
||||
try {
|
||||
await pool.query('UPDATE users SET username = $1, bio = $2 WHERE id = $3', [username, bio || '', id]);
|
||||
await pool.query('UPDATE users SET username = $1, bio = $2, signature = $3 WHERE id = $4', [username, bio || '', signature || '', id]);
|
||||
return Response.json({ success: true });
|
||||
} catch (err) {
|
||||
if (err.code === '23505') {
|
||||
|
||||
Reference in new issue
Block a user