mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
refactor: remove unused my-sessions endpoint (#1691)
This commit is contained in:
parent
90b72f1162
commit
d7c450abf8
@ -61,25 +61,6 @@ test('should allow user to change password', async () => {
|
||||
expect(updated.passwordHash).toBeTruthy();
|
||||
});
|
||||
|
||||
test('should get my sessions', async () => {
|
||||
const { request, base, sessionStore } = await getSetup();
|
||||
|
||||
sessionStore.insertSession({
|
||||
sid: '123',
|
||||
sess: { user: currentUser },
|
||||
});
|
||||
|
||||
await request
|
||||
.get(`${base}/api/admin/user/my-sessions`)
|
||||
.expect(200)
|
||||
.expect((res) => {
|
||||
expect(res.body.length).toBe(1);
|
||||
expect(res.body[0].sid).toBe('123');
|
||||
expect(res.body[0].sess.user.id).toBe(currentUser.id);
|
||||
expect(res.body[0].sess.user.email).toBe(currentUser.email);
|
||||
});
|
||||
});
|
||||
|
||||
test('should deny if password and confirmPassword are not equal', async () => {
|
||||
expect.assertions(0);
|
||||
const { request, base } = await getSetup();
|
||||
|
@ -5,7 +5,6 @@ import { AccessService } from '../../services/access-service';
|
||||
import { IAuthType, IUnleashConfig } from '../../types/option';
|
||||
import { IUnleashServices } from '../../types/services';
|
||||
import UserService from '../../services/user-service';
|
||||
import SessionService from '../../services/session-service';
|
||||
import UserFeedbackService from '../../services/user-feedback-service';
|
||||
import UserSplashService from '../../services/user-splash-service';
|
||||
import { ADMIN, NONE } from '../../types/permissions';
|
||||
@ -22,8 +21,6 @@ class UserController extends Controller {
|
||||
|
||||
private userFeedbackService: UserFeedbackService;
|
||||
|
||||
private sessionService: SessionService;
|
||||
|
||||
private userSplashService: UserSplashService;
|
||||
|
||||
constructor(
|
||||
@ -31,14 +28,12 @@ class UserController extends Controller {
|
||||
{
|
||||
accessService,
|
||||
userService,
|
||||
sessionService,
|
||||
userFeedbackService,
|
||||
userSplashService,
|
||||
}: Pick<
|
||||
IUnleashServices,
|
||||
| 'accessService'
|
||||
| 'userService'
|
||||
| 'sessionService'
|
||||
| 'userFeedbackService'
|
||||
| 'userSplashService'
|
||||
>,
|
||||
@ -46,13 +41,11 @@ class UserController extends Controller {
|
||||
super(config);
|
||||
this.accessService = accessService;
|
||||
this.userService = userService;
|
||||
this.sessionService = sessionService;
|
||||
this.userFeedbackService = userFeedbackService;
|
||||
this.userSplashService = userSplashService;
|
||||
|
||||
this.get('/', this.getUser);
|
||||
this.post('/change-password', this.updateUserPass, NONE);
|
||||
this.get('/my-sessions', this.mySessions);
|
||||
}
|
||||
|
||||
async getUser(req: IAuthRequest, res: Response): Promise<void> {
|
||||
@ -89,12 +82,6 @@ class UserController extends Controller {
|
||||
res.status(400).end();
|
||||
}
|
||||
}
|
||||
|
||||
async mySessions(req: IAuthRequest, res: Response): Promise<void> {
|
||||
const { user } = req;
|
||||
const sessions = await this.sessionService.getSessionsForUser(user.id);
|
||||
res.json(sessions);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UserController;
|
||||
|
Loading…
Reference in New Issue
Block a user