feat: add CNB login functionality and user management
- Introduced `cnb-login` route to handle user login via CNB token. - Created `CnbServices` class for managing CNB user interactions. - Added `findByCnbId` method in the User model to retrieve users by CNB ID. - Updated error handling to provide more structured error messages. - Enhanced user creation logic to handle CNB users. - Added tests for the new CNB login functionality.
This commit is contained in:
22
src/test/cnb-login.ts
Normal file
22
src/test/cnb-login.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { app, showMore, cnbToken } from './common.ts';
|
||||
|
||||
const res = await app.run({
|
||||
path: 'user',
|
||||
key: 'cnb-login',
|
||||
payload: {
|
||||
data: {
|
||||
cnbToken
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(showMore(res));
|
||||
|
||||
const token = res.data.token;
|
||||
const me = await app.run({
|
||||
path: 'user',
|
||||
key: 'me',
|
||||
payload: {
|
||||
token
|
||||
}
|
||||
})
|
||||
console.log(showMore(me));
|
||||
Reference in New Issue
Block a user