my-test123
Version:
A planner front-end for Fabric8.
130 lines • 4.36 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { switchModel, modelService } from './common.model';
import { cloneDeep } from 'lodash';
var Comment = /** @class */ (function (_super) {
__extends(Comment, _super);
function Comment() {
return _super !== null && _super.apply(this, arguments) || this;
}
return Comment;
}(modelService));
export { Comment };
var CommentLink = /** @class */ (function () {
function CommentLink() {
}
return CommentLink;
}());
export { CommentLink };
var CommentAttributes = /** @class */ (function () {
function CommentAttributes() {
}
return CommentAttributes;
}());
export { CommentAttributes };
var Comments = /** @class */ (function () {
function Comments() {
}
return Comments;
}());
export { Comments };
var CommentPost = /** @class */ (function () {
function CommentPost() {
}
return CommentPost;
}());
export { CommentPost };
var RelationalData = /** @class */ (function () {
function RelationalData() {
}
return RelationalData;
}());
export { RelationalData };
var CommentMapper = /** @class */ (function () {
function CommentMapper(userMapper) {
this.userMapper = userMapper;
this.serviceToUiMapTree = [{
fromPath: ['id'],
toPath: ['id']
}, {
fromPath: ['attributes', 'body'],
toPath: ['body']
}, {
fromPath: ['attributes', 'markup'],
toPath: ['markup']
}, {
fromPath: ['attributes', 'created-at'],
toPath: ['createdAt']
}, {
fromPath: ['attributes', 'body.rendered'],
toPath: ['bodyRendered']
}, {
fromPath: ['relationships', 'creator', 'data'],
toPath: ['creator'],
toFunction: this.userMapper.toUIModel.bind(this.userMapper)
}, {
fromPath: ['links', 'self'],
toPath: ['selfLink']
}];
this.uiToServiceMapTree = [{
toPath: ['id'],
fromPath: ['id']
}, {
toPath: ['attributes', 'body'],
fromPath: ['body']
}, {
toPath: ['attributes', 'markup'],
fromPath: ['markup']
}, {
toPath: ['attributes', 'created-at'],
fromPath: ['createdAt']
}, {
toPath: ['relationships', 'creator', 'data'],
fromPath: ['creator']
}, {
toPath: ['attributes', 'body.rendered'],
fromPath: ['bodyRendered']
}, {
toPath: ['type'],
toValue: 'comments'
}, {
toPath: ['links', 'self'],
fromPath: ['selfLink']
}];
this.userMapper = userMapper;
}
CommentMapper.prototype.toUIModel = function (arg) {
return switchModel(arg, this.serviceToUiMapTree);
};
CommentMapper.prototype.toServiceModel = function (arg) {
return switchModel(arg, this.uiToServiceMapTree);
};
return CommentMapper;
}());
export { CommentMapper };
var CommentCreatorResolver = /** @class */ (function () {
function CommentCreatorResolver(comment) {
this.comment = comment;
}
CommentCreatorResolver.prototype.resolveCreator = function (creators) {
var _this = this;
var creator = creators.find(function (a) { return a.id === _this.comment.creator.id; });
if (creator) {
this.comment.creator = cloneDeep(creator);
}
};
CommentCreatorResolver.prototype.getComment = function () {
return this.comment;
};
return CommentCreatorResolver;
}());
export { CommentCreatorResolver };
//# sourceMappingURL=comment.js.map