Free birth chart instead of the sign calculator; free tools in the header
/szuletesi-horoszkop (was /aszcendens-kalkulator) shows the whole natal chart without an account: the wheel, Sun/Moon/Ascendant with links to the sign pages, the positions, houses, aspect grid and aspect list, the same views as the chart pages but without the AI parts. A calculation only, nothing saved, still 30 an hour per address (POST /v1/public/chart). The typed birth data are offered on the profile after sign-up. The visitors' header gets a separate 'Ingyenes' group (birth chart, signs) next to the paid sections, on phones in its own row; the home page links them under the hero buttons and in an 'Ingyenes' band. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -959,35 +959,36 @@ const PUBLIC_ROUTES: [&str; 19] = [
|
||||
"/v1/public/invitations/unsubscribe",
|
||||
"/v1/public/invitations/{token}",
|
||||
"/v1/public/waitlist",
|
||||
// The sign calculator (limited per visitor address).
|
||||
"/v1/public/signs",
|
||||
// The public birth chart (limited per visitor address).
|
||||
"/v1/public/chart",
|
||||
"/v1/public/geo/countries",
|
||||
"/v1/public/geo/places",
|
||||
];
|
||||
|
||||
#[sqlx::test(migrator = "db::MIGRATOR")]
|
||||
async fn the_public_sign_calculator(pool: PgPool) {
|
||||
async fn the_public_birth_chart(pool: PgPool) {
|
||||
let app = TestApp::new(pool).await;
|
||||
let visitor = ("x-real-ip", "203.0.113.9");
|
||||
let birth = json!({"date": "1990-06-21", "time": "14:30", "country": "HU", "geonames_id": 715429});
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth.clone()), &[visitor]).await;
|
||||
let r = app.call_with("POST", "/v1/public/chart", None, Some(birth.clone()), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::OK, "{}", r.body);
|
||||
assert_eq!(
|
||||
(&r.body["sun"]["sign"], &r.body["moon"]["sign"], &r.body["ascendant"]["sign"]),
|
||||
(&json!("cancer"), &json!("pisces"), &json!("aries"))
|
||||
r.body["highlights"],
|
||||
json!({"sun": "cancer", "moon": "pisces", "ascendant": "aries", "time_known": true})
|
||||
);
|
||||
assert_eq!(r.body["chart"]["points"][0]["id"], "sun", "the whole chart comes back");
|
||||
// Without a birth time there is no Ascendant.
|
||||
let r = app
|
||||
.call_with(
|
||||
"POST",
|
||||
"/v1/public/signs",
|
||||
"/v1/public/chart",
|
||||
None,
|
||||
Some(json!({"date": "1990-06-21", "country": "HU", "geonames_id": 715429})),
|
||||
&[visitor],
|
||||
)
|
||||
.await;
|
||||
assert_eq!((r.status, &r.body["ascendant"], &r.body["time_known"]), (StatusCode::OK, &Value::Null, &json!(false)));
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(json!({"date": "1990-06-21"})), &[visitor]).await;
|
||||
assert_eq!((r.status, &r.body["highlights"]["time_known"]), (StatusCode::OK, &json!(false)));
|
||||
let r = app.call_with("POST", "/v1/public/chart", None, Some(json!({"date": "1990-06-21"})), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::BAD_REQUEST);
|
||||
|
||||
// The place search passes the query on, with a capped limit.
|
||||
@@ -1000,12 +1001,12 @@ async fn the_public_sign_calculator(pool: PgPool) {
|
||||
|
||||
// 30 calculations an hour per address (the malformed request did not count).
|
||||
for _ in 0..28 {
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth.clone()), &[visitor]).await;
|
||||
let r = app.call_with("POST", "/v1/public/chart", None, Some(birth.clone()), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::OK);
|
||||
}
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth.clone()), &[visitor]).await;
|
||||
let r = app.call_with("POST", "/v1/public/chart", None, Some(birth.clone()), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::TOO_MANY_REQUESTS);
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth), &[("x-real-ip", "198.51.100.2")]).await;
|
||||
let r = app.call_with("POST", "/v1/public/chart", None, Some(birth), &[("x-real-ip", "198.51.100.2")]).await;
|
||||
assert_eq!(r.status, StatusCode::OK);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user