import { inject, injectable } from "inversify"; import Search, { ISearch, ISearchResource } from "./"; import { IJsonApiResource } from "../../interfaces"; import Mapper from "../../mapper"; import * as TYPES from "../../types"; @injectable() export class SearchMapper extends Mapper { @inject(TYPES.Bookmark) model: ISearch; toModel(resource: ISearchResource, included: IJsonApiResource[] = []): ISearch { const model = new Search(); const attrs = resource.attributes; model.id = resource.id; model.swiftypeId = resource["swiftype-id"]; model.url = attrs.url; model.title = attrs.title; model.opId = attrs["op-id"]; model.opType = attrs["op-type"]; model.highlights = attrs.highlights; model.body = attrs.body; model.parentName = attrs["parent-name"]; model.placeType = attrs["place-type"]; model.poiSubtypes = attrs["poi-subtypes"]; model.thumbnail = attrs.thumbnail; return model; } toResource(model: ISearch) { return null; } } export default SearchMapper;