mirror of
https://github.com/zoriya/flood.git
synced 2026-06-07 20:30:42 +00:00
shared: types: move API types to api folder
This commit is contained in:
@@ -5,8 +5,8 @@ import type {
|
||||
AuthRegisterOptions,
|
||||
AuthUpdateUserOptions,
|
||||
AuthVerificationResponse,
|
||||
Credentials,
|
||||
} from '@shared/types/Auth';
|
||||
} from '@shared/types/api/auth';
|
||||
import type {Credentials} from '@shared/types/Auth';
|
||||
|
||||
import AppDispatcher from '../dispatcher/AppDispatcher';
|
||||
import ClientActions from './ClientActions';
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
SetTorrentsTagsOptions,
|
||||
StartTorrentsOptions,
|
||||
StopTorrentsOptions,
|
||||
} from '@shared/types/Action';
|
||||
} from '@shared/types/api/torrents';
|
||||
import type {TorrentProperties} from '@shared/types/Torrent';
|
||||
|
||||
import AppDispatcher from '../dispatcher/AppDispatcher';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {injectIntl, WrappedComponentProps} from 'react-intl';
|
||||
import React from 'react';
|
||||
|
||||
import type {MoveTorrentsOptions} from '@shared/types/Action';
|
||||
import type {MoveTorrentsOptions} from '@shared/types/api/torrents';
|
||||
|
||||
import {Form} from '../../../ui';
|
||||
import Modal from '../Modal';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {AuthAuthenticationResponse, AuthVerificationResponse, Credentials} from '@shared/types/Auth';
|
||||
import type {AuthAuthenticationResponse, AuthVerificationResponse} from '@shared/types/api/auth';
|
||||
import type {Credentials} from '@shared/types/Auth';
|
||||
import type {ClientSettings} from '@shared/constants/clientSettingsMap';
|
||||
import type {NotificationFetchOptions, NotificationState} from '@shared/types/Notification';
|
||||
import type {ServerEvents} from '@shared/types/ServerEvents';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {AuthAuthenticationResponse, AuthVerificationResponse, Credentials} from '@shared/types/Auth';
|
||||
import type {AuthAuthenticationResponse, AuthVerificationResponse} from '@shared/types/api/auth';
|
||||
import type {Credentials} from '@shared/types/Auth';
|
||||
|
||||
import AppDispatcher from '../dispatcher/AppDispatcher';
|
||||
import BaseStore from './BaseStore';
|
||||
|
||||
@@ -4,7 +4,8 @@ import jwt from 'jsonwebtoken';
|
||||
import passport from 'passport';
|
||||
|
||||
import type {Response} from 'express';
|
||||
import type {AuthRegisterOptions, AuthUpdateUserOptions, Credentials} from '@shared/types/Auth';
|
||||
import type {AuthRegisterOptions, AuthUpdateUserOptions} from '@shared/types/api/auth';
|
||||
import type {Credentials} from '@shared/types/Auth';
|
||||
|
||||
import ajaxUtil from '../../util/ajaxUtil';
|
||||
import config from '../../../config';
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
SetTorrentsTagsOptions,
|
||||
StartTorrentsOptions,
|
||||
StopTorrentsOptions,
|
||||
} from '@shared/types/Action';
|
||||
} from '@shared/types/api/torrents';
|
||||
|
||||
import ajaxUtil from '../../util/ajaxUtil';
|
||||
import client from '../../models/client';
|
||||
|
||||
@@ -16,7 +16,7 @@ import type {
|
||||
SetTorrentsTagsOptions,
|
||||
StartTorrentsOptions,
|
||||
StopTorrentsOptions,
|
||||
} from '@shared/types/Action';
|
||||
} from '@shared/types/api/torrents';
|
||||
|
||||
import {accessDeniedError, createDirectory, isAllowedPath, sanitizePath} from '../util/fileUtil';
|
||||
import BaseService from './BaseService';
|
||||
|
||||
@@ -15,29 +15,3 @@ export interface Credentials {
|
||||
}
|
||||
|
||||
export type UserInDatabase = Required<Credentials> & {_id: string};
|
||||
|
||||
// POST /api/auth/authenticate
|
||||
export type AuthAuthenticationOptions = Required<Pick<Credentials, 'username' | 'password'>>;
|
||||
|
||||
// POST /api/auth/authenticate - success response
|
||||
export interface AuthAuthenticationResponse {
|
||||
success: boolean;
|
||||
token: string;
|
||||
username: string;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
|
||||
// POST /api/auth/register
|
||||
export type AuthRegisterOptions = Required<
|
||||
Pick<Credentials, 'username' | 'password' | 'host' | 'port' | 'socketPath' | 'isAdmin'>
|
||||
>;
|
||||
|
||||
// PATCH /api/auth/users/{username}
|
||||
export type AuthUpdateUserOptions = Partial<Credentials>;
|
||||
|
||||
// GET /api/auth/verify - success response
|
||||
export interface AuthVerificationResponse extends Pick<AuthAuthenticationResponse, 'token'> {
|
||||
initialUser: boolean;
|
||||
username: string;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import type {Credentials} from '../Auth';
|
||||
|
||||
// POST /api/auth/authenticate
|
||||
export type AuthAuthenticationOptions = Required<Pick<Credentials, 'username' | 'password'>>;
|
||||
|
||||
// POST /api/auth/authenticate - success response
|
||||
export interface AuthAuthenticationResponse {
|
||||
success: boolean;
|
||||
token: string;
|
||||
username: string;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
|
||||
// POST /api/auth/register
|
||||
export type AuthRegisterOptions = Required<
|
||||
Pick<Credentials, 'username' | 'password' | 'host' | 'port' | 'socketPath' | 'isAdmin'>
|
||||
>;
|
||||
|
||||
// PATCH /api/auth/users/{username}
|
||||
export type AuthUpdateUserOptions = Partial<Credentials>;
|
||||
|
||||
// GET /api/auth/verify - success response
|
||||
export interface AuthVerificationResponse extends Pick<AuthAuthenticationResponse, 'token'> {
|
||||
initialUser: boolean;
|
||||
username: string;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {TorrentProperties} from './Torrent';
|
||||
import {TorrentProperties} from '../Torrent';
|
||||
|
||||
// POST /api/torrents/add-urls
|
||||
export interface AddTorrentByURLOptions {
|
||||
Reference in New Issue
Block a user