I THINK THIS IS IT

This commit is contained in:
Gvidas Juknevičius 2024-03-30 19:21:08 +02:00
parent 5221bd6aea
commit 5a95045a9e
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
2 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,7 @@ impl Post {
let posted_on = chrono::Utc::now().timestamp_millis(); let posted_on = chrono::Utc::now().timestamp_millis();
sqlx::query(r#" sqlx::query(r#"
INSERT INTO posts ( id, title, descr, img_url, origin_url, original_request, posted_on ) INSERT INTO posts ( id, title, descr, img_url, origin_url, original_request, posted_on )
VALUES ( $1, $2, $3, $4, $5, $6, $7 ) VALUES ( $1, $2, $3, $4, $5, $6, $7 )

View File

@ -8,6 +8,11 @@ use super::types::ReleaseEvent;
pub async fn release_handler(db: Data<Mutex<Database>>, token: Token, body: ReleaseEvent, raw_body: String) -> Result<HttpResponseBuilder> { pub async fn release_handler(db: Data<Mutex<Database>>, token: Token, body: ReleaseEvent, raw_body: String) -> Result<HttpResponseBuilder> {
if body.action != "released" {
return Ok(HttpResponse::Ok());
}
let title = format!("(New release {}:{}) {}", body.repository.full_name, body.release.tag_name, body.release.name.unwrap_or("No title provided".into())); let title = format!("(New release {}:{}) {}", body.repository.full_name, body.release.tag_name, body.release.name.unwrap_or("No title provided".into()));
let origin_url = body.repository.html_url.clone(); let origin_url = body.repository.html_url.clone();
let descr = body.release.body.unwrap_or("No body provided".into()); let descr = body.release.body.unwrap_or("No body provided".into());