All checks were successful
Build & Deploy Web / build-and-deploy (push) Successful in 27s
66 lines
1.5 KiB
Plaintext
66 lines
1.5 KiB
Plaintext
meta {
|
|
name: 01 Signup
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/v1/auth/signup
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"email": "{{email}}",
|
|
"password": "{{password}}",
|
|
"fullName": "{{fullName}}"
|
|
}
|
|
|
|
|
|
}
|
|
|
|
script:post-response {
|
|
if (res.getStatus() === 201) {
|
|
const session = res.getBody().data;
|
|
bru.setEnvVar("token", session.accessToken);
|
|
bru.setEnvVar("userId", session.user.id);
|
|
bru.setEnvVar("organizationId", session.user.organizationId);
|
|
}
|
|
}
|
|
|
|
tests {
|
|
test("201 Created", function () {
|
|
expect(res.getStatus()).to.equal(201);
|
|
});
|
|
test("AuthSession shape", function () {
|
|
const data = res.getBody().data;
|
|
expect(data).to.have.property("accessToken");
|
|
expect(data).to.have.property("expiresAt");
|
|
expect(data.user).to.have.property("id");
|
|
expect(data.user).to.have.property("organizationId");
|
|
});
|
|
}
|
|
|
|
docs {
|
|
POST /api/v1/auth/signup
|
|
|
|
Crée une organisation vide + un user + duplique les 4 plans pré-fournis
|
|
(Standard B2B / Rapide / Patient / Ferme) dans la même transaction. Émet
|
|
ensuite une AuthSession :
|
|
- access token (TTL 30 min) en JSON
|
|
- refresh token (TTL 30 jours) en cookie httpOnly `rubis_refresh`
|
|
|
|
Le nom de l'organisation reste `""` jusqu'à ce que l'utilisateur passe
|
|
l'onboarding via PATCH /organizations/me.
|
|
|
|
Validation côté API :
|
|
- email format + unique
|
|
- password ≥ 8 chars
|
|
- fullName 2-120 chars
|
|
|
|
Erreurs typiques :
|
|
- 422 validation_failed (email/password/fullName invalides)
|
|
- 422 + `rule: database.unique` si email déjà pris
|
|
}
|