UNPKG

profile-pics

Version:

144 lines 5.65 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { linkedShape } from '../package.js'; import { schema } from 'lincd-schema/ontologies/schema'; import { Person as SchemaPerson } from 'lincd-schema/shapes/Person'; import { literalProperty, objectProperty } from 'lincd/utils/ShapeDecorators'; import { profilePics } from '../ontologies/profile-pics.js'; import { ProfilePicture } from './ProfilePicture.js'; import { ImageObject } from 'lincd-schema/shapes/ImageObject'; import { getResizedImagePath } from 'lincd-server-utils/utils/ImageResize'; import { Boolean } from 'lincd-xsd/shapes/Boolean'; let Person = class Person extends SchemaPerson { get profilePicture() { return this.getOneAs(profilePics.hasProfilePicture, ProfilePicture); } set profilePicture(val) { val ? this.overwrite(profilePics.hasProfilePicture, val.namedNode) : this.unsetAll(profilePics.hasProfilePicture); } get profilePicture2() { return this.getOneAs(profilePics.hasProfilePicture2, ProfilePicture); } set profilePicture2(val) { val ? this.overwrite(profilePics.hasProfilePicture2, val.namedNode) : this.unsetAll(profilePics.hasProfilePicture2); } get profilePicture3() { return this.getOneAs(profilePics.hasProfilePicture3, ProfilePicture); } set profilePicture3(val) { val ? this.overwrite(profilePics.hasProfilePicture3, val.namedNode) : this.unsetAll(profilePics.hasProfilePicture3); } get profilePicture4() { return this.getOneAs(profilePics.hasProfilePicture4, ProfilePicture); } set profilePicture4(val) { val ? this.overwrite(profilePics.hasProfilePicture4, val.namedNode) : this.unsetAll(profilePics.hasProfilePicture4); } get profilePicture5() { return this.getOneAs(profilePics.hasProfilePicture5, ProfilePicture); } set profilePicture5(val) { val ? this.overwrite(profilePics.hasProfilePicture5, val.namedNode) : this.unsetAll(profilePics.hasProfilePicture5); } get profilePicture6() { return this.getOneAs(profilePics.hasProfilePicture6, ProfilePicture); } set profilePicture6(val) { val ? this.overwrite(profilePics.hasProfilePicture6, val.namedNode) : this.unsetAll(profilePics.hasProfilePicture6); } get profileSetupCompleted() { return Boolean.isTrue(this.getOne(profilePics.profileSetupCompleted)); } set profileSetupCompleted(val) { this.overwrite(profilePics.profileSetupCompleted, val ? Boolean.true() : Boolean.false()); } getAvatar(size = 48) { let profilePicture = this.profilePicture; if (profilePicture && profilePicture.cropped) { let avatar = new ImageObject(); avatar.contentUrl = getResizedImagePath(profilePicture.cropped.contentUrl, size, size); return avatar; } } }; Person.targetClass = schema.Person; __decorate([ objectProperty({ path: profilePics.hasProfilePicture, required: false, }), __metadata("design:type", ProfilePicture), __metadata("design:paramtypes", [Object]) ], Person.prototype, "profilePicture", null); __decorate([ objectProperty({ path: profilePics.hasProfilePicture2, required: false, }), __metadata("design:type", ProfilePicture), __metadata("design:paramtypes", [Object]) ], Person.prototype, "profilePicture2", null); __decorate([ objectProperty({ path: profilePics.hasProfilePicture3, required: false, }), __metadata("design:type", ProfilePicture), __metadata("design:paramtypes", [Object]) ], Person.prototype, "profilePicture3", null); __decorate([ objectProperty({ path: profilePics.hasProfilePicture4, required: false, }), __metadata("design:type", ProfilePicture), __metadata("design:paramtypes", [Object]) ], Person.prototype, "profilePicture4", null); __decorate([ objectProperty({ path: profilePics.hasProfilePicture5, required: false, }), __metadata("design:type", ProfilePicture), __metadata("design:paramtypes", [Object]) ], Person.prototype, "profilePicture5", null); __decorate([ objectProperty({ path: profilePics.hasProfilePicture6, required: false, }), __metadata("design:type", ProfilePicture), __metadata("design:paramtypes", [Object]) ], Person.prototype, "profilePicture6", null); __decorate([ literalProperty({ path: profilePics.profileSetupCompleted, dataType: Boolean.targetClass, }), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], Person.prototype, "profileSetupCompleted", null); Person = __decorate([ linkedShape ], Person); export { Person }; //# sourceMappingURL=Person.js.map