mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Reimplement a typed omit function
This commit is contained in:
parent
a85d530384
commit
bbd5aa7ead
17 changed files with 67 additions and 78 deletions
|
@ -1,5 +1,4 @@
|
|||
import { omit } from 'lodash'
|
||||
import { pick } from '@shared/core-utils'
|
||||
import { omit, pick } from '@shared/core-utils'
|
||||
import {
|
||||
HttpStatusCode,
|
||||
MyUser,
|
||||
|
@ -298,7 +297,7 @@ export class UsersCommand extends AbstractCommand {
|
|||
updateMe (options: OverrideCommandOptions & UserUpdateMe) {
|
||||
const path = '/api/v1/users/me'
|
||||
|
||||
const toSend: UserUpdateMe = omit(options, 'url', 'accessToken')
|
||||
const toSend: UserUpdateMe = omit(options, [ 'expectedStatus', 'token' ])
|
||||
|
||||
return this.putBodyRequest({
|
||||
...options,
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
||||
|
||||
import { readdir } from 'fs-extra'
|
||||
import { omit } from 'lodash'
|
||||
import { join } from 'path'
|
||||
import { wait } from '@shared/core-utils'
|
||||
import { omit, wait } from '@shared/core-utils'
|
||||
import {
|
||||
HttpStatusCode,
|
||||
LiveVideo,
|
||||
|
@ -103,7 +102,7 @@ export class LiveCommand extends AbstractCommand {
|
|||
|
||||
path,
|
||||
attaches,
|
||||
fields: omit(fields, 'thumbnailfile', 'previewfile'),
|
||||
fields: omit(fields, [ 'thumbnailfile', 'previewfile' ]),
|
||||
implicitToken: true,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
}))
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { omit } from 'lodash'
|
||||
import { pick } from '@shared/core-utils'
|
||||
import { omit, pick } from '@shared/core-utils'
|
||||
import {
|
||||
BooleanBothQuery,
|
||||
HttpStatusCode,
|
||||
|
@ -136,7 +135,7 @@ export class PlaylistsCommand extends AbstractCommand {
|
|||
}) {
|
||||
const path = '/api/v1/video-playlists'
|
||||
|
||||
const fields = omit(options.attributes, 'thumbnailfile')
|
||||
const fields = omit(options.attributes, [ 'thumbnailfile' ])
|
||||
|
||||
const attaches = options.attributes.thumbnailfile
|
||||
? { thumbnailfile: options.attributes.thumbnailfile }
|
||||
|
@ -161,7 +160,7 @@ export class PlaylistsCommand extends AbstractCommand {
|
|||
}) {
|
||||
const path = '/api/v1/video-playlists/' + options.playlistId
|
||||
|
||||
const fields = omit(options.attributes, 'thumbnailfile')
|
||||
const fields = omit(options.attributes, [ 'thumbnailfile' ])
|
||||
|
||||
const attaches = options.attributes.thumbnailfile
|
||||
? { thumbnailfile: options.attributes.thumbnailfile }
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
import { expect } from 'chai'
|
||||
import { createReadStream, stat } from 'fs-extra'
|
||||
import got, { Response as GotResponse } from 'got'
|
||||
import { omit } from 'lodash'
|
||||
import validator from 'validator'
|
||||
import { buildAbsoluteFixturePath, pick, wait } from '@shared/core-utils'
|
||||
import { buildAbsoluteFixturePath, omit, pick, wait } from '@shared/core-utils'
|
||||
import { buildUUID } from '@shared/extra-utils'
|
||||
import {
|
||||
HttpStatusCode,
|
||||
|
@ -484,7 +483,7 @@ export class VideosCommand extends AbstractCommand {
|
|||
},
|
||||
|
||||
// Fixture will be sent later
|
||||
attaches: this.buildUploadAttaches(omit(options.attributes, 'fixture')),
|
||||
attaches: this.buildUploadAttaches(omit(options.attributes, [ 'fixture' ])),
|
||||
implicitToken: true,
|
||||
|
||||
defaultExpectedStatus: null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue