mirror of
https://github.com/immich-app/immich.git
synced 2025-01-07 20:36:48 +01:00
efa6efd200
* remove external path * open-api * make sql * move library settings to admin panel * Add documentation * show external libraries only * fix library list * make user library settings look good * fix test * fix tests * fix tests * can pick user for library * fix tests * fix e2e * chore: make sql * Use unauth exception * delete user library list * cleanup * fix e2e * fix await lint * chore: remove unused code * chore: cleanup * revert docs * fix: is admin stuff * table alignment --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { CreateUserDto, UpdateUserDto, UserResponseDto } from '@app/domain';
|
|
import request from 'supertest';
|
|
|
|
export const userApi = {
|
|
create: async (server: any, accessToken: string, dto: CreateUserDto) => {
|
|
const { status, body } = await request(server)
|
|
.post('/user')
|
|
.set('Authorization', `Bearer ${accessToken}`)
|
|
.send(dto);
|
|
|
|
expect(status).toBe(201);
|
|
expect(body).toMatchObject({
|
|
id: expect.any(String),
|
|
createdAt: expect.any(String),
|
|
updatedAt: expect.any(String),
|
|
email: dto.email,
|
|
});
|
|
|
|
return body as UserResponseDto;
|
|
},
|
|
update: async (server: any, accessToken: string, dto: UpdateUserDto) => {
|
|
const { status, body } = await request(server).put('/user').set('Authorization', `Bearer ${accessToken}`).send(dto);
|
|
|
|
expect(status).toBe(200);
|
|
expect(body).toMatchObject({ id: dto.id });
|
|
|
|
return body as UserResponseDto;
|
|
},
|
|
delete: async (server: any, accessToken: string, id: string) => {
|
|
const { status, body } = await request(server).delete(`/user/${id}`).set('Authorization', `Bearer ${accessToken}`);
|
|
|
|
expect(status).toBe(200);
|
|
expect(body).toMatchObject({ id, deletedAt: expect.any(String) });
|
|
|
|
return body as UserResponseDto;
|
|
},
|
|
};
|