features, cleanup and bug fixes #26
2 changed files with 20 additions and 1 deletions
adjuct summary endpoint
commit
72a4481b96
|
|
@ -20,6 +20,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- update/upgrade dependencies
|
||||
- reviewer-only settings when not logged in are now an error rather than being silently ignored
|
||||
- delete expired will now goto a preview instead of deleting directly
|
||||
- change the format of the summary endpoint
|
||||
- the top-level is now an object instead of a list
|
||||
- the top-level list is not the entries field of the top-level object
|
||||
- an additional version field is added
|
||||
- also an overview field is added with the url of job offer overview
|
||||
|
||||
## [0.1.6] (2022-05-26)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@ pub(crate) mod review;
|
|||
|
||||
use crate::auth::User;
|
||||
use crate::error::PresentationError;
|
||||
use crate::job_offers::view::JobOfferViewData;
|
||||
use crate::job_offers::JobOffers;
|
||||
use crate::route::job_offer::error::SyncResponseError;
|
||||
use crate::route::{HTML_CONTENT, JSON_CONTENT};
|
||||
use crate::server_config::ServerConfig;
|
||||
use crate::template;
|
||||
use crate::util::SerializableUrl;
|
||||
|
||||
pub fn configure(service: &mut ServiceConfig) {
|
||||
service
|
||||
|
|
@ -164,7 +166,19 @@ pub(crate) async fn summary(
|
|||
let guard = offers.get_offers().await;
|
||||
crate::job_offers::job_data(&req, guard.iter(), user.as_ref())
|
||||
};
|
||||
let data = json!(previews);
|
||||
|
||||
struct SummaryData {
|
||||
version: &'static str,
|
||||
entries: Vec<JobOfferViewData>,
|
||||
overview: SerializableUrl,
|
||||
}
|
||||
|
||||
let data = json!(SummaryData {
|
||||
version: "1",
|
||||
entries: previews,
|
||||
overview: SerializableUrl(req.url_for_static(JOBOFFER_OVERVIEW_ROUTE))
|
||||
});
|
||||
|
||||
Ok(HttpResponse::Ok()
|
||||
.insert_header((CONTENT_TYPE, JSON_CONTENT.clone()))
|
||||
.body(data.to_string()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue