mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
refactor(server): sessions (#8915)
* refactor: auth device => sessions * chore: open api
This commit is contained in:
parent
e72e41a7aa
commit
4478e524f8
48 changed files with 967 additions and 825 deletions
|
|
@ -346,14 +346,6 @@ export type ChangePasswordDto = {
|
|||
newPassword: string;
|
||||
password: string;
|
||||
};
|
||||
export type AuthDeviceResponseDto = {
|
||||
createdAt: string;
|
||||
current: boolean;
|
||||
deviceOS: string;
|
||||
deviceType: string;
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
export type LoginCredentialDto = {
|
||||
email: string;
|
||||
password: string;
|
||||
|
|
@ -791,6 +783,14 @@ export type ServerVersionResponseDto = {
|
|||
minor: number;
|
||||
patch: number;
|
||||
};
|
||||
export type SessionResponseDto = {
|
||||
createdAt: string;
|
||||
current: boolean;
|
||||
deviceOS: string;
|
||||
deviceType: string;
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
export type SharedLinkResponseDto = {
|
||||
album?: AlbumResponseDto;
|
||||
allowDownload: boolean;
|
||||
|
|
@ -1703,28 +1703,6 @@ export function changePassword({ changePasswordDto }: {
|
|||
body: changePasswordDto
|
||||
})));
|
||||
}
|
||||
export function logoutAuthDevices(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/auth/devices", {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
export function getAuthDevices(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AuthDeviceResponseDto[];
|
||||
}>("/auth/devices", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function logoutAuthDevice({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText(`/auth/devices/${encodeURIComponent(id)}`, {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
export function login({ loginCredentialDto }: {
|
||||
loginCredentialDto: LoginCredentialDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
|
|
@ -2413,6 +2391,28 @@ export function getServerVersion(opts?: Oazapfts.RequestOpts) {
|
|||
...opts
|
||||
}));
|
||||
}
|
||||
export function deleteAllSessions(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/sessions", {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
export function getSessions(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: SessionResponseDto[];
|
||||
}>("/sessions", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function deleteSession({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText(`/sessions/${encodeURIComponent(id)}`, {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
export function getAllSharedLinks(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue