refactor(schema): simplify validation and OpenAPI generation (#2709)

This commit is contained in:
Hampus
2026-09-11 23:24:26 +02:00
committed by GitHub
parent 4bc5593f9f
commit de1fd95a99
510 changed files with 29494 additions and 36131 deletions
+1
View File
@@ -3,3 +3,4 @@
pub mod config;
pub mod external_media_path;
pub mod geoip;
pub mod user_flags;
+23
View File
@@ -0,0 +1,23 @@
pub const USER_FLAG_STAFF: i64 = 1 << 0;
pub const USER_FLAG_PARTNER: i64 = 1 << 2;
const USER_FLAG_BUG_HUNTER: i64 = 1 << 3;
const USER_FLAG_FRIENDLY_BOT: i64 = 1 << 4;
const USER_FLAG_FRIENDLY_BOT_MANUAL_APPROVAL: i64 = 1 << 5;
const USER_FLAG_SPAMMER: i64 = 1 << 6;
pub const USER_FLAG_STAFF_HIDDEN: i64 = 1 << 57;
const PUBLIC_USER_FLAGS: i64 = USER_FLAG_STAFF
| USER_FLAG_PARTNER
| USER_FLAG_BUG_HUNTER
| USER_FLAG_FRIENDLY_BOT
| USER_FLAG_FRIENDLY_BOT_MANUAL_APPROVAL
| USER_FLAG_SPAMMER;
const PUBLIC_USER_FLAGS_WITHOUT_STAFF: i64 = PUBLIC_USER_FLAGS & !USER_FLAG_STAFF;
pub fn visible_user_flags(flags: i64) -> i32 {
let visible_flags = if (flags & USER_FLAG_STAFF_HIDDEN) != 0 {
PUBLIC_USER_FLAGS_WITHOUT_STAFF
} else {
PUBLIC_USER_FLAGS
};
(flags & visible_flags) as i32
}