Open
Conversation
需要为 users 表增加 feed_token 字段(nullable text/varchar)。
(无语住了 现在只要是没有被禁的用户都可以用自己的token订阅
日志含 subscriber id/name、author id/name、时间戳(不记录 token),用现有的 tracing 记录器输出。
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
Co-authored-by: Reverier Xu <reverier.xu@outlook.com>
This reverts commit 1f0d224.
Member
Author
|
需要在reports数据表中添加likes列(text),将以数组的形式存储点赞的用户 |
Reverier-Xu
reviewed
Nov 12, 2025
Member
Reverier-Xu
left a comment
There was a problem hiding this comment.
挠头,我觉得ai vibe coding还是太早了,要不再学一学?
sea-orm ref https://www.sea-ql.org/SeaORM/docs/generate-entity/column-types/
| pub week: i32, | ||
| #[sea_orm(column_type = "Text", nullable)] | ||
| pub content: Option<String>, | ||
| #[sea_orm(column_type = "Text", nullable)] |
Member
There was a problem hiding this comment.
不要这么存likes,rust sea-orm有json相关的序列化功能,包括后面手搓的序列化代码也是不必要的
| // Perform an atomic update of the likes column and then fetch the | ||
| // updated row to return a Model. This reduces the chance of clobbering | ||
| // other fields and makes the operation observable to callers. | ||
| let _res = Entity::update_many() |
Member
There was a problem hiding this comment.
只是一个model更新用得着update many吗,update many本身性能很差的
Reverier-Xu
requested changes
Nov 12, 2025
Member
Reverier-Xu
left a comment
There was a problem hiding this comment.
- 不要自己写json序列化与反序列化,使用seaorm types
- 使用正确的数据库操作函数
Member
Author
likes列的数据类型改为json,默认值为[]。 |
Member
|
已有数据不好加默认值的,得全表更新,改成nullable好一点
…________________________________
发件人: 肖宗林 ***@***.***>
发送时间: Thursday, November 13, 2025 3:47:08 PM
收件人: XDSEC/weekly_report ***@***.***>
抄送: Reverier Xu ***@***.***>; Mention ***@***.***>
主题: Re: [XDSEC/weekly_report] Feat(Reports): Add like feature (PR #2)
[https://avatars.githubusercontent.com/u/205417095?s=20&v=4]Xiaozonglin left a comment (XDSEC/weekly_report#2)<#2 (comment)>
需要在reports数据表中添加likes列(text),将以数组的形式存储点赞的用户
likes列的数据类型改为json,默认值为[]。
―
Reply to this email directly, view it on GitHub<#2 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJ76TNKL3BX2FT54V5RAN4D34QZPZAVCNFSM6AAAAACLJR2Z7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMRWGEZTKNBVGA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Reverier-Xu
requested changes
Nov 13, 2025
| use sea_orm::{ | ||
| entity::prelude::*, ActiveValue, FromQueryResult, IntoActiveModel, JoinType, QuerySelect, | ||
| }; | ||
| use sea_orm::JsonValue; |
Member
There was a problem hiding this comment.
不是这么用的啊,参考 https://www.sea-ql.org/SeaORM/docs/generate-entity/column-types 直接使用结构体定义一个数组结构
| pub content: Option<String>, | ||
| // Use SeaORM's JsonValue for JSON column storage | ||
| #[sea_orm(column_type = "Json", nullable)] | ||
| pub likes: Option<JsonValue>, |
Member
There was a problem hiding this comment.
这里的效果应该是
pub likes: Likes
...
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, FromJsonQueryResult, ...)]
struct Likes(Vec<i64>)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
我之前没弄分支,所以...之前的commit都跟过来了


