Reorganize app workspaces and align Admin architecture

This commit is contained in:
Igor Martyniuk
2026-07-17 13:46:21 +00:00
parent ba691d3a0c
commit 0ba01cd111
183 changed files with 3745 additions and 4354 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { ApiClient } from '@japa/api-client'
/**
* Logs in as Admin using the test HTTP client.
* Returns a Bearer token string.
*/
export async function loginAsAdmin(client: ApiClient): Promise<string> {
const email = process.env.ADMIN_EMAIL || 'admin@admin.com'
const password = process.env.ADMIN_PASSWORD || '1234qqqq'
const res = await client.post('/auth/login').json({ email, password })
res.assertStatus(200)
const body = res.body()
// returns: { type, token, user }
const token = body?.token?.release?.() || body?.token || body?.access_token
if (!token) {
console.error('Login response body:', body)
throw new Error('Could not acquire admin token from /auth/login response')
}
return token
}