import { Id, NullableId, Paginated, Params, ServiceMethods } from '@feathersjs/feathers' import { Application } from '../../declarations' import getBasicMimetype from '../../util/get-basic-mimetype' interface Data {} interface ServiceOptions {} export class Video implements ServiceMethods { app: Application options: ServiceOptions constructor (options: ServiceOptions = {}, app: Application) { this.options = options this.app = app } async find (params?: Params): Promise> { return [] } async get (id: Id, params?: Params): Promise { return { id, text: `A new message with ID: ${id}!` } } async create (data: Data, params?: Params): Promise { if (Array.isArray(data)) { return await Promise.all(data.map(current => this.create(current, params))) } (data as any).mime_type = 'application/dash+xml'; (data as any).staticResourceType = getBasicMimetype((data as any).mime_type) const result = await this.app.service('static-resource').create(data) return result } async update (id: NullableId, data: Data, params?: Params): Promise { return data } async patch (id: NullableId, data: Data, params?: Params): Promise { return data } async remove (id: NullableId, params?: Params): Promise { return { id } } }