profile-pics
Version:
162 lines • 7.33 kB
JavaScript
;
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);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Person = void 0;
const package_js_1 = require("../package.js");
const schema_1 = require("lincd-schema/ontologies/schema");
const Person_1 = require("lincd-schema/shapes/Person");
const SHACL_1 = require("lincd/shapes/SHACL");
const profile_pics_js_1 = require("../ontologies/profile-pics.js");
const ProfilePicture_js_1 = require("./ProfilePicture.js");
const ImageObject_1 = require("lincd-schema/shapes/ImageObject");
const ImageResize_1 = require("lincd-server-utils/utils/ImageResize");
const Boolean_1 = require("lincd-xsd/shapes/Boolean");
let Person = class Person extends Person_1.Person {
get profilePicture() {
return this.getOneAs(profile_pics_js_1.profilePics.hasProfilePicture, ProfilePicture_js_1.ProfilePicture);
}
set profilePicture(val) {
val
? this.overwrite(profile_pics_js_1.profilePics.hasProfilePicture, val.namedNode)
: this.unsetAll(profile_pics_js_1.profilePics.hasProfilePicture);
}
get profilePicture2() {
return this.getOneAs(profile_pics_js_1.profilePics.hasProfilePicture2, ProfilePicture_js_1.ProfilePicture);
}
set profilePicture2(val) {
val
? this.overwrite(profile_pics_js_1.profilePics.hasProfilePicture2, val.namedNode)
: this.unsetAll(profile_pics_js_1.profilePics.hasProfilePicture2);
}
get profilePicture3() {
return this.getOneAs(profile_pics_js_1.profilePics.hasProfilePicture3, ProfilePicture_js_1.ProfilePicture);
}
set profilePicture3(val) {
val
? this.overwrite(profile_pics_js_1.profilePics.hasProfilePicture3, val.namedNode)
: this.unsetAll(profile_pics_js_1.profilePics.hasProfilePicture3);
}
get profilePicture4() {
return this.getOneAs(profile_pics_js_1.profilePics.hasProfilePicture4, ProfilePicture_js_1.ProfilePicture);
}
set profilePicture4(val) {
val
? this.overwrite(profile_pics_js_1.profilePics.hasProfilePicture4, val.namedNode)
: this.unsetAll(profile_pics_js_1.profilePics.hasProfilePicture4);
}
get profilePicture5() {
return this.getOneAs(profile_pics_js_1.profilePics.hasProfilePicture5, ProfilePicture_js_1.ProfilePicture);
}
set profilePicture5(val) {
val
? this.overwrite(profile_pics_js_1.profilePics.hasProfilePicture5, val.namedNode)
: this.unsetAll(profile_pics_js_1.profilePics.hasProfilePicture5);
}
get profilePicture6() {
return this.getOneAs(profile_pics_js_1.profilePics.hasProfilePicture6, ProfilePicture_js_1.ProfilePicture);
}
set profilePicture6(val) {
val
? this.overwrite(profile_pics_js_1.profilePics.hasProfilePicture6, val.namedNode)
: this.unsetAll(profile_pics_js_1.profilePics.hasProfilePicture6);
}
//TODO: move to user account
get profileSetupCompleted() {
return Boolean_1.Boolean.isTrue(this.getOne(profile_pics_js_1.profilePics.profileSetupCompleted));
}
set profileSetupCompleted(val) {
this.overwrite(profile_pics_js_1.profilePics.profileSetupCompleted, val ? Boolean_1.Boolean.true() : Boolean_1.Boolean.false());
}
getAvatar(size = 48) {
let profilePicture = this.profilePicture;
if (profilePicture && profilePicture.cropped) {
let avatar = new ImageObject_1.ImageObject();
avatar.contentUrl = (0, ImageResize_1.getResizedImagePath)(profilePicture.cropped.contentUrl, size, size);
return avatar;
}
}
};
exports.Person = Person;
Person.targetClass = schema_1.schema.Person;
__decorate([
(0, SHACL_1.objectProperty)({
path: profile_pics_js_1.profilePics.hasProfilePicture,
shape: ProfilePicture_js_1.ProfilePicture,
maxCount: 1,
required: false,
description: 'The main profile picture of the person. Ignore all other image properties for persons. Get the avatar from the profilePicture.cropped.contentUrl property.',
}),
__metadata("design:type", ProfilePicture_js_1.ProfilePicture),
__metadata("design:paramtypes", [Object])
], Person.prototype, "profilePicture", null);
__decorate([
(0, SHACL_1.objectProperty)({
path: profile_pics_js_1.profilePics.hasProfilePicture2,
shape: ProfilePicture_js_1.ProfilePicture,
maxCount: 1,
required: false,
}),
__metadata("design:type", ProfilePicture_js_1.ProfilePicture),
__metadata("design:paramtypes", [Object])
], Person.prototype, "profilePicture2", null);
__decorate([
(0, SHACL_1.objectProperty)({
path: profile_pics_js_1.profilePics.hasProfilePicture3,
shape: ProfilePicture_js_1.ProfilePicture,
maxCount: 1,
required: false,
}),
__metadata("design:type", ProfilePicture_js_1.ProfilePicture),
__metadata("design:paramtypes", [Object])
], Person.prototype, "profilePicture3", null);
__decorate([
(0, SHACL_1.objectProperty)({
path: profile_pics_js_1.profilePics.hasProfilePicture4,
maxCount: 1,
required: false,
shape: ProfilePicture_js_1.ProfilePicture,
}),
__metadata("design:type", ProfilePicture_js_1.ProfilePicture),
__metadata("design:paramtypes", [Object])
], Person.prototype, "profilePicture4", null);
__decorate([
(0, SHACL_1.objectProperty)({
path: profile_pics_js_1.profilePics.hasProfilePicture5,
shape: ProfilePicture_js_1.ProfilePicture,
maxCount: 1,
required: false,
}),
__metadata("design:type", ProfilePicture_js_1.ProfilePicture),
__metadata("design:paramtypes", [Object])
], Person.prototype, "profilePicture5", null);
__decorate([
(0, SHACL_1.objectProperty)({
path: profile_pics_js_1.profilePics.hasProfilePicture6,
shape: ProfilePicture_js_1.ProfilePicture,
maxCount: 1,
required: false,
}),
__metadata("design:type", ProfilePicture_js_1.ProfilePicture),
__metadata("design:paramtypes", [Object])
], Person.prototype, "profilePicture6", null);
__decorate([
(0, SHACL_1.literalProperty)({
path: profile_pics_js_1.profilePics.profileSetupCompleted,
datatype: Boolean_1.Boolean.targetClass,
maxCount: 1,
}),
__metadata("design:type", Boolean),
__metadata("design:paramtypes", [Boolean])
], Person.prototype, "profileSetupCompleted", null);
exports.Person = Person = __decorate([
package_js_1.linkedShape
], Person);
//# sourceMappingURL=Person.js.map