Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,10 @@ use time::OffsetDateTime;
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
/// What kind of change an audit entry records.
|
/// What kind of change an audit entry records.
|
||||||
|
///
|
||||||
|
/// NOTE: kept in sync by hand with the
|
||||||
|
/// `CHECK (action IN ('created', 'updated', 'deleted'))` constraint in
|
||||||
|
/// `crates/db/migrations/0001_audit_log.sql` — add a variant in both places.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum AuditAction {
|
pub enum AuditAction {
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ use serde::{Deserialize, Serialize};
|
|||||||
use crate::{AuthorityId, LocalizedLabel};
|
use crate::{AuthorityId, LocalizedLabel};
|
||||||
|
|
||||||
/// The kind of authority record.
|
/// The kind of authority record.
|
||||||
|
///
|
||||||
|
/// NOTE: kept in sync by hand with the
|
||||||
|
/// `CHECK (kind IN ('person', 'organisation', 'place'))` constraint in
|
||||||
|
/// `crates/db/migrations/0002_vocabularies_authorities.sql` — add a variant in both places.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum AuthorityKind {
|
pub enum AuthorityKind {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ pub async fn run(config: Config) -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let state = AppState {
|
let state = AppState {
|
||||||
db,
|
db,
|
||||||
app_name: config.app_name.clone(),
|
app_name: config.app_name,
|
||||||
cookie_secure: config.cookie_secure,
|
cookie_secure: config.cookie_secure,
|
||||||
search,
|
search,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,13 +22,21 @@ async fn serves_health_live_over_tcp() {
|
|||||||
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||||
let addr: SocketAddr = listener.local_addr().unwrap();
|
let addr: SocketAddr = listener.local_addr().unwrap();
|
||||||
|
|
||||||
let handle = tokio::spawn(async move {
|
let handle = tokio::spawn(async move { serve(listener, state).await });
|
||||||
serve(listener, state).await.unwrap();
|
|
||||||
});
|
|
||||||
|
|
||||||
let url = format!("http://{addr}/health/live");
|
let url = format!("http://{addr}/health/live");
|
||||||
let body: serde_json::Value = reqwest::get(&url)
|
let response = reqwest::get(&url).await;
|
||||||
.await
|
|
||||||
|
// If the request failed and the server task already ended, it errored — surface that
|
||||||
|
// (a clear server error) instead of the opaque reqwest failure.
|
||||||
|
if response.is_err() && handle.is_finished() {
|
||||||
|
match handle.await {
|
||||||
|
Ok(Err(err)) => panic!("server failed: {err:?}"),
|
||||||
|
other => panic!("server task ended unexpectedly: {other:?}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let body: serde_json::Value = response
|
||||||
.expect("request succeeds")
|
.expect("request succeeds")
|
||||||
.json()
|
.json()
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user