mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 00:23:03 +00:00
275
src/things/person.ts
Normal file
275
src/things/person.ts
Normal file
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCMetaTranslations, SCNationality} from '../general/i18n';
|
||||
import {SCISO8601Date} from '../general/time';
|
||||
import {SCThing, SCThingMeta, SCThingType, SCThingWithoutReferences} from './abstract/thing';
|
||||
import {SCBuildingWithoutReferences} from './building';
|
||||
import {SCOrganizationWithoutReferences} from './organization';
|
||||
import {SCPointOfInterestWithoutReferences} from './point-of-interest';
|
||||
import {SCRoomWithoutReferences} from './room';
|
||||
|
||||
/**
|
||||
* A person without references
|
||||
*/
|
||||
export interface SCPersonWithoutReferences
|
||||
extends SCThingWithoutReferences {
|
||||
/**
|
||||
* Additional first names of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
additionalName?: string;
|
||||
|
||||
/**
|
||||
* The birth date of the person.
|
||||
*/
|
||||
birthDate?: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* The private email address of the person.
|
||||
*
|
||||
* @TJS-format email
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* The family name of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
familyName: string;
|
||||
|
||||
/**
|
||||
* The private fax number of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* The gender of the person.
|
||||
*/
|
||||
gender?: SCPersonGender;
|
||||
|
||||
/**
|
||||
* The first name of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
givenName: string;
|
||||
|
||||
/**
|
||||
* Honorific prefix of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
honorificPrefix?: string;
|
||||
|
||||
/**
|
||||
* Honorific suffix of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
honorificSuffix?: string;
|
||||
|
||||
/**
|
||||
* Titles of jobs that the person has.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
jobTitles?: string[];
|
||||
|
||||
/**
|
||||
* The complete name of the person combining all the parts of the name into one.
|
||||
*
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The nationality of the person.
|
||||
*/
|
||||
nationality?: SCNationality;
|
||||
|
||||
/**
|
||||
* The private telephone number of the person.
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* Type of a person
|
||||
*/
|
||||
type: SCThingType.Person;
|
||||
}
|
||||
|
||||
/**
|
||||
* A person
|
||||
*
|
||||
* @validatable
|
||||
* @indexable
|
||||
*/
|
||||
export interface SCPerson
|
||||
extends SCPersonWithoutReferences, SCThing {
|
||||
/**
|
||||
* Organization the person works for
|
||||
*/
|
||||
affiliations?: SCOrganizationWithoutReferences[];
|
||||
|
||||
/**
|
||||
* A list of homes of the person
|
||||
*/
|
||||
homeLocations?: Array<SCBuildingWithoutReferences
|
||||
| SCPointOfInterestWithoutReferences
|
||||
| SCRoomWithoutReferences>;
|
||||
|
||||
/**
|
||||
* Type of a person
|
||||
*/
|
||||
type: SCThingType.Person;
|
||||
|
||||
/**
|
||||
* Locations where the person performs her/his work
|
||||
*/
|
||||
workLocations?: SCContactPoint[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a person
|
||||
*/
|
||||
export class SCPersonMeta
|
||||
extends SCThingMeta
|
||||
implements SCMetaTranslations<SCPerson> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
|
||||
additionalName: 'Zusatzname',
|
||||
affiliations: 'Zugehörigkeiten',
|
||||
birthDate: 'Geburtsdatum',
|
||||
email: 'E-Mail',
|
||||
familyName: 'Nachname',
|
||||
faxNumber: 'Faxnummer',
|
||||
gender: 'Geschlecht',
|
||||
givenName: 'Vorname',
|
||||
homeLocations: 'Heimatstandorte',
|
||||
honorificPrefix: 'Ehrentitel',
|
||||
honorificSuffix: 'Ehrentitel (Suffix)',
|
||||
jobTitles: 'Berufsbezeichnungen',
|
||||
nationality: 'Staatsangehörigkeit',
|
||||
telephone: 'Telefonnummer',
|
||||
workLocations: 'Arbeitsorte',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
|
||||
additionalName: 'additional name',
|
||||
affiliations: 'affiliations',
|
||||
birthDate: 'birth date',
|
||||
email: 'email',
|
||||
familyName: 'family name',
|
||||
faxNumber: 'fax',
|
||||
gender: 'gender',
|
||||
givenName: 'given name',
|
||||
homeLocations: 'home locations',
|
||||
honorificPrefix: 'honorific title',
|
||||
honorificSuffix: 'honorific title (suffix)',
|
||||
jobTitles: 'job titles',
|
||||
nationality: 'nationality',
|
||||
telephone: 'telephone',
|
||||
workLocations: 'work locations',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.de,
|
||||
gender: {
|
||||
'female': 'weiblich',
|
||||
'inter': 'divers',
|
||||
'male': 'männlich',
|
||||
'undefined': 'undefiniert',
|
||||
},
|
||||
type: 'Person',
|
||||
},
|
||||
en: {
|
||||
...SCThingMeta.getInstance<SCThingMeta>().fieldValueTranslations.en,
|
||||
type: SCThingType.Person,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A contact point
|
||||
*
|
||||
* @see http://schema.org/ContactPoint
|
||||
*/
|
||||
export interface SCContactPoint {
|
||||
/**
|
||||
* Exact place where work is performed
|
||||
*/
|
||||
areaServed?: SCRoomWithoutReferences;
|
||||
|
||||
/**
|
||||
* E-mail at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* Fax number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
faxNumber?: string;
|
||||
|
||||
/**
|
||||
* Times available for contacting at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
hoursAvailable?: string;
|
||||
|
||||
/**
|
||||
* Contact number at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
telephone?: string;
|
||||
|
||||
/**
|
||||
* URL at the work location
|
||||
*
|
||||
* @keyword
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gender of a person
|
||||
*/
|
||||
export type SCPersonGender =
|
||||
'male'
|
||||
| 'female'
|
||||
| 'inter'
|
||||
| 'undefined';
|
||||
Reference in New Issue
Block a user