Implement announcement endpoints

This commit is contained in:
Ethan O'Brien
2024-04-15 14:01:39 -05:00
parent 9b9afecb28
commit 8f018f558a
4 changed files with 34 additions and 0 deletions

View File

@ -215,6 +215,25 @@ pub fn user_post(req: HttpRequest, body: String) -> HttpResponse {
global::send(resp)
}
pub fn announcement(req: HttpRequest) -> HttpResponse {
let key = global::get_login(req.headers(), "");
let mut user = userdata::get_acc_home(&key);
user["home"]["new_announcement_flag"] = (0).into();
userdata::save_acc_home(&key, user);
let resp = object!{
"code": 0,
"server_time": global::timestamp(),
"data": {
new_announcement_flag: 0
}
};
global::send(resp)
}
pub fn uid_to_code(uid: String) -> String {
//just replace uid with numbers because im too lazy to have a real database and this is close enough anyways
return uid