diff --git a/anet-dictionary.yml b/anet-dictionary.yml index 6dacd2a5bc..323f67ec73 100644 --- a/anet-dictionary.yml +++ b/anet-dictionary.yml @@ -777,6 +777,12 @@ fields: placeholder: Fill in the name of this location type: label: Type + digram: + label: Digram + placeholder: Fill in the 2-letter code for this country + trigram: + label: Trigram + placeholder: Fill in the 3-letter code for this country description: label: Description placeholder: Fill in the description of this location @@ -1306,9 +1312,6 @@ fields: regular: person: name: Person - countries: [Afghanistan, Albania , Armenia, Australia, Austria, Azerbaijan, Belgium, Bosnia-Herzegovina, Bulgaria, Croatia, Czech Republic, Denmark, Estonia, Finland, - Georgia, Germany, Greece, Hungary, Iceland, Italy, Latvia, Lithuania, Luxembourg, Macedonia, Mongolia, Montenegro, Netherlands, New Zealand, - Norway, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden, Türkiye, Ukraine, United Kingdom, United States of America] # number of fields after Avatar in the left column for persons # adjust this number if two columns are not balanced on the Person Page numberOfFieldsInLeftColumn: 7 diff --git a/client/package.json b/client/package.json index 13c842c690..79ff8aaf63 100644 --- a/client/package.json +++ b/client/package.json @@ -78,7 +78,6 @@ "handlebars": "4.7.8", "handlebars-loader": "1.7.3", "html-webpack-plugin": "5.6.0", - "i18n-iso-countries": "7.11.0", "ignore-loader": "0.1.2", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", diff --git a/client/src/components/CountryDisplay.js b/client/src/components/CountryDisplay.js new file mode 100644 index 0000000000..770e4dd629 --- /dev/null +++ b/client/src/components/CountryDisplay.js @@ -0,0 +1,39 @@ +import { Icon } from "@blueprintjs/core" +import { IconNames } from "@blueprintjs/icons" +import LinkTo from "components/LinkTo" +import PropTypes from "prop-types" +import React from "react" + +const CountryDisplay = ({ country, obsoleteCountry, plain }) => { + const icon = ( + + ) + return ( + <> + {country && + (plain ? ( + + {icon} + {country.name} + + ) : ( + + {icon} + {country.name} + + ))} + {obsoleteCountry && (old value: {obsoleteCountry})} + + ) +} + +CountryDisplay.propTypes = { + country: PropTypes.object, + obsoleteCountry: PropTypes.string, + plain: PropTypes.bool +} + +export default CountryDisplay diff --git a/client/src/components/SearchFilters.js b/client/src/components/SearchFilters.js index 6f5c3c56e8..626f2c78ea 100644 --- a/client/src/components/SearchFilters.js +++ b/client/src/components/SearchFilters.js @@ -1,3 +1,5 @@ +import { Icon } from "@blueprintjs/core" +import { IconNames } from "@blueprintjs/icons" import { SEARCH_OBJECT_LABELS, SEARCH_OBJECT_TYPES } from "actions" import AdvancedSelectFilter, { deserialize as deserializeAdvancedSelectFilter @@ -24,6 +26,7 @@ import TaskFilter, { deserialize as deserializeTaskFilter } from "components/advancedSearch/TaskFilter" import { + CountryOverlayRow, LocationOverlayRow, PersonDetailedOverlayRow, PositionOverlayRow, @@ -104,6 +107,18 @@ const EmailFilter = { } } +const advancedSelectFilterCountryProps = { + overlayColumns: [ + Settings.fields.location.name?.label, + Settings.fields.location.digram?.label, + Settings.fields.location.trigram?.label + ], + overlayRenderRow: CountryOverlayRow, + objectType: Location, + valueKey: "name", + fields: Location.autocompleteQuery, + addon: +} const advancedSelectFilterPersonProps = { overlayColumns: ["Name", "Position", "Location", "Organization"], overlayRenderRow: PersonDetailedOverlayRow, @@ -171,12 +186,22 @@ export const searchFilters = function(includeAdminFilters) { queryVars: {} } } - const locationWidgetFilters = { - all: { - label: "All", - queryVars: {} + const countryWidgetFilters = { + activeCountries: { + label: "Active countries", + queryVars: { + type: Location.LOCATION_TYPES.COUNTRY, + status: Model.STATUS.ACTIVE + } + }, + allCountries: { + label: "All countries", + queryVars: { type: Location.LOCATION_TYPES.COUNTRY } } } + const reportLocationWidgetFilters = Location.getReportLocationFilters() + const positionLocationWidgetFilters = Location.getPositionLocationFilters() + const organizationLocationFilters = Location.getOrganizationLocationFilters() const taskWidgetFilters = { all: { @@ -275,7 +300,7 @@ export const searchFilters = function(includeAdminFilters) { dictProps: Settings.fields.report.location, deserializer: deserializeAdvancedSelectFilter, props: Object.assign({}, advancedSelectFilterLocationProps, { - filterDefs: locationWidgetFilters, + filterDefs: reportLocationWidgetFilters, placeholder: "Filter reports by location...", queryKey: "locationUuid" }) @@ -351,7 +376,6 @@ export const searchFilters = function(includeAdminFilters) { } } - const countries = Settings.fields.regular.person.countries || [] const ranks = (Settings.fields.person.ranks || []).map(f => f.value) filters[SEARCH_OBJECT_TYPES.PEOPLE] = { @@ -369,7 +393,7 @@ export const searchFilters = function(includeAdminFilters) { component: AdvancedSelectFilter, deserializer: deserializeAdvancedSelectFilter, props: Object.assign({}, advancedSelectFilterLocationProps, { - filterDefs: locationWidgetFilters, + filterDefs: positionLocationWidgetFilters, placeholder: "Filter by location...", queryKey: "locationUuid" }) @@ -385,14 +409,14 @@ export const searchFilters = function(includeAdminFilters) { } }, Nationality: { - component: SelectFilter, + component: AdvancedSelectFilter, dictProps: Settings.fields.person.country, - deserializer: deserializeSelectFilter, - props: { - queryKey: "country", - options: countries, - labels: countries - } + deserializer: deserializeAdvancedSelectFilter, + props: Object.assign({}, advancedSelectFilterCountryProps, { + filterDefs: countryWidgetFilters, + placeholder: "Filter by country...", + queryKey: "countryUuid" + }) }, "Has Biography?": { component: RadioButtonFilter, @@ -452,7 +476,7 @@ export const searchFilters = function(includeAdminFilters) { dictProps: Settings.fields.organization.location, deserializer: deserializeAdvancedSelectFilter, props: Object.assign({}, advancedSelectFilterLocationProps, { - filterDefs: locationWidgetFilters, + filterDefs: organizationLocationFilters, placeholder: "Filter by location...", queryKey: "locationUuid" }) @@ -504,7 +528,7 @@ export const searchFilters = function(includeAdminFilters) { dictProps: Settings.fields.position.location, deserializer: deserializeAdvancedSelectFilter, props: Object.assign({}, advancedSelectFilterLocationProps, { - filterDefs: locationWidgetFilters, + filterDefs: positionLocationWidgetFilters, placeholder: "Filter by location...", queryKey: "locationUuid" }) @@ -534,6 +558,7 @@ export const searchFilters = function(includeAdminFilters) { const locationTypeOptions = [ Location.LOCATION_TYPES.POINT_LOCATION, Location.LOCATION_TYPES.GEOGRAPHICAL_AREA, + Location.LOCATION_TYPES.COUNTRY, Location.LOCATION_TYPES.VIRTUAL_LOCATION ] filters[SEARCH_OBJECT_TYPES.LOCATIONS] = { diff --git a/client/src/components/advancedSelectWidget/AdvancedSelectOverlayRow.js b/client/src/components/advancedSelectWidget/AdvancedSelectOverlayRow.js index d0de024140..a833e7712c 100644 --- a/client/src/components/advancedSelectWidget/AdvancedSelectOverlayRow.js +++ b/client/src/components/advancedSelectWidget/AdvancedSelectOverlayRow.js @@ -48,6 +48,14 @@ export const AuthorizationGroupOverlayRow = item => ( ) +export const CountryOverlayRow = item => ( + + {item.name} + {item.digram} + {item.trigram} + +) + export const LocationOverlayRow = item => ( diff --git a/client/src/components/previews/LocationPreview.js b/client/src/components/previews/LocationPreview.js index fb495ae0bc..529f0dfbf1 100644 --- a/client/src/components/previews/LocationPreview.js +++ b/client/src/components/previews/LocationPreview.js @@ -21,6 +21,8 @@ const GQL_GET_LOCATION = gql` lng status type + digram + trigram description } } @@ -64,21 +66,23 @@ const LocationPreview = ({ className, uuid }) => { value={Location.humanNameOfType(location.type)} /> - - } - /> + {Location.hasCoordinates(location) && ( + + } + /> + )} { value={Location.humanNameOfStatus(location.status)} /> + {location.type === Location.LOCATION_TYPES.COUNTRY && ( + <> + + + + + )} + {location.description && ( { )} - + {Location.hasCoordinates(location) && ( + + )} ) } diff --git a/client/src/components/previews/PersonPreview.js b/client/src/components/previews/PersonPreview.js index 5a819a549f..5e25f84df2 100644 --- a/client/src/components/previews/PersonPreview.js +++ b/client/src/components/previews/PersonPreview.js @@ -2,6 +2,7 @@ import { gql } from "@apollo/client" import API from "api" import AppContext from "components/AppContext" import AvatarDisplayComponent from "components/AvatarDisplayComponent" +import CountryDisplay from "components/CountryDisplay" import DictionaryField from "components/DictionaryField" import EmailAddressTable from "components/EmailAddressTable" import { PreviewField } from "components/FieldHelper" @@ -30,7 +31,11 @@ const GQL_GET_PERSON = gql` user domainUsername biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate code @@ -181,7 +186,12 @@ const PersonPreview = ({ className, uuid }) => { + } /> value || null) + .default(null), + trigram: yup + .string() + .nullable() + .optional() + .length(3) + .transform(value => value || null) + .default(null), description: yup.string().nullable().default(""), status: yup .string() @@ -152,13 +167,15 @@ export default class Location extends Model { .concat(Location.customFieldsSchema) .concat(Model.yupSchema) - static autocompleteQuery = "uuid name type" + static autocompleteQuery = "uuid name type digram trigram" static autocompleteQueryWithNotes = `${this.autocompleteQuery} ${GRAPHQL_NOTES_FIELDS}` static allFieldsQuery = ` uuid name + digram + trigram description type lat @@ -216,6 +233,34 @@ export default class Location extends Model { return utils.sentenceCase(type) } + static getLocationFilters(filterDefs) { + return filterDefs?.reduce((accumulator, filter) => { + accumulator[filter] = { + label: Location.humanNameOfType(filter), + queryVars: { type: filter } + } + return accumulator + }, {}) + } + + static getOrganizationLocationFilters() { + return Location.getLocationFilters( + Settings?.fields.regular?.org?.location?.filter + ) + } + + static getPositionLocationFilters() { + return Location.getLocationFilters( + Settings?.fields.regular?.position?.location?.filter + ) + } + + static getReportLocationFilters() { + return Location.getLocationFilters( + Settings?.fields?.report?.location?.filter + ) + } + constructor(props) { super(Model.fillObject(props, Location.yupSchema)) } diff --git a/client/src/models/Person.js b/client/src/models/Person.js index c4a7e738b7..eb52f56925 100644 --- a/client/src/models/Person.js +++ b/client/src/models/Person.js @@ -90,7 +90,7 @@ export default class Person extends Model { } ), country: yup - .string() + .object() .nullable() .when([], (_, schema) => Settings.fields.person.country?.optional @@ -99,7 +99,7 @@ export default class Person extends Model { `You must provide the ${Settings.fields.person.country?.label}` ) ) - .default("") + .default(null) .label(Settings.fields.person.country?.label), rank: yup .string() @@ -175,7 +175,11 @@ export default class Person extends Model { domainUsername openIdSubject biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate code diff --git a/client/src/pages/admin/merge/MergePeople.js b/client/src/pages/admin/merge/MergePeople.js index 3a40ba4a3e..dd8c506f21 100644 --- a/client/src/pages/admin/merge/MergePeople.js +++ b/client/src/pages/admin/merge/MergePeople.js @@ -6,6 +6,7 @@ import API from "api" import { PersonSimpleOverlayRow } from "components/advancedSelectWidget/AdvancedSelectOverlayRow" import AdvancedSingleSelect from "components/advancedSelectWidget/AdvancedSingleSelect" import AvatarDisplayComponent from "components/AvatarDisplayComponent" +import CountryDisplay from "components/CountryDisplay" import { customFieldsJSONString } from "components/CustomFields" import DictionaryField from "components/DictionaryField" import EditHistory from "components/EditHistory" @@ -371,18 +372,27 @@ const MergePeople = ({ pageDispatchers }) => { + } align={ALIGN_OPTIONS.CENTER} action={ !Settings.fields.person.country?.optional ? getInfoButton( `${Settings.fields.person.country?.label} is required.` ) - : getClearButton(() => + : getClearButton(() => { dispatchMergeActions( setAMergedField("country", "", null) ) - ) + dispatchMergeActions( + setAMergedField("obsoleteCountry", "", null) + ) + }) } fieldName="country" mergeState={mergeState} @@ -841,13 +851,26 @@ const PersonColumn = ({ align, label, mergeState, dispatchMergeActions }) => { wrappedComponent={MergeField} dictProps={Settings.fields.person.country} fieldName="country" - value={person.country} + value={ + + } align={align} action={getActionButton( () => { dispatchMergeActions( setAMergedField("country", person.country, align) ) + dispatchMergeActions( + setAMergedField( + "obsoleteCountry", + person.obsoleteCountry, + align + ) + ) }, align, mergeState, diff --git a/client/src/pages/locations/Edit.js b/client/src/pages/locations/Edit.js index 4a4ec068e6..29357b201b 100644 --- a/client/src/pages/locations/Edit.js +++ b/client/src/pages/locations/Edit.js @@ -25,6 +25,8 @@ const GQL_GET_LOCATION = gql` location(uuid: $uuid) { uuid name + digram + trigram description status type diff --git a/client/src/pages/locations/Form.js b/client/src/pages/locations/Form.js index f1b0b842dd..e1c0416660 100644 --- a/client/src/pages/locations/Form.js +++ b/client/src/pages/locations/Form.js @@ -59,6 +59,7 @@ const MIN_CHARS_FOR_DUPLICATES = 3 const LOCATION_TYPES_ADMIN = [ Location.LOCATION_TYPES.POINT_LOCATION, Location.LOCATION_TYPES.GEOGRAPHICAL_AREA, + Location.LOCATION_TYPES.COUNTRY, Location.LOCATION_TYPES.VIRTUAL_LOCATION ] @@ -252,13 +253,15 @@ const LocationForm = ({ } /> - + {values.type !== Location.LOCATION_TYPES.VIRTUAL_LOCATION && ( + + )} setFieldValue("status", value)} /> + {values.type === Location.LOCATION_TYPES.COUNTRY && ( + <> + + + + + )} + -

Drag the marker below to set the location

- - updateCoordinateFields(map.wrapLatLng(event.latlng))} - /> + {values.type !== Location.LOCATION_TYPES.VIRTUAL_LOCATION && ( + <> +

Drag the marker below to set the location

+ + updateCoordinateFields(map.wrapLatLng(event.latlng))} + /> + + )} { humanValue={Location.humanNameOfType(location.type)} /> - + {Location.hasCoordinates(location) && ( + + )} { humanValue={Location.humanNameOfStatus} /> + {location.type === Location.LOCATION_TYPES.COUNTRY && ( + <> + + + + + )} + {values.description && ( { )} - + {Location.hasCoordinates(location) && ( + + )} diff --git a/client/src/pages/onboarding/Edit.js b/client/src/pages/onboarding/Edit.js index 9207757897..660ba931ba 100644 --- a/client/src/pages/onboarding/Edit.js +++ b/client/src/pages/onboarding/Edit.js @@ -24,7 +24,11 @@ const GQL_GET_SELF = gql` phoneNumber pendingVerification biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate user diff --git a/client/src/pages/onboarding/Show.js b/client/src/pages/onboarding/Show.js index f5504d0f49..0a84e89b69 100644 --- a/client/src/pages/onboarding/Show.js +++ b/client/src/pages/onboarding/Show.js @@ -2,6 +2,7 @@ import { gql } from "@apollo/client" import { DEFAULT_SEARCH_PROPS, PAGE_PROPS_MIN_HEAD } from "actions" import API from "api" import AppContext from "components/AppContext" +import CountryDisplay from "components/CountryDisplay" import DictionaryField from "components/DictionaryField" import EmailAddressTable from "components/EmailAddressTable" import * as FieldHelper from "components/FieldHelper" @@ -34,7 +35,11 @@ const GQL_GET_SELF = gql` phoneNumber pendingVerification biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate user @@ -180,6 +185,13 @@ const OnboardingShow = ({ pageDispatchers }) => { moment(person.endOfTourDate).format( Settings.dateFormats.forms.displayShort.date ), + country: ( + + ), status: Person.humanNameOfStatus(person.status) } return person.getNormalFieldsOrdered().reduce((accum, key) => { diff --git a/client/src/pages/organizations/Form.js b/client/src/pages/organizations/Form.js index 64db309f5e..5a2a186326 100644 --- a/client/src/pages/organizations/Form.js +++ b/client/src/pages/organizations/Form.js @@ -160,6 +160,7 @@ const OrganizationForm = ({ edit, title, initialValues, notesComponent }) => { queryVars: {} } } + const locationFilters = Location.getOrganizationLocationFilters() const approversFilters = { allPositions: { @@ -343,7 +344,7 @@ const OrganizationForm = ({ edit, title, initialValues, notesComponent }) => { value={values.location} overlayColumns={["Name"]} overlayRenderRow={LocationOverlayRow} - filterDefs={getLocationFilters(values)} + filterDefs={locationFilters} objectType={Location} fields={Location.autocompleteQuery} valueKey="name" @@ -652,19 +653,6 @@ const OrganizationForm = ({ edit, title, initialValues, notesComponent }) => { { organization } ).then() } - - function getLocationFilters(values) { - return Settings?.fields.regular?.org?.location?.filter.reduce( - (accumulator, filter) => { - accumulator[filter] = { - label: Location.humanNameOfType(filter), - queryVars: { type: filter } - } - return accumulator - }, - {} - ) - } } OrganizationForm.propTypes = { diff --git a/client/src/pages/people/Compact.js b/client/src/pages/people/Compact.js index b1d11f3b81..2272a6036a 100644 --- a/client/src/pages/people/Compact.js +++ b/client/src/pages/people/Compact.js @@ -12,6 +12,7 @@ import CompactTable, { HalfColumn, PAGE_SIZES } from "components/Compact" +import CountryDisplay from "components/CountryDisplay" import { mapReadonlyCustomFieldsToComps } from "components/CustomFields" import DictionaryField from "components/DictionaryField" import EmailAddressTable from "components/EmailAddressTable" @@ -58,7 +59,11 @@ const GQL_GET_PERSON = gql` domainUsername openIdSubject biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate code @@ -397,6 +402,12 @@ const CompactPersonView = ({ pageDispatchers }) => { emailAddresses={person.emailAddresses} /> ), + country: ( + + ), endOfTourDate: person.endOfTourDate && moment(person.endOfTourDate).format( diff --git a/client/src/pages/people/Edit.js b/client/src/pages/people/Edit.js index 4033eed195..8e1eebd1e9 100644 --- a/client/src/pages/people/Edit.js +++ b/client/src/pages/people/Edit.js @@ -40,7 +40,11 @@ const GQL_GET_PERSON = gql` domainUsername openIdSubject biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate code diff --git a/client/src/pages/people/Form.js b/client/src/pages/people/Form.js index 9ec80f0f47..ea858c7a23 100644 --- a/client/src/pages/people/Form.js +++ b/client/src/pages/people/Form.js @@ -1,7 +1,10 @@ import { gql } from "@apollo/client" import { Icon, IconSize, Intent } from "@blueprintjs/core" import { IconNames } from "@blueprintjs/icons" +import { Tooltip2 } from "@blueprintjs/popover2" import API from "api" +import { CountryOverlayRow } from "components/advancedSelectWidget/AdvancedSelectOverlayRow" +import AdvancedSingleSelect from "components/advancedSelectWidget/AdvancedSingleSelect" import AppContext from "components/AppContext" import UploadAttachment, { attachmentSave @@ -32,7 +35,7 @@ import TriggerableConfirm from "components/TriggerableConfirm" import { FastField, Field, Form, Formik } from "formik" import _isEmpty from "lodash/isEmpty" import _isEqual from "lodash/isEqual" -import { Person } from "models" +import { Location, Person } from "models" import moment from "moment" import PropTypes from "prop-types" import React, { useContext, useEffect, useRef, useState } from "react" @@ -148,6 +151,19 @@ const PersonForm = ({ value: "FEMALE" } ] + const countryFilters = { + activeCountries: { + label: "Active countries", + queryVars: { + type: Location.LOCATION_TYPES.COUNTRY, + status: Model.STATUS.ACTIVE + } + }, + allCountries: { + label: "All countries", + queryVars: { type: Location.LOCATION_TYPES.COUNTRY } + } + } const checkPotentialDuplicatesDebounced = useDebouncedCallback( checkPotentialDuplicates, 400 @@ -189,11 +205,6 @@ const PersonForm = ({ values.position ) const ranks = Settings.fields.person.ranks || [] - const countries = getCountries() - if (countries.length === 1 && !values.country) { - // Assign default country if there's only one - values.country = countries[0] - } // admins can edit all persons, // superusers for their organization hierarchy or position-less people, // and the user themselves when onboarding @@ -638,19 +649,58 @@ const PersonForm = ({ } /> { + // validation will be done by setFieldValue + setFieldTouched("country", true, false) // onBlur doesn't work when selecting an option + setFieldValue("country", value) + if (value) { + setFieldValue("obsoleteCountry", null) + } + }} widget={ - - - ))} - + } + showRemoveButton + /> + } + extraColElem={ + values.obsoleteCountry ? ( + <> + + + + + ) : undefined } /> ) - function getCountries() { - return Settings.fields.regular.person.countries - } - async function updateAvatar(newAvatarUuid) { await API.mutation(GQL_UPDATE_PERSON_AVATAR, { person: { uuid: initialValues.uuid, avatarUuid: newAvatarUuid } @@ -901,6 +947,7 @@ const PersonForm = ({ { firstName: values.firstName, lastName: values.lastName }, true ) + person.country = utils.getReference(person.country) person.customSensitiveInformation = updateCustomSensitiveInformation(values) person.customFields = customFieldsJSONString(values) const updateMutation = forOnboarding ? GQL_UPDATE_SELF : GQL_UPDATE_PERSON diff --git a/client/src/pages/people/Show.js b/client/src/pages/people/Show.js index 4ca1a32ee3..62387b77a1 100644 --- a/client/src/pages/people/Show.js +++ b/client/src/pages/people/Show.js @@ -8,6 +8,7 @@ import AssessmentResultsContainer from "components/assessments/AssessmentResults import AssignPositionModal from "components/AssignPositionModal" import AttachmentCard from "components/Attachment/AttachmentCard" import AuthorizationGroupTable from "components/AuthorizationGroupTable" +import CountryDisplay from "components/CountryDisplay" import { mapReadonlyCustomFieldsToComps } from "components/CustomFields" import DictionaryField from "components/DictionaryField" import EditAssociatedPositionsModal from "components/EditAssociatedPositionsModal" @@ -76,7 +77,11 @@ const GQL_GET_PERSON = gql` domainUsername openIdSubject biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate code @@ -528,6 +533,12 @@ const PersonShow = ({ pageDispatchers }) => { emailAddresses={person.emailAddresses} /> ), + country: ( + + ), endOfTourDate: person.endOfTourDate && moment(person.endOfTourDate).format( diff --git a/client/src/pages/positions/Form.js b/client/src/pages/positions/Form.js index 54d97c8223..e51500f9e9 100644 --- a/client/src/pages/positions/Form.js +++ b/client/src/pages/positions/Form.js @@ -202,6 +202,7 @@ const PositionForm = ({ edit, title, initialValues, notesComponent }) => { queryVars: {} } } + const locationFilters = Location.getPositionLocationFilters() return (
@@ -313,7 +314,7 @@ const PositionForm = ({ edit, title, initialValues, notesComponent }) => { value={values.location} overlayColumns={["Name"]} overlayRenderRow={LocationOverlayRow} - filterDefs={getLocationFilters(values)} + filterDefs={locationFilters} objectType={Location} fields={Location.autocompleteQuery} valueKey="name" @@ -417,19 +418,6 @@ const PositionForm = ({ edit, title, initialValues, notesComponent }) => { ) - function getLocationFilters(values) { - return Settings?.fields.regular?.position?.location?.filter.reduce( - (accumulator, filter) => { - accumulator[filter] = { - label: Location.humanNameOfType(filter), - queryVars: { type: filter } - } - return accumulator - }, - {} - ) - } - function onCancel() { navigate(-1) } diff --git a/client/src/pages/reports/Form.js b/client/src/pages/reports/Form.js index c4e60cd45b..ab4e6fa443 100644 --- a/client/src/pages/reports/Form.js +++ b/client/src/pages/reports/Form.js @@ -360,6 +360,7 @@ const ReportForm = ({ const currentOrg = currentUser.position && currentUser.position.organization + const locationFilters = Location.getReportLocationFilters() const reportPeopleFilters = { all: { label: "All", @@ -610,7 +611,7 @@ const ReportForm = ({ value={values.location} overlayColumns={["Name"]} overlayRenderRow={LocationOverlayRow} - filterDefs={getLocationFilters()} + filterDefs={locationFilters} objectType={Location} fields={Location.autocompleteQuery} valueKey="name" @@ -1224,19 +1225,6 @@ const ReportForm = ({ ) - function getLocationFilters() { - return Settings?.fields?.report?.location?.filter.reduce( - (accumulator, filter) => { - accumulator[filter] = { - label: Location.humanNameOfType(filter), - queryVars: { type: filter } - } - return accumulator - }, - {} - ) - } - function getReportType(values) { return values.engagementDate && Report.isFuture(values.engagementDate) ? "planned engagement" diff --git a/client/tests/sim/stories/PersonStories.js b/client/tests/sim/stories/PersonStories.js index 9d525caf6b..1f6c79a610 100644 --- a/client/tests/sim/stories/PersonStories.js +++ b/client/tests/sim/stories/PersonStories.js @@ -1,8 +1,7 @@ import { allFakers, allLocales, faker } from "@faker-js/faker" import Model from "components/Model" -import { countries } from "countries-list" -import { getAlpha2Code } from "i18n-iso-countries" -import { Person } from "models" +import { countries, getCountryCode } from "countries-list" +import { Location, Person } from "models" import Settings from "settings" import { createEmailAddresses, @@ -14,6 +13,7 @@ import { } from "../simutils" import afghanFirstNames from "./afghanFirstNames" import afghanSurnames from "./afghanSurnames" +import { getRandomObject } from "./NoteStories" const availableLocales = Object.keys(allLocales) const availableRanks = Settings.fields.person.ranks.map(r => r.value) @@ -39,18 +39,20 @@ function personName(gender, locale) { } } -function randomPerson(isUser, status) { +async function randomPerson(user, isUser, status) { const gender = fuzzy.withProbability(0.1) ? "NOT SPECIFIED" : fuzzy.withProbability(0.5) ? "MALE" : "FEMALE" const defaultLangCode = "en" - const country = faker.helpers.arrayElement( - Settings.fields.regular.person.countries + const country = await getRandomObject( + user, + "locations", + { type: Location.LOCATION_TYPES.COUNTRY }, + "uuid name digram" ) - // Countries in the Settings from anet.yml are in English - const countryCode = getAlpha2Code(country, "en") + const countryCode = getCountryCode(country.name) || country.digram const countryByCode = countries[countryCode] // Some hacks for picking country-specific languages supported by faker const fakerHacks = { @@ -130,7 +132,7 @@ function modifiedPerson() { const _createPerson = async function(user, isUser, status) { const person = Person.filterClientSideFields(new Person()) - populate(person, randomPerson(isUser, status)) + populate(person, await randomPerson(user, isUser, status)) .name.always() .status.always() .rank.always() @@ -206,7 +208,9 @@ const updatePerson = async function(user) { person (uuid:"${person.uuid}") { uuid biography - country + country { + uuid + } endOfTourDate gender name @@ -299,7 +303,9 @@ const _deletePerson = async function(user) { query { person(uuid: "${person0.uuid}") { biography - country + country { + uuid + } endOfTourDate gender name diff --git a/client/tests/webdriver/baseSpecs/createNewPerson.spec.js b/client/tests/webdriver/baseSpecs/createNewPerson.spec.js index 16f08f46e4..9a76c8c3c9 100644 --- a/client/tests/webdriver/baseSpecs/createNewPerson.spec.js +++ b/client/tests/webdriver/baseSpecs/createNewPerson.spec.js @@ -3,11 +3,13 @@ import moment from "moment" import CreatePerson from "../pages/createNewPerson.page" const VALID_PERSON_INTERLOCUTOR = { - lastName: "Doe" + lastName: "Doe", + country: "Denmark" } const VALID_PERSON_ADVISOR = { lastName: "Roe", firstName: "Jane", + country: "Canada", emailAddresses: ["", "test@NATO.INT"] } const NOT_SIMILAR_PERSON_ADVISOR = { @@ -60,12 +62,19 @@ describe("Create new Person form page", () => { "value", await CreatePerson.getRandomOption(await CreatePerson.getRank()) ) + + await (await CreatePerson.getCountryInput()).click() await ( - await CreatePerson.getCountry() - ).selectByAttribute( - "value", - await CreatePerson.getRandomOption(await CreatePerson.getCountry()) + await CreatePerson.getCountryInput() + ).setValue(VALID_PERSON_INTERLOCUTOR.country) + await CreatePerson.waitForCountryAdvancedSelectToChange( + VALID_PERSON_INTERLOCUTOR.country ) + expect( + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(VALID_PERSON_INTERLOCUTOR.country) + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).click() + await CreatePerson.submitForm() await CreatePerson.waitForAlertSuccessToLoad() const alertMessage = await ( @@ -90,12 +99,19 @@ describe("Create new Person form page", () => { "value", await CreatePerson.getRandomOption(await CreatePerson.getGender()) ) + + await (await CreatePerson.getCountryInput()).click() await ( - await CreatePerson.getCountry() - ).selectByAttribute( - "value", - await CreatePerson.getRandomOption(await CreatePerson.getCountry()) + await CreatePerson.getCountryInput() + ).setValue(VALID_PERSON_INTERLOCUTOR.country) + await CreatePerson.waitForCountryAdvancedSelectToChange( + VALID_PERSON_INTERLOCUTOR.country ) + expect( + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(VALID_PERSON_INTERLOCUTOR.country) + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).click() + await CreatePerson.submitForm() await CreatePerson.waitForAlertSuccessToLoad() const alertMessage = await ( @@ -120,12 +136,19 @@ describe("Create new Person form page", () => { "value", await CreatePerson.getRandomOption(await CreatePerson.getGender()) ) + + await (await CreatePerson.getCountryInput()).click() await ( - await CreatePerson.getCountry() - ).selectByAttribute( - "value", - await CreatePerson.getRandomOption(await CreatePerson.getCountry()) + await CreatePerson.getCountryInput() + ).setValue(VALID_PERSON_INTERLOCUTOR.country) + await CreatePerson.waitForCountryAdvancedSelectToChange( + VALID_PERSON_INTERLOCUTOR.country ) + expect( + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(VALID_PERSON_INTERLOCUTOR.country) + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).click() + await (await CreatePerson.getEmailAddress(0)).setValue("notValidEmail@") await (await CreatePerson.getLastName()).click() const errorMessage = await CreatePerson.getEmailAddressMessage(0) @@ -217,12 +240,19 @@ describe("Create new Person form page", () => { "value", await CreatePerson.getRandomOption(await CreatePerson.getGender()) ) + + await (await CreatePerson.getCountryInput()).click() await ( - await CreatePerson.getCountry() - ).selectByAttribute( - "value", - await CreatePerson.getRandomOption(await CreatePerson.getCountry()) + await CreatePerson.getCountryInput() + ).setValue(VALID_PERSON_ADVISOR.country) + await CreatePerson.waitForCountryAdvancedSelectToChange( + VALID_PERSON_ADVISOR.country ) + expect( + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(VALID_PERSON_ADVISOR.country) + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).click() + await (await CreatePerson.getEndOfTourDate()).setValue("") await (await CreatePerson.getLastName()).click() for (const [index] of VALID_PERSON_ADVISOR.emailAddresses.entries()) { @@ -235,14 +265,6 @@ describe("Create new Person form page", () => { it("Should save with a valid email address in uppercase", async() => { // Continue on the same page to prevent "Are you sure you wish to navigate away from the page" warning - await ( - await CreatePerson.getLastName() - ).setValue(VALID_PERSON_ADVISOR.lastName) - await ( - await CreatePerson.getFirstName() - ).setValue(VALID_PERSON_ADVISOR.firstName) - await (await CreatePerson.getUserTrueButton()).waitForExist() - await (await CreatePerson.getUserTrueButton()).click() for (const [ index, address @@ -256,26 +278,8 @@ describe("Create new Person form page", () => { // element should *not* be visible! await errorMessage.waitForDisplayed({ timeout: 1000, reverse: true }) } - await ( - await CreatePerson.getRank() - ).selectByAttribute( - "value", - await CreatePerson.getRandomOption(await CreatePerson.getRank()) - ) - await ( - await CreatePerson.getGender() - ).selectByAttribute( - "value", - await CreatePerson.getRandomOption(await CreatePerson.getGender()) - ) - await ( - await CreatePerson.getCountry() - ).selectByAttribute( - "value", - await CreatePerson.getRandomOption(await CreatePerson.getCountry()) - ) - const tomorrow = moment().add(1, "days").format("DD-MM-YYYY") + const tomorrow = moment().add(1, "days").format("DD-MM-YYYY") await CreatePerson.deleteInput(CreatePerson.getEndOfTourDate()) await (await CreatePerson.getEndOfTourDate()).setValue(tomorrow) await (await CreatePerson.getLastName()).click() diff --git a/client/tests/webdriver/baseSpecs/mergePeople.spec.js b/client/tests/webdriver/baseSpecs/mergePeople.spec.js index 8246bacf29..c299237458 100644 --- a/client/tests/webdriver/baseSpecs/mergePeople.spec.js +++ b/client/tests/webdriver/baseSpecs/mergePeople.spec.js @@ -60,7 +60,7 @@ const EXAMPLE_PEOPLE = { phone: "+1-412-7324", rank: "CIV", gender: "MALE", - nationality: "United States of America", + nationality: "United States", previousPositions: [ { name: "EF 1 Manager", diff --git a/client/tests/webdriver/baseSpecs/onboardNewUser.spec.js b/client/tests/webdriver/baseSpecs/onboardNewUser.spec.js index 90ac34c376..9ce14362bd 100644 --- a/client/tests/webdriver/baseSpecs/onboardNewUser.spec.js +++ b/client/tests/webdriver/baseSpecs/onboardNewUser.spec.js @@ -80,9 +80,17 @@ describe("Onboard new user login", () => { await ( await OnboardPage.getGender() ).selectByAttribute("value", personDetails.gender) - await ( - await OnboardPage.getCountry() - ).selectByAttribute("value", personDetails.country) + + await (await OnboardPage.getCountryInput()).click() + await (await OnboardPage.getCountryInput()).setValue(personDetails.country) + await OnboardPage.waitForCountryAdvancedSelectToChange( + personDetails.country + ) + expect( + await (await OnboardPage.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(personDetails.country) + await (await OnboardPage.getCountryAdvancedSelectFirstItem()).click() + await ( await OnboardPage.getEndOfTourDate() ).setValue(personDetails.endOfTourDate) diff --git a/client/tests/webdriver/customFieldsSpecs/customFields.spec.js b/client/tests/webdriver/customFieldsSpecs/customFields.spec.js index caaeb2a7e8..e7f011dfb3 100644 --- a/client/tests/webdriver/customFieldsSpecs/customFields.spec.js +++ b/client/tests/webdriver/customFieldsSpecs/customFields.spec.js @@ -212,9 +212,18 @@ describe("When working with custom fields for different anet objects", () => { await ( await CreatePerson.getGender() ).selectByAttribute("value", REQUIRED_PERSON_FIELDS.gender) + + await (await CreatePerson.getCountryInput()).click() await ( - await CreatePerson.getCountry() - ).selectByAttribute("value", REQUIRED_PERSON_FIELDS.country) + await CreatePerson.getCountryInput() + ).setValue(REQUIRED_PERSON_FIELDS.country) + await CreatePerson.waitForCountryAdvancedSelectToChange( + REQUIRED_PERSON_FIELDS.country + ) + expect( + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(REQUIRED_PERSON_FIELDS.country) + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).click() }) it("Should not show default invisible fields", async() => { diff --git a/client/tests/webdriver/customFieldsSpecs/customSensitiveFields.spec.js b/client/tests/webdriver/customFieldsSpecs/customSensitiveFields.spec.js index d5d415ca34..97bb4940da 100644 --- a/client/tests/webdriver/customFieldsSpecs/customSensitiveFields.spec.js +++ b/client/tests/webdriver/customFieldsSpecs/customSensitiveFields.spec.js @@ -173,9 +173,18 @@ describe("Creating and editing custom sensitive information", () => { await ( await CreatePerson.getGender() ).selectByAttribute("value", NEW_PERSON_FIELDS_1.gender) + + await (await CreatePerson.getCountryInput()).click() await ( - await CreatePerson.getCountry() - ).selectByAttribute("value", NEW_PERSON_FIELDS_1.country) + await CreatePerson.getCountryInput() + ).setValue(NEW_PERSON_FIELDS_1.country) + await CreatePerson.waitForCountryAdvancedSelectToChange( + NEW_PERSON_FIELDS_1.country + ) + expect( + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(NEW_PERSON_FIELDS_1.country) + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).click() }) it("Should not be able to edit sensitive fields if not authorized", async() => { await ( @@ -228,9 +237,18 @@ describe("Creating and editing custom sensitive information", () => { await ( await CreatePerson.getGender() ).selectByAttribute("value", NEW_PERSON_FIELDS_2.gender) + + await (await CreatePerson.getCountryInput()).click() await ( - await CreatePerson.getCountry() - ).selectByAttribute("value", NEW_PERSON_FIELDS_2.country) + await CreatePerson.getCountryInput() + ).setValue(NEW_PERSON_FIELDS_2.country) + await CreatePerson.waitForCountryAdvancedSelectToChange( + NEW_PERSON_FIELDS_2.country + ) + expect( + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).getText() + ).to.include(NEW_PERSON_FIELDS_2.country) + await (await CreatePerson.getCountryAdvancedSelectFirstItem()).click() }) it("Should be able to create a new person with sensitive information", async() => { await CreatePerson.deleteInput(CreatePerson.getBirthday()) diff --git a/client/tests/webdriver/pages/createNewPerson.page.js b/client/tests/webdriver/pages/createNewPerson.page.js index 4891a22f6a..d377c15a54 100644 --- a/client/tests/webdriver/pages/createNewPerson.page.js +++ b/client/tests/webdriver/pages/createNewPerson.page.js @@ -77,8 +77,31 @@ export class CreatePerson extends Page { return browser.$('select[name="gender"]') } - async getCountry() { - return browser.$('select[name="country"]') + async getCountryInput() { + return browser.$("#country") + } + + async getCountryAdvancedSelectFirstItem() { + return browser.$("#country-popover tbody tr:first-child td:nth-child(2)") + } + + async waitForCountryAdvancedSelectToChange(value) { + await (await this.getCountryAdvancedSelectFirstItem()).waitForExist() + return browser.waitUntil( + async() => { + return ( + (await (await this.getCountryAdvancedSelectFirstItem()).getText()) === + value + ) + }, + { + timeout: 5000, + timeoutMsg: + 'Expected country advanced select input to contain "' + + value + + '" after 5s' + } + ) } async getEndOfTourDate() { diff --git a/client/yarn.lock b/client/yarn.lock index de8c76add4..fad9b7b4e3 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -6314,7 +6314,6 @@ __metadata: handlebars-loader: "npm:1.7.3" hopscotch: "npm:0.3.1" html-webpack-plugin: "npm:5.6.0" - i18n-iso-countries: "npm:7.11.0" ignore-loader: "npm:0.1.2" jest: "npm:29.7.0" jest-environment-jsdom: "npm:29.7.0" @@ -9489,13 +9488,6 @@ __metadata: languageName: node linkType: hard -"diacritics@npm:1.3.0": - version: 1.3.0 - resolution: "diacritics@npm:1.3.0" - checksum: 10c0/bc99c3d2e64315b1830f1573eafe1f7b06fd5dbc9687f35ea8e2e25ce8618d1444d0a2c8313b98467b0aff1d0ee35b8f9f67ef214e56e810b37da3cdb29785ac - languageName: node - linkType: hard - "diff-sequences@npm:^29.6.3": version: 29.6.3 resolution: "diff-sequences@npm:29.6.3" @@ -12342,15 +12334,6 @@ __metadata: languageName: node linkType: hard -"i18n-iso-countries@npm:7.11.0": - version: 7.11.0 - resolution: "i18n-iso-countries@npm:7.11.0" - dependencies: - diacritics: "npm:1.3.0" - checksum: 10c0/c97aa0d873944a822684d6b368418249f3e9ac9b52f2efec6731dfa8083e5289b4cd0c52eaa75af5ce11f94977f3f08ecfe0be72eae13d51d1d1f738bcc93e61 - languageName: node - linkType: hard - "iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" diff --git a/insertBaseData-psql.sql b/insertBaseData-psql.sql index e9ca6f5576..c58ba79e43 100644 --- a/insertBaseData-psql.sql +++ b/insertBaseData-psql.sql @@ -10,7 +10,8 @@ TRUNCATE TABLE "comments" CASCADE; TRUNCATE TABLE "customSensitiveInformation" CASCADE; TRUNCATE TABLE "emailAddresses" CASCADE; TRUNCATE TABLE "jobHistory" CASCADE; -TRUNCATE TABLE "locations" CASCADE; +-- Countries are inserted by the migrations! +DELETE FROM "locations" WHERE type != 'PAC'; TRUNCATE TABLE "noteRelatedObjects" CASCADE; TRUNCATE TABLE "notes" CASCADE; TRUNCATE TABLE "organizationAdministrativePositions" CASCADE; @@ -35,48 +36,48 @@ TRUNCATE TABLE "tasks" CASCADE; TRUNCATE TABLE "userActivities" CASCADE; -- Create people -INSERT INTO people (uuid, name, status, "phoneNumber", rank, biography, "user", "domainUsername", "openIdSubject", country, gender, "endOfTourDate", "createdAt", "updatedAt") VALUES +INSERT INTO people (uuid, name, status, "phoneNumber", rank, biography, "user", "domainUsername", "openIdSubject", "countryUuid", gender, "endOfTourDate", "createdAt", "updatedAt") VALUES -- Advisors - ('b5d495af-44d5-4c35-851a-1039352a8307', 'JACKSON, Jack', 0, '123-456-78960', 'OF-9', 'Jack is an advisor in EF 2.1', true, 'jack', '89003390-168e-4dc3-a582-5b38ae264bdd', 'Germany', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('a9d65d96-d107-45c3-bbaa-1133a354335b', 'ELIZAWELL, Elizabeth', 0, '+1-777-7777', 'OF-2', 'Elizabeth is a test advisor we have in the database who is in EF 1.1', true, 'elizabeth', '06547ee2-dcc3-420c-96cb-5f3bb3793b4d', 'United States of America', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('00b19ebf-0d4d-4b0f-93c8-9023ccb59c49', 'SOLENOID, Selena', 0, '+1-111-1111', 'CIV', 'Selena is a test advisor in EF 1.2', true, 'selena', 'ce1df48e-fd6e-4dc4-bc00-9bb65a0d6910', 'United States of America', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('df9c7381-56ac-4bc5-8e24-ec524bccd7e9', 'ERINSON, Erin', 0, '+9-23-2323-2323', 'CIV', 'Erin is an Advisor in EF 2.2 who can approve reports', true, 'erin', '04c29bab-7b20-4ff2-8583-8ad3dbcff4d6', 'Australia', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('1ad0c049-6ce8-4890-84f6-5e6a364764c4', 'REINTON, Reina', 0, '+23-23-11222', 'CIV', 'Reina is an Advisor in EF 2.2', true, 'reina', '5b585887-1c3d-4f47-bccb-cdfebfd6e919', 'Italy', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('39d02d26-49eb-43b5-9cec-344777213a67', 'DVISOR, A', 0, '+444-44-4444', 'OF-2', 'A Dvisor was born for this job', true, 'advisor', 'd09a55cf-6aa4-4bbf-8bf3-055ddcb4d27c', 'Canada', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('31cba227-f6c6-49e9-9483-fce441bea624', 'BRATTON, Creed', 0, '+444-44-4444', 'CIV', 'Let me first settle in.', true, 'creed', 'efad3f0d-3cd0-40fc-ac7e-90a1fa343e89', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('d4e1ae87-e519-4ec6-b0a4-5c3b19a0183e', 'MALONE, Kevin', 0, '+444-44-4444', 'CIV', 'Sometimes numbers just dont add up.', true, 'kevin', 'cf05120c-bb43-408f-93ac-609c996a9da5', 'United States of America', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('02fdbd68-866f-457a-990c-fbd79bc9b96c', 'GUIST, Lin', 0, '+444-44-4444', 'CIV', 'Lin can speak so many languages', true, 'lin', 'd8d9eb8f-acfd-40fa-91c7-1ddc4401b8da', 'United States of America', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('bcd9d5e4-bf6c-42de-9246-8116f2b23bdc', 'PRETER, Inter', 0, '+444-44-4444', 'CIV', 'Inter is fluent in various languages', true, 'inter', '7a17af5d-7863-47b5-8034-4e2f79f3fa0b', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('c71f707a-667f-4713-9552-8510d69a308b', 'ROGERS, Ben', 0, '+99-9999-9999', 'CIV', NULL, true, NULL, NULL, 'Italy', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('c033862b-a4ef-4043-acd5-a2b399a10f00', 'RIVERS, Kevin', 0, '+99-9999-9999', 'CIV', NULL, true, NULL, NULL, 'Italy', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('b5d495af-44d5-4c35-851a-1039352a8307', 'JACKSON, Jack', 0, '123-456-78960', 'OF-9', 'Jack is an advisor in EF 2.1', true, 'jack', '89003390-168e-4dc3-a582-5b38ae264bdd', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Germany'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('a9d65d96-d107-45c3-bbaa-1133a354335b', 'ELIZAWELL, Elizabeth', 0, '+1-777-7777', 'OF-2', 'Elizabeth is a test advisor we have in the database who is in EF 1.1', true, 'elizabeth', '06547ee2-dcc3-420c-96cb-5f3bb3793b4d', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('00b19ebf-0d4d-4b0f-93c8-9023ccb59c49', 'SOLENOID, Selena', 0, '+1-111-1111', 'CIV', 'Selena is a test advisor in EF 1.2', true, 'selena', 'ce1df48e-fd6e-4dc4-bc00-9bb65a0d6910', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('df9c7381-56ac-4bc5-8e24-ec524bccd7e9', 'ERINSON, Erin', 0, '+9-23-2323-2323', 'CIV', 'Erin is an Advisor in EF 2.2 who can approve reports', true, 'erin', '04c29bab-7b20-4ff2-8583-8ad3dbcff4d6', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Australia'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('1ad0c049-6ce8-4890-84f6-5e6a364764c4', 'REINTON, Reina', 0, '+23-23-11222', 'CIV', 'Reina is an Advisor in EF 2.2', true, 'reina', '5b585887-1c3d-4f47-bccb-cdfebfd6e919', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Italy'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('39d02d26-49eb-43b5-9cec-344777213a67', 'DVISOR, A', 0, '+444-44-4444', 'OF-2', 'A Dvisor was born for this job', true, 'advisor', 'd09a55cf-6aa4-4bbf-8bf3-055ddcb4d27c', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Canada'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('31cba227-f6c6-49e9-9483-fce441bea624', 'BRATTON, Creed', 0, '+444-44-4444', 'CIV', 'Let me first settle in.', true, 'creed', 'efad3f0d-3cd0-40fc-ac7e-90a1fa343e89', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('d4e1ae87-e519-4ec6-b0a4-5c3b19a0183e', 'MALONE, Kevin', 0, '+444-44-4444', 'CIV', 'Sometimes numbers just dont add up.', true, 'kevin', 'cf05120c-bb43-408f-93ac-609c996a9da5', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('02fdbd68-866f-457a-990c-fbd79bc9b96c', 'GUIST, Lin', 0, '+444-44-4444', 'CIV', 'Lin can speak so many languages', true, 'lin', 'd8d9eb8f-acfd-40fa-91c7-1ddc4401b8da', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('bcd9d5e4-bf6c-42de-9246-8116f2b23bdc', 'PRETER, Inter', 0, '+444-44-4444', 'CIV', 'Inter is fluent in various languages', true, 'inter', '7a17af5d-7863-47b5-8034-4e2f79f3fa0b', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('c71f707a-667f-4713-9552-8510d69a308b', 'ROGERS, Ben', 0, '+99-9999-9999', 'CIV', NULL, true, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Italy'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('c033862b-a4ef-4043-acd5-a2b399a10f00', 'RIVERS, Kevin', 0, '+99-9999-9999', 'CIV', NULL, true, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Italy'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), -- Advisors with no position for testing - ('bdd91de7-09c7-4f09-97e4-d3325bb92dab', 'NOPOSITION, Ihave', 0, '+444-44-4545', 'OF-2', 'I need a career change', true, 'nopos', 'e88f6157-61bf-4d43-96eb-f65a91d927c0', 'Canada', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('7914ceba-7f89-493b-bd03-eee7e19c60a8', 'REPORTGUY, Ima', 0, '+444-44-4545', 'CIV', 'I need a career change', true, 'reportguy', NULL, 'France', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('d9f3ee10-6e01-4d57-9916-67978608e9ba', 'REPORTGIRL, Ima', 0, '+444-44-4545', 'CIV', 'I need a career change', true, 'reportgirl', NULL, 'Mexico', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('7a15d0cc-520f-451c-80d8-399b4642c852', 'BEAU, Yoshie', 0, '+1-202-7320', 'CIV', NULL, true, 'yoshie', 'b3f67185-77e7-42a0-a2eb-f0739077eab5', 'United States of America', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('f73f5cc9-69fd-4ceb-81b9-a0a840914bd8', 'SHARTON, Shardul', 1, '+99-9999-9999', 'CIV', NULL, false, NULL, NULL, 'Italy', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('bdd91de7-09c7-4f09-97e4-d3325bb92dab', 'NOPOSITION, Ihave', 0, '+444-44-4545', 'OF-2', 'I need a career change', true, 'nopos', 'e88f6157-61bf-4d43-96eb-f65a91d927c0', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Canada'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('7914ceba-7f89-493b-bd03-eee7e19c60a8', 'REPORTGUY, Ima', 0, '+444-44-4545', 'CIV', 'I need a career change', true, 'reportguy', NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'France'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('d9f3ee10-6e01-4d57-9916-67978608e9ba', 'REPORTGIRL, Ima', 0, '+444-44-4545', 'CIV', 'I need a career change', true, 'reportgirl', NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Mexico'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('7a15d0cc-520f-451c-80d8-399b4642c852', 'BEAU, Yoshie', 0, '+1-202-7320', 'CIV', NULL, true, 'yoshie', 'b3f67185-77e7-42a0-a2eb-f0739077eab5', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('f73f5cc9-69fd-4ceb-81b9-a0a840914bd8', 'SHARTON, Shardul', 1, '+99-9999-9999', 'CIV', NULL, false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Italy'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), -- Interlocutors - ('90fa5784-9e63-4353-8119-357bcd88e287', 'STEVESON, Steve', 0, '+011-232-12324', 'OF-4', 'this is a sample person who could be a Interlocutor!', false, NULL, NULL, 'Afghanistan', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('6866ce4d-1f8c-4f78-bdc2-4767e9a859b0', 'ROGWELL, Roger', 0, '+1-412-7324', 'OF-3', 'Roger is another test person we have in the database', false, NULL, NULL, 'Afghanistan', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('237e8bf7-2ae4-4d49-b7c8-eca6a92d4767', 'TOPFERNESS, Christopf', 0, '+1-422222222', 'CIV', 'Christopf works in the MoD Office', false, NULL, NULL, 'Afghanistan', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('5fa54ffd-cc90-493a-b4b1-73e9c4568177', 'CHRISVILLE, Chris', 0, '+1-412-7324', 'OF-3', 'Chris is another test person we have in the database', false, NULL, NULL, 'Afghanistan', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('0c5a8ba7-7436-47fd-bead-b8393246a300', 'KYLESON, Kyle', 0, '+1-412-7324', 'CIV', 'Kyle is another test person we have in the database', false, NULL, NULL, 'Afghanistan', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('cebeb179-2a64-4d0c-a06b-76e68f80b5e5', 'BEMERGED, Myposwill', 0, '+1-412-7324', 'CIV', 'Myposwill is a test person whose position will be merged', false, NULL, NULL, 'Afghanistan', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('3cb2076c-5317-47fe-86ad-76f298993917', 'MERGED, Duplicate Winner', 0, '+1-234-5678', 'CIV', 'Winner is a test person who will be merged', false, NULL, NULL, 'Afghanistan', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('c725aef3-cdd1-4baf-ac72-f28219b234e9', 'MERGED, Duplicate Loser', 0, NULL, 'CTR', 'Loser is a test person who will be merged', false, NULL, NULL, 'Afghanistan', 'FEMALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('7d90bf90-b3b1-4e99-84bf-5e50b9dcc9d6', 'HUNTMAN, Hunter', 0, '+1-412-9314', 'CIV', NULL, false, NULL, NULL, 'United States of America', 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('33f708e0-bf7c-47a0-baf1-730afa4f0c98', 'NICHOLSON, Nick', 0, '+1-202-7324', 'CIV', NULL, true, 'nick', '2a1e98bd-13dc-49c9-a1c5-7137eacc0e8f', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('90fa5784-9e63-4353-8119-357bcd88e287', 'STEVESON, Steve', 0, '+011-232-12324', 'OF-4', 'this is a sample person who could be a Interlocutor!', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('6866ce4d-1f8c-4f78-bdc2-4767e9a859b0', 'ROGWELL, Roger', 0, '+1-412-7324', 'OF-3', 'Roger is another test person we have in the database', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('237e8bf7-2ae4-4d49-b7c8-eca6a92d4767', 'TOPFERNESS, Christopf', 0, '+1-422222222', 'CIV', 'Christopf works in the MoD Office', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('5fa54ffd-cc90-493a-b4b1-73e9c4568177', 'CHRISVILLE, Chris', 0, '+1-412-7324', 'OF-3', 'Chris is another test person we have in the database', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('0c5a8ba7-7436-47fd-bead-b8393246a300', 'KYLESON, Kyle', 0, '+1-412-7324', 'CIV', 'Kyle is another test person we have in the database', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('cebeb179-2a64-4d0c-a06b-76e68f80b5e5', 'BEMERGED, Myposwill', 0, '+1-412-7324', 'CIV', 'Myposwill is a test person whose position will be merged', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('3cb2076c-5317-47fe-86ad-76f298993917', 'MERGED, Duplicate Winner', 0, '+1-234-5678', 'CIV', 'Winner is a test person who will be merged', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('c725aef3-cdd1-4baf-ac72-f28219b234e9', 'MERGED, Duplicate Loser', 0, NULL, 'CTR', 'Loser is a test person who will be merged', false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Afghanistan'), 'FEMALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('7d90bf90-b3b1-4e99-84bf-5e50b9dcc9d6', 'HUNTMAN, Hunter', 0, '+1-412-9314', 'CIV', NULL, false, NULL, NULL, (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('33f708e0-bf7c-47a0-baf1-730afa4f0c98', 'NICHOLSON, Nick', 0, '+1-202-7324', 'CIV', NULL, true, 'nick', '2a1e98bd-13dc-49c9-a1c5-7137eacc0e8f', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), -- Superusers - ('98fa4da5-ec99-457b-a4bc-2aa9064e2ca7', 'BOBTOWN, Bob', 0, '+1-444-7324', 'CIV', 'Bob is a Superuser in EF 1.1', true, 'bob', '505c6bd9-e2d1-4f9e-83b0-ecc9279c42c5', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('ff0cec0b-8eca-48ee-82fe-addce6136f3b', 'HENDERSON, Henry', 0, '+2-456-7324', 'OF-6', 'Henry is a Superuser in EF 2.1', true, 'henry', '04fbbc19-3bd9-4075-8dd8-bc8c741d8c3c', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('19fe53bb-90f4-4482-abfc-d85b85deabd9', 'JACOBSON, Jacob', 0, '+2-456-7324', 'CIV', 'Jacob is a Superuser in EF 2.2', true, 'jacob', '19fcef93-1b1a-472b-97f5-77f46cf6f3fd', 'Italy', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('f683335a-91e3-4788-aa3f-9eed384f4ac1', 'BECCABON, Rebecca', 0, '+2-456-7324', 'CTR', 'Rebecca is a Superuser in EF 2.2', true, 'rebecca', '9eb4b898-6fe4-40f8-abca-e893424d75d1', 'Germany', 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('1a557db0-5af5-4ea3-b926-28b5f2e88bf7', 'ANDERSON, Andrew', 0, '+1-412-7324', 'CIV', 'Andrew is the EF 1 Manager', true, 'andrew', '3276c85a-bf03-4591-a74b-56d70ac8eec0', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('ad442c97-ca89-4c63-9a4d-336f17ca856b', 'SCHRUTE, Dwight', 0, '+1-412-7324', 'CIV', 'Beets & Battlestar Galactica.', true, 'dwight', 'cb23f6a5-1321-4330-b972-22d98bff12af', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('b6754f19-b67e-4603-bfe6-af8c61760eef', 'HALPERT, Jim', 0, '+1-412-7324', 'CIV', 'Lets prank dwight.', true, 'jim', 'e8c81377-eaac-4ace-8aa6-7b255b53494c', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('98fa4da5-ec99-457b-a4bc-2aa9064e2ca7', 'BOBTOWN, Bob', 0, '+1-444-7324', 'CIV', 'Bob is a Superuser in EF 1.1', true, 'bob', '505c6bd9-e2d1-4f9e-83b0-ecc9279c42c5', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('ff0cec0b-8eca-48ee-82fe-addce6136f3b', 'HENDERSON, Henry', 0, '+2-456-7324', 'OF-6', 'Henry is a Superuser in EF 2.1', true, 'henry', '04fbbc19-3bd9-4075-8dd8-bc8c741d8c3c', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('19fe53bb-90f4-4482-abfc-d85b85deabd9', 'JACOBSON, Jacob', 0, '+2-456-7324', 'CIV', 'Jacob is a Superuser in EF 2.2', true, 'jacob', '19fcef93-1b1a-472b-97f5-77f46cf6f3fd', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Italy'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('f683335a-91e3-4788-aa3f-9eed384f4ac1', 'BECCABON, Rebecca', 0, '+2-456-7324', 'CTR', 'Rebecca is a Superuser in EF 2.2', true, 'rebecca', '9eb4b898-6fe4-40f8-abca-e893424d75d1', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Germany'), 'FEMALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('1a557db0-5af5-4ea3-b926-28b5f2e88bf7', 'ANDERSON, Andrew', 0, '+1-412-7324', 'CIV', 'Andrew is the EF 1 Manager', true, 'andrew', '3276c85a-bf03-4591-a74b-56d70ac8eec0', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('ad442c97-ca89-4c63-9a4d-336f17ca856b', 'SCHRUTE, Dwight', 0, '+1-412-7324', 'CIV', 'Beets & Battlestar Galactica.', true, 'dwight', 'cb23f6a5-1321-4330-b972-22d98bff12af', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('b6754f19-b67e-4603-bfe6-af8c61760eef', 'HALPERT, Jim', 0, '+1-412-7324', 'CIV', 'Lets prank dwight.', true, 'jim', 'e8c81377-eaac-4ace-8aa6-7b255b53494c', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), -- Administrators - ('87fdbc6a-3109-4e11-9702-a894d6ca31ef', 'DMIN, Arthur', '0', NULL, 'CIV', 'An administrator', true, 'arthur', 'abc72322-1452-4222-bb71-a0b3db435175', 'Albania', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - ('46ba6a73-0cd7-4efb-8e99-215e98cc5987', 'SCOTT, Michael', '0', NULL, 'CIV', 'Worlds best boss.', true, 'michael', 'bd482701-2342-4a50-ba92-d956007a8828', 'United States of America', 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); + ('87fdbc6a-3109-4e11-9702-a894d6ca31ef', 'DMIN, Arthur', '0', NULL, 'CIV', 'An administrator', true, 'arthur', 'abc72322-1452-4222-bb71-a0b3db435175', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'Albania'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + ('46ba6a73-0cd7-4efb-8e99-215e98cc5987', 'SCOTT, Michael', '0', NULL, 'CIV', 'Worlds best boss.', true, 'michael', 'bd482701-2342-4a50-ba92-d956007a8828', (SELECT uuid FROM locations WHERE type = 'PAC' AND name = 'United States'), 'MALE', CURRENT_TIMESTAMP + INTERVAL '1 year', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); UPDATE people SET "customFields"='{"invisibleCustomFields":["formCustomFields.textareaFieldName","formCustomFields.numberFieldName"],"arrayFieldName":[],"nlt_dt":null,"nlt":null,"colourOptions":"","inputFieldName":"Lorem ipsum dolor sit amet","multipleButtons":[],"placeOfResidence":null,"placeOfBirth":null}' @@ -163,7 +164,7 @@ INSERT INTO locations (uuid, type, name, lat, lng, "createdAt", "updatedAt") VAL (N'f2207d9b-204b-4cb5-874d-3fe6bc6f8acd', 'PP', 'Conception Bay South Police Station', 47.526784, -52.954739, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); INSERT INTO locations (uuid, type, name, "createdAt", "updatedAt") VALUES (N'283797ec-7077-49b2-87b8-9afd5499b6f3', 'V', 'VTC', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), - (N'e0ff0d6c-e663-4639-a44d-b075bf1e690d', 'PPP', 'MoD Headquarters Kabul', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), + (N'e0ff0d6c-e663-4639-a44d-b075bf1e690d', 'PP', 'MoD Headquarters Kabul', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (N'5046a870-6c2a-40a7-9681-61a1d6eeaa07', 'PP', 'MoI Headquarters Kabul', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (N'c15eb29e-2965-401e-9f36-6ac8b9cc3842', 'PP', 'President''s Palace', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), (N'0585f158-5121-46a2-b099-799fe980aa9c', 'PP', 'Kabul Police Academy', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), diff --git a/src/main/java/mil/dds/anet/beans/Location.java b/src/main/java/mil/dds/anet/beans/Location.java index bdc6213a6e..f2bf841ab4 100644 --- a/src/main/java/mil/dds/anet/beans/Location.java +++ b/src/main/java/mil/dds/anet/beans/Location.java @@ -9,6 +9,7 @@ import java.util.Objects; import java.util.concurrent.CompletableFuture; import mil.dds.anet.AnetObjectEngine; +import mil.dds.anet.graphql.AllowUnverifiedUsers; import mil.dds.anet.utils.Utils; import mil.dds.anet.views.AbstractCustomizableAnetBean; @@ -19,7 +20,10 @@ public class Location extends AbstractCustomizableAnetBean public static final String DUMMY_LOCATION_UUID = "-1"; public enum LocationType { - PHYSICAL_LOCATION("P"), GEOGRAPHICAL_AREA("PA"), POINT_LOCATION("PP"), // - + PHYSICAL_LOCATION("P"), // - + GEOGRAPHICAL_AREA("PA"), // - + COUNTRY("PAC"), // - + POINT_LOCATION("PP"), // - @Deprecated _PLACEHOLDER_3_(""), // Should no longer be used but remain in place to keep the correct values @Deprecated @@ -66,6 +70,12 @@ public String toString() { private LocationType type; @GraphQLQuery @GraphQLInputField + private String digram; + @GraphQLQuery + @GraphQLInputField + private String trigram; + @GraphQLQuery + @GraphQLInputField private String description; /* The following are all Lazy Loaded */ // annotated below @@ -73,6 +83,13 @@ public String toString() { // annotated below List approvalSteps; /* Approval process for this Task */ + @Override + @AllowUnverifiedUsers + public String getUuid() { + return super.getUuid(); + } + + @AllowUnverifiedUsers public String getName() { return name; } @@ -107,6 +124,7 @@ public void setLng(Double lng) { this.lng = lng; } + @AllowUnverifiedUsers public LocationType getType() { return type; } @@ -115,6 +133,24 @@ public void setType(LocationType type) { this.type = type; } + @AllowUnverifiedUsers + public String getDigram() { + return digram; + } + + public void setDigram(String digram) { + this.digram = digram; + } + + @AllowUnverifiedUsers + public String getTrigram() { + return trigram; + } + + public void setTrigram(String trigram) { + this.trigram = trigram; + } + public String getDescription() { return description; } @@ -175,14 +211,15 @@ public boolean equals(Object o) { return super.equals(o) && Objects.equals(other.getUuid(), uuid) && Objects.equals(other.getName(), name) && Objects.equals(other.getStatus(), status) && Objects.equals(other.getLat(), lat) && Objects.equals(other.getLng(), lng) - && Objects.equals(other.getType(), type) && Objects.equals(other.getCreatedAt(), createdAt) + && Objects.equals(other.getType(), type) && Objects.equals(other.digram, digram) + && Objects.equals(other.trigram, trigram) && Objects.equals(other.getCreatedAt(), createdAt) && Objects.equals(other.getDescription(), description); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), uuid, name, type, status, lat, lng, createdAt, - description); + return Objects.hash(super.hashCode(), uuid, name, type, status, lat, lng, digram, trigram, + createdAt, description); } @Override diff --git a/src/main/java/mil/dds/anet/beans/Person.java b/src/main/java/mil/dds/anet/beans/Person.java index 1ebfd8c575..77b6b300d7 100644 --- a/src/main/java/mil/dds/anet/beans/Person.java +++ b/src/main/java/mil/dds/anet/beans/Person.java @@ -22,9 +22,11 @@ import mil.dds.anet.graphql.AllowUnverifiedUsers; import mil.dds.anet.graphql.RestrictToAuthorizationGroups; import mil.dds.anet.utils.DaoUtils; +import mil.dds.anet.utils.IdDataLoaderKey; import mil.dds.anet.utils.InsertionOrderLinkedList; import mil.dds.anet.utils.Utils; import mil.dds.anet.views.AbstractEmailableAnetBean; +import mil.dds.anet.views.UuidFetcher; public class Person extends AbstractEmailableAnetBean implements Principal, RelatableObject, SubscribableObject, WithStatus, Comparable { @@ -52,7 +54,9 @@ public class Person extends AbstractEmailableAnetBean private String gender; @GraphQLQuery @GraphQLInputField - private String country; + private String obsoleteCountry; + // annotated below + private ForeignObjectHolder country = new ForeignObjectHolder<>(); @GraphQLQuery @GraphQLInputField private Instant endOfTourDate; @@ -151,12 +155,44 @@ public void setGender(String gender) { } @AllowUnverifiedUsers - public String getCountry() { - return country; + public String getObsoleteCountry() { + return obsoleteCountry; + } + + public void setObsoleteCountry(String obsoleteCountry) { + this.obsoleteCountry = obsoleteCountry; + } + + @GraphQLQuery(name = "country") + @AllowUnverifiedUsers + public CompletableFuture loadCountry(@GraphQLRootContext Map context) { + if (country.hasForeignObject()) { + return CompletableFuture.completedFuture(country.getForeignObject()); + } + return new UuidFetcher() + .load(context, IdDataLoaderKey.LOCATIONS, country.getForeignUuid()).thenApply(o -> { + country.setForeignObject(o); + return o; + }); + } + + @JsonIgnore + public void setCountryUuid(String countryUuid) { + this.country = new ForeignObjectHolder<>(countryUuid); + } + + @JsonIgnore + public String getCountryUuid() { + return country.getForeignUuid(); + } + + @GraphQLInputField(name = "country") + public void setCountry(Location country) { + this.country = new ForeignObjectHolder<>(country); } - public void setCountry(String country) { - this.country = Utils.trimStringReturnNull(country); + public Location getCountry() { + return country.getForeignObject(); } @AllowUnverifiedUsers diff --git a/src/main/java/mil/dds/anet/beans/lists/AnetBeanList.java b/src/main/java/mil/dds/anet/beans/lists/AnetBeanList.java index 2b082e0a11..8f049adaad 100644 --- a/src/main/java/mil/dds/anet/beans/lists/AnetBeanList.java +++ b/src/main/java/mil/dds/anet/beans/lists/AnetBeanList.java @@ -3,6 +3,7 @@ import io.leangen.graphql.annotations.GraphQLInputField; import io.leangen.graphql.annotations.GraphQLQuery; import java.util.List; +import mil.dds.anet.graphql.AllowUnverifiedUsers; import org.jdbi.v3.core.mapper.RowMapper; import org.jdbi.v3.core.statement.Query; @@ -53,6 +54,7 @@ public AnetBeanList(Query query, int pageNum, int pageSize, RowMapper mapper) } } + @AllowUnverifiedUsers public List getList() { return list; } @@ -61,6 +63,7 @@ public void setList(List list) { this.list = list; } + @AllowUnverifiedUsers public Integer getPageNum() { return pageNum; } @@ -69,6 +72,7 @@ public void setPageNum(Integer pageNum) { this.pageNum = pageNum; } + @AllowUnverifiedUsers public Integer getPageSize() { return pageSize; } @@ -77,6 +81,7 @@ public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } + @AllowUnverifiedUsers public Integer getTotalCount() { return totalCount; } diff --git a/src/main/java/mil/dds/anet/beans/search/PersonSearchQuery.java b/src/main/java/mil/dds/anet/beans/search/PersonSearchQuery.java index 16bfb8cfc7..94eac5b4c8 100644 --- a/src/main/java/mil/dds/anet/beans/search/PersonSearchQuery.java +++ b/src/main/java/mil/dds/anet/beans/search/PersonSearchQuery.java @@ -19,7 +19,7 @@ public class PersonSearchQuery extends SubscribableObjectSearchQuery> { +public class AttachmentDao extends AnetBaseDao { public static final String[] fields = {"uuid", "authorUuid", "fileName", "mimeType", "description", "classification", "caption", "createdAt", "updatedAt"}; @@ -54,10 +53,6 @@ public Attachment getByUuid(String uuid) { return getByIds(Arrays.asList(uuid)).get(0); } - public AnetBeanList search(final AttachmentSearchQuery query) { - return AnetObjectEngine.getInstance().getSearcher().getAttachmentSearcher().runSearch(query); - } - static class SelfIdBatcher extends IdBatcher { private static final String sql = "/* batch.getAttachmentByUuids */ SELECT " + ATTACHMENT_FIELDS + " FROM \"attachments\" WHERE uuid IN ( )"; @@ -74,6 +69,11 @@ public List getByIds(List uuids) { return idBatcher.getByIds(uuids); } + @Override + public AnetBeanList search(final AttachmentSearchQuery query) { + return AnetObjectEngine.getInstance().getSearcher().getAttachmentSearcher().runSearch(query); + } + @Override public Attachment insertInternal(Attachment obj) { getDbHandle().createUpdate("/* insertAttachment */ " diff --git a/src/main/java/mil/dds/anet/database/LocationDao.java b/src/main/java/mil/dds/anet/database/LocationDao.java index 887e17ebb3..131919c059 100644 --- a/src/main/java/mil/dds/anet/database/LocationDao.java +++ b/src/main/java/mil/dds/anet/database/LocationDao.java @@ -12,8 +12,8 @@ public class LocationDao extends AnetSubscribableObjectDao { - private static final String[] fields = {"uuid", "name", "status", "lat", "lng", "type", - "description", "createdAt", "updatedAt", "customFields"}; + private static final String[] fields = {"uuid", "name", "status", "lat", "lng", "type", "digram", + "trigram", "description", "createdAt", "updatedAt", "customFields"}; public static final String TABLE_NAME = "locations"; public static final String LOCATION_FIELDS = DaoUtils.buildFieldAliases(TABLE_NAME, fields, true); @@ -42,9 +42,9 @@ public List getByIds(List uuids) { @Override public Location insertInternal(Location l) { getDbHandle().createUpdate( - "/* locationInsert */ INSERT INTO locations (uuid, name, type, description, status, lat, lng, " + "/* locationInsert */ INSERT INTO locations (uuid, name, type, description, status, lat, lng, digram, trigram, " + "\"createdAt\", \"updatedAt\", \"customFields\") VALUES (:uuid, :name, :type, :description, :status, " - + ":lat, :lng, :createdAt, :updatedAt, :customFields)") + + ":lat, :lng, :digram, :trigram, :createdAt, :updatedAt, :customFields)") .bindBean(l).bind("createdAt", DaoUtils.asLocalDateTime(l.getCreatedAt())) .bind("updatedAt", DaoUtils.asLocalDateTime(l.getUpdatedAt())) .bind("status", DaoUtils.getEnumId(l.getStatus())) @@ -56,6 +56,7 @@ public Location insertInternal(Location l) { public int updateInternal(Location l) { return getDbHandle().createUpdate("/* updateLocation */ UPDATE locations " + "SET name = :name, type = :type, description = :description, status = :status, lat = :lat, lng = :lng, " + + "digram = :digram, trigram = :trigram, " + "\"updatedAt\" = :updatedAt, \"customFields\" = :customFields WHERE uuid = :uuid") .bindBean(l).bind("updatedAt", DaoUtils.asLocalDateTime(l.getUpdatedAt())) .bind("status", DaoUtils.getEnumId(l.getStatus())) @@ -81,6 +82,9 @@ public int mergeLocations(Location loserLocation, Location winnerLocation) { // Update reports updateForMerge("reports", "locationUuid", winnerLocationUuid, loserLocationUuid); + // Update people + updateForMerge("people", "countryUuid", winnerLocationUuid, loserLocationUuid); + // Update positions updateForMerge("positions", "locationUuid", winnerLocationUuid, loserLocationUuid); diff --git a/src/main/java/mil/dds/anet/database/PersonDao.java b/src/main/java/mil/dds/anet/database/PersonDao.java index 4310eceff1..d41d7134de 100644 --- a/src/main/java/mil/dds/anet/database/PersonDao.java +++ b/src/main/java/mil/dds/anet/database/PersonDao.java @@ -51,8 +51,8 @@ public class PersonDao extends AnetSubscribableObjectDao> getPersonPositionHistory(List f public Person insertInternal(Person p) { final String sql = "/* personInsert */ INSERT INTO people " + "(uuid, name, status, \"user\", \"phoneNumber\", rank, " - + "\"pendingVerification\", gender, country, code, \"endOfTourDate\", biography, " + + "\"pendingVerification\", gender, \"countryUuid\", code, \"endOfTourDate\", biography, " + "\"domainUsername\", \"openIdSubject\", \"createdAt\", \"updatedAt\", \"customFields\") " + "VALUES (:uuid, :name, :status, :user, :phoneNumber, :rank, " - + ":pendingVerification, :gender, :country, :code, :endOfTourDate, :biography, " + + ":pendingVerification, :gender, :countryUuid, :code, :endOfTourDate, :biography, " + ":domainUsername, :openIdSubject, :createdAt, :updatedAt, :customFields)"; getDbHandle().createUpdate(sql).bindBean(p) .bind("createdAt", DaoUtils.asLocalDateTime(p.getCreatedAt())) @@ -160,7 +160,8 @@ public int updateAuthenticationDetails(Person p) { @Override public int updateInternal(Person p) { final String sql = "/* personUpdate */ UPDATE people " - + "SET name = :name, status = :status, \"user\" = :user, gender = :gender, country = :country, " + + "SET name = :name, status = :status, \"user\" = :user, gender = :gender, " + + "\"obsoleteCountry\" = :obsoleteCountry, \"countryUuid\" = :countryUuid, " + "code = :code, \"phoneNumber\" = :phoneNumber, rank = :rank, biography = :biography, " + "\"pendingVerification\" = :pendingVerification, \"domainUsername\" = :domainUsername, " + "\"updatedAt\" = :updatedAt, \"customFields\" = :customFields, \"endOfTourDate\" = :endOfTourDate " diff --git a/src/main/java/mil/dds/anet/database/mappers/LocationMapper.java b/src/main/java/mil/dds/anet/database/mappers/LocationMapper.java index 768eae5d94..fc7ef35ddf 100644 --- a/src/main/java/mil/dds/anet/database/mappers/LocationMapper.java +++ b/src/main/java/mil/dds/anet/database/mappers/LocationMapper.java @@ -19,6 +19,8 @@ public Location map(ResultSet rs, StatementContext ctx) throws SQLException { l.setLat(MapperUtils.getOptionalDouble(rs, "locations_lat")); l.setLng(MapperUtils.getOptionalDouble(rs, "locations_lng")); l.setType(LocationType.valueOfCode(rs.getString("locations_type"))); + l.setDigram(rs.getString("locations_digram")); + l.setTrigram(rs.getString("locations_trigram")); l.setDescription(MapperUtils.getOptionalString(rs, "locations_description")); if (MapperUtils.containsColumnNamed(rs, "totalCount")) { diff --git a/src/main/java/mil/dds/anet/database/mappers/PersonMapper.java b/src/main/java/mil/dds/anet/database/mappers/PersonMapper.java index 814f7434a4..a3b7537fde 100644 --- a/src/main/java/mil/dds/anet/database/mappers/PersonMapper.java +++ b/src/main/java/mil/dds/anet/database/mappers/PersonMapper.java @@ -34,7 +34,8 @@ public static T fillInFields(T a, ResultSet rs) throws SQLExc a.setUser(MapperUtils.getOptionalBoolean(rs, "people_user")); a.setAvatarUuid(MapperUtils.getOptionalString(rs, "people_avatarUuid")); a.setPhoneNumber(MapperUtils.getOptionalString(rs, "people_phoneNumber")); - a.setCountry(MapperUtils.getOptionalString(rs, "people_country")); + a.setObsoleteCountry(MapperUtils.getOptionalString(rs, "people_obsoleteCountry")); + a.setCountryUuid(MapperUtils.getOptionalString(rs, "people_countryUuid")); a.setGender(MapperUtils.getOptionalString(rs, "people_gender")); a.setCode(MapperUtils.getOptionalString(rs, "people_code")); a.setEndOfTourDate(MapperUtils.getInstantAsLocalDateTime(rs, "people_endOfTourDate")); diff --git a/src/main/java/mil/dds/anet/resources/LocationResource.java b/src/main/java/mil/dds/anet/resources/LocationResource.java index e76b49f951..9a4331576d 100644 --- a/src/main/java/mil/dds/anet/resources/LocationResource.java +++ b/src/main/java/mil/dds/anet/resources/LocationResource.java @@ -16,6 +16,7 @@ import mil.dds.anet.beans.search.LocationSearchQuery; import mil.dds.anet.config.AnetConfiguration; import mil.dds.anet.database.LocationDao; +import mil.dds.anet.graphql.AllowUnverifiedUsers; import mil.dds.anet.utils.AnetAuditLogger; import mil.dds.anet.utils.AuthUtils; import mil.dds.anet.utils.DaoUtils; @@ -53,9 +54,15 @@ public Location getByUuid(@GraphQLArgument(name = "uuid") String uuid) { } @GraphQLQuery(name = "locationList") + @AllowUnverifiedUsers public AnetBeanList search(@GraphQLRootContext Map context, @GraphQLArgument(name = "query") LocationSearchQuery query) { - query.setUser(DaoUtils.getUserFromContext(context)); + final Person user = DaoUtils.getUserFromContext(context); + if (Boolean.TRUE.equals(user.getPendingVerification())) { + // Unverified users can only search for countries + query.setType(Location.LocationType.COUNTRY); + } + query.setUser(user); return dao.search(query); } diff --git a/src/main/java/mil/dds/anet/search/AbstractPersonSearcher.java b/src/main/java/mil/dds/anet/search/AbstractPersonSearcher.java index cd74392a86..bccf66027e 100644 --- a/src/main/java/mil/dds/anet/search/AbstractPersonSearcher.java +++ b/src/main/java/mil/dds/anet/search/AbstractPersonSearcher.java @@ -1,6 +1,5 @@ package mil.dds.anet.search; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; import java.util.Map; import java.util.Set; @@ -22,7 +21,7 @@ public abstract class AbstractPersonSearcher extends AbstractSearcher ALL_FIELDS = Sets.newHashSet(PersonDao.allFields); private static final Set MINIMAL_FIELDS = Sets.newHashSet(PersonDao.minimalFields); - private static final Map FIELD_MAPPING = ImmutableMap.of(); + private static final Map FIELD_MAPPING = Map.of("country", "countryUuid"); public AbstractPersonSearcher(AbstractSearchQueryBuilder qb) { super(qb); @@ -68,7 +67,7 @@ protected void buildQuery(Set subFields, PersonSearchQuery query) { query.getEndOfTourDateEnd()); qb.addEnumEqualsClause("status", "people.status", query.getStatus()); qb.addStringEqualsClause("rank", "people.rank", query.getRank()); - qb.addStringEqualsClause("country", "people.country", query.getCountry()); + qb.addStringEqualsClause("countryUuid", "people.\"countryUuid\"", query.getCountryUuid()); qb.addObjectEqualsClause("pendingVerification", "people.\"pendingVerification\"", query.getPendingVerification()); diff --git a/src/main/java/mil/dds/anet/utils/AnetDbLogger.java b/src/main/java/mil/dds/anet/utils/AnetDbLogger.java index 4af4b9d40f..6c9e67ba52 100644 --- a/src/main/java/mil/dds/anet/utils/AnetDbLogger.java +++ b/src/main/java/mil/dds/anet/utils/AnetDbLogger.java @@ -2,19 +2,26 @@ import java.lang.invoke.MethodHandles; import java.time.temporal.ChronoUnit; +import mil.dds.anet.database.AttachmentDao; +import mil.dds.anet.database.AuthorizationGroupDao; import mil.dds.anet.database.CommentDao; +import mil.dds.anet.database.EmailAddressDao; +import mil.dds.anet.database.LocationDao; import mil.dds.anet.database.OrganizationDao; import mil.dds.anet.database.PersonDao; import mil.dds.anet.database.PositionDao; import mil.dds.anet.database.ReportDao; import mil.dds.anet.database.ReportSensitiveInformationDao; +import mil.dds.anet.database.SubscriptionDao; +import mil.dds.anet.database.SubscriptionUpdateDao; +import mil.dds.anet.database.TaskDao; import org.jdbi.v3.core.statement.SqlLogger; import org.jdbi.v3.core.statement.StatementContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Logger that specifically looks for the very long column definitions that ANET2 uses and will + * Logger that specifically looks for the very long column definitions that ANET uses and will * replace them in the log with a shortened version. This just makes the logs easier to read and * debug. */ @@ -26,16 +33,26 @@ public class AnetDbLogger implements SqlLogger { public void logAfterExecution(StatementContext context) { final String renderedSql = context.getRenderedSql(); if (logger.isDebugEnabled() && !renderedSql.startsWith("INSERT INTO \"userActivities\"")) { - final String msg = renderedSql.replace(PersonDao.PERSON_FIELDS, " ") - .replace(PositionDao.POSITION_FIELDS, " ") - .replace(OrganizationDao.ORGANIZATION_FIELDS, " ") - .replace(ReportDao.REPORT_FIELDS, " ") - .replace(ReportSensitiveInformationDao.REPORT_SENSITIVE_INFORMATION_FIELDS, - " ") - .replace(CommentDao.COMMENT_FIELDS, " ") - .replaceAll("LEFT JOIN (CONTAINS|FREETEXT)TABLE[^=]*= (\\S+)\\.\\[Key\\]", "<$1_$2>") - .replaceFirst("LEFT JOIN (mv_fts_\\S+) ON \\S+\\s*=\\s*\\S+", "<$1>") - .replaceFirst("\\(?(EXP|ISNULL|CASE|ts_rank).* AS (search_rank)", "<$2>"); + final String msg = + renderedSql.replace(AttachmentDao.ATTACHMENT_FIELDS, " ") + .replace(AuthorizationGroupDao.AUTHORIZATION_GROUP_FIELDS, + " ") + .replace(CommentDao.COMMENT_FIELDS, " ") + .replace(EmailAddressDao.EMAIL_ADDRESS_FIELDS, " ") + .replace(LocationDao.LOCATION_FIELDS, " ") + .replace(OrganizationDao.ORGANIZATION_FIELDS, " ") + .replace(PersonDao.PERSON_FIELDS, " ") + .replace(PositionDao.POSITION_FIELDS, " ") + .replace(ReportDao.REPORT_FIELDS, " ") + .replace(ReportSensitiveInformationDao.REPORT_SENSITIVE_INFORMATION_FIELDS, + " ") + .replace(SubscriptionDao.SUBSCRIPTION_FIELDS, " ") + .replace(SubscriptionUpdateDao.SUBSCRIPTION_UPDATE_FIELDS, + " ") + .replace(TaskDao.TASK_FIELDS, " ") + .replaceAll("LEFT JOIN (CONTAINS|FREETEXT)TABLE[^=]*= (\\S+)\\.\\[Key\\]", "<$1_$2>") + .replaceFirst("LEFT JOIN (mv_fts_\\S+) ON \\S+\\s*=\\s*\\S+", "<$1>") + .replaceFirst("\\(?(EXP|ISNULL|CASE|ts_rank).* AS (search_rank)", "<$2>"); logger.debug("{}\t{}", context.getElapsedTime(ChronoUnit.MILLIS), msg); } } diff --git a/src/main/resources/anet-schema.yml b/src/main/resources/anet-schema.yml index ab03356b45..b90dad34df 100644 --- a/src/main/resources/anet-schema.yml +++ b/src/main/resources/anet-schema.yml @@ -728,7 +728,7 @@ properties: items: type: string enum: - [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION, ADVISOR_LOCATION, PRINCIPAL_LOCATION] + [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION] reportPeople: required: [optionalAttendingAuthor, optionalPrimaryAdvisor, optionalPrimaryPrincipal] properties: @@ -827,7 +827,7 @@ properties: location: type: object additionalProperties: false - required: [status, name, type, description, superuserTypeOptions, format] + required: [status, name, type, digram, trigram, description, superuserTypeOptions, format] properties: status: "$ref": "#/$defs/labeledField" @@ -835,6 +835,10 @@ properties: "$ref": "#/$defs/inputField" type: "$ref": "#/$defs/inputField" + digram: + "$ref": "#/$defs/inputField" + trigram: + "$ref": "#/$defs/inputField" description: "$ref": "#/$defs/inputField" superuserTypeOptions: @@ -843,14 +847,14 @@ properties: items: type: string enum: - [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION, ADVISOR_LOCATION, PRINCIPAL_LOCATION] + [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, COUNTRY, POINT_LOCATION] regularuserTypeOptions: type: array uniqueItems: true items: type: string enum: - [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION, ADVISOR_LOCATION, PRINCIPAL_LOCATION] + [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, COUNTRY, POINT_LOCATION] format: type: string title: Default format for location @@ -1033,20 +1037,12 @@ properties: person: type: object additionalProperties: false - required: [name, countries, numberOfFieldsInLeftColumn, showPageOrderedFields] + required: [name, numberOfFieldsInLeftColumn, showPageOrderedFields] properties: name: type: string title: The name of this field description: Used in the UI where a person inside an organization is shown. - countries: - type: array - uniqueItems: true - minItems: 1 - items: - type: string - title: The list of possible countries - description: Used in the UI where a country can be selected for a person inside an organization. showPageOrderedFields: type: array uniqueItems: true @@ -1094,7 +1090,7 @@ properties: items: type: string enum: - [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION, ADVISOR_LOCATION, PRINCIPAL_LOCATION] + [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION] organizationsAdministrated: "$ref": "#/$defs/inputField" @@ -1122,7 +1118,7 @@ properties: items: type: string enum: - [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION, ADVISOR_LOCATION, PRINCIPAL_LOCATION] + [VIRTUAL_LOCATION, PHYSICAL_LOCATION, GEOGRAPHICAL_AREA, POINT_LOCATION] administratingPositions: "$ref": "#/$defs/inputField" diff --git a/src/main/resources/migrations.xml b/src/main/resources/migrations.xml index f618c29c5f..a663386a15 100644 --- a/src/main/resources/migrations.xml +++ b/src/main/resources/migrations.xml @@ -5215,4 +5215,469 @@ + + + + + + + + + + INSERT INTO locations (uuid, type, status, name, digram, trigram) VALUES + (${uuid_function}, 'PAC', 0, 'Afghanistan', 'AF', 'AFG'), + (${uuid_function}, 'PAC', 0, 'Albania', 'AL', 'ALB'), + (${uuid_function}, 'PAC', 0, 'Algeria', 'AG', 'DZA'), + (${uuid_function}, 'PAC', 0, 'American Samoa', 'SS', 'ASM'), + (${uuid_function}, 'PAC', 0, 'Andorra', 'AN', 'AND'), + (${uuid_function}, 'PAC', 0, 'Angola', 'AO', 'AGO'), + (${uuid_function}, 'PAC', 0, 'Anguilla', 'AV', 'AIA'), + (${uuid_function}, 'PAC', 0, 'Antarctica', 'AY', 'ATA'), + (${uuid_function}, 'PAC', 0, 'Antigua and Barbuda', 'AC', 'ATG'), + (${uuid_function}, 'PAC', 0, 'Argentina', 'AR', 'ARG'), + (${uuid_function}, 'PAC', 0, 'Armenia', 'AM', 'ARM'), + (${uuid_function}, 'PAC', 0, 'Aruba', 'AA', 'ABW'), + (${uuid_function}, 'PAC', 0, 'Ashmore and Cartier Islands', 'AT', 'ACI'), + (${uuid_function}, 'PAC', 0, 'Australia', 'AS', 'AUS'), + (${uuid_function}, 'PAC', 0, 'Austria', 'AU', 'AUT'), + (${uuid_function}, 'PAC', 0, 'Azerbaijan', 'AJ', 'AZE'), + (${uuid_function}, 'PAC', 0, 'Bahrain', 'BA', 'BHR'), + (${uuid_function}, 'PAC', 0, 'Bangladesh', 'BD', 'BGD'), + (${uuid_function}, 'PAC', 0, 'Barbados', 'BB', 'BRB'), + (${uuid_function}, 'PAC', 0, 'Belarus', 'BO', 'BLR'), + (${uuid_function}, 'PAC', 0, 'Belgium', 'BE', 'BEL'), + (${uuid_function}, 'PAC', 0, 'Belize', 'BH', 'BLZ'), + (${uuid_function}, 'PAC', 0, 'Benin', 'BN', 'BEN'), + (${uuid_function}, 'PAC', 0, 'Bermuda', 'BM', 'BMU'), + (${uuid_function}, 'PAC', 0, 'Bhutan', 'BT', 'BTN'), + (${uuid_function}, 'PAC', 0, 'Bolivia', 'BL', 'BOL'), + (${uuid_function}, 'PAC', 0, 'Bosnia-Herzegovina', 'BK', 'BIH'), + (${uuid_function}, 'PAC', 0, 'Botswana', 'BC', 'BWA'), + (${uuid_function}, 'PAC', 0, 'Bouvet Island', 'BV', 'BVT'), + (${uuid_function}, 'PAC', 0, 'Brazil', 'BR', 'BRA'), + (${uuid_function}, 'PAC', 0, 'British Indian Ocean Territory', 'IO', 'IOT'), + (${uuid_function}, 'PAC', 0, 'British Virgin Islands', 'VS', 'VGB'), + (${uuid_function}, 'PAC', 0, 'Brunei', 'BX', 'BRN'), + (${uuid_function}, 'PAC', 0, 'Bulgaria', 'BG', 'BGR'), + (${uuid_function}, 'PAC', 0, 'Burkina Faso', 'UV', 'BFA'), + (${uuid_function}, 'PAC', 0, 'Burundi', 'BY', 'BDI'), + (${uuid_function}, 'PAC', 0, 'Cambodia', 'CB', 'KHM'), + (${uuid_function}, 'PAC', 0, 'Cameroon', 'CM', 'CMR'), + (${uuid_function}, 'PAC', 0, 'Canada', 'CA', 'CAN'), + (${uuid_function}, 'PAC', 0, 'Cape Verde', 'CV', 'CPV'), + (${uuid_function}, 'PAC', 0, 'Cayman Islands', 'CJ', 'CYM'), + (${uuid_function}, 'PAC', 0, 'Central African Republic', 'CT', 'CAF'), + (${uuid_function}, 'PAC', 0, 'Chad', 'CD', 'TCD'), + (${uuid_function}, 'PAC', 0, 'Chile', 'CI', 'CHL'), + (${uuid_function}, 'PAC', 0, 'Christmas Island', 'KT', 'CXR'), + (${uuid_function}, 'PAC', 0, 'Cocos (Keeling) Islands', 'CK', 'CCK'), + (${uuid_function}, 'PAC', 0, 'Colombia', 'CO', 'COL'), + (${uuid_function}, 'PAC', 0, 'Comoros', 'CN', 'COM'), + (${uuid_function}, 'PAC', 0, 'Cook Islands', 'CW', 'COK'), + (${uuid_function}, 'PAC', 0, 'Coral Sea Islands', 'CR', 'CSI'), + (${uuid_function}, 'PAC', 0, 'Costa Rica', 'CS', 'CRI'), + (${uuid_function}, 'PAC', 0, 'Côte d''Ivoire', 'IV', 'CIV'), + (${uuid_function}, 'PAC', 0, 'Croatia', 'HR', 'HRV'), + (${uuid_function}, 'PAC', 0, 'Cuba', 'CU', 'CUB'), + (${uuid_function}, 'PAC', 0, 'Cyprus', 'CY', 'CYP'), + (${uuid_function}, 'PAC', 0, 'Czech Republic', 'CZ', 'CZE'), + (${uuid_function}, 'PAC', 0, 'Democratic People''s Republic of Korea', 'KN', 'PRK'), + (${uuid_function}, 'PAC', 0, 'Democratic Republic of the Congo', 'CD', 'COD'), + (${uuid_function}, 'PAC', 0, 'Denmark', 'DA', 'DNK'), + (${uuid_function}, 'PAC', 0, 'Djibouti', 'DJ', 'DJI'), + (${uuid_function}, 'PAC', 0, 'Dominica', 'DO', 'DMA'), + (${uuid_function}, 'PAC', 0, 'Dominican Republic', 'DR', 'DOM'), + (${uuid_function}, 'PAC', 1, 'East Germany', 'GC', 'n/a'), + (${uuid_function}, 'PAC', 0, 'Ecuador', 'EC', 'ECU'), + (${uuid_function}, 'PAC', 0, 'Egypt', 'EG', 'EGY'), + (${uuid_function}, 'PAC', 0, 'El Salvador', 'SV', 'SLV'), + (${uuid_function}, 'PAC', 0, 'Equatorial Guinea', 'EK', 'GNQ'), + (${uuid_function}, 'PAC', 0, 'Eritrea', 'ER', 'ERI'), + (${uuid_function}, 'PAC', 0, 'Estonia', 'EN', 'EST'), + (${uuid_function}, 'PAC', 0, 'Ethiopia', 'ET', 'ETH'), + (${uuid_function}, 'PAC', 0, 'Falkland Islands', 'FK', 'FLK'), + (${uuid_function}, 'PAC', 0, 'Faroe Islands', 'FO', 'FRO'), + (${uuid_function}, 'PAC', 0, 'Federated States of Micronesia', 'FM', 'FSM'), + (${uuid_function}, 'PAC', 0, 'Fiji', 'FJ', 'FJI'), + (${uuid_function}, 'PAC', 0, 'Finland', 'FI', 'FIN'), + (${uuid_function}, 'PAC', 0, 'France', 'FR', 'FRA'), + (${uuid_function}, 'PAC', 0, 'French Guiana', 'FG', 'GUF'), + (${uuid_function}, 'PAC', 0, 'French Polynesia', 'FP', 'PYF'), + (${uuid_function}, 'PAC', 0, 'French Southern Territories', 'FS', 'ATF'), + (${uuid_function}, 'PAC', 0, 'Gabon', 'GA', 'GAB'), + (${uuid_function}, 'PAC', 0, 'Georgia', 'GG', 'GEO'), + (${uuid_function}, 'PAC', 0, 'Germany', 'DE', 'DEU'), + (${uuid_function}, 'PAC', 0, 'Ghana', 'GH', 'GHA'), + (${uuid_function}, 'PAC', 0, 'Gibraltar', 'GI', 'GIB'), + (${uuid_function}, 'PAC', 0, 'Greece', 'GR', 'GRC'), + (${uuid_function}, 'PAC', 0, 'Greenland', 'GL', 'GRL'), + (${uuid_function}, 'PAC', 0, 'Grenada', 'GJ', 'GRD'), + (${uuid_function}, 'PAC', 0, 'Guadeloupe', 'GP', 'GLP'), + (${uuid_function}, 'PAC', 0, 'Guam', 'GQ', 'GUM'), + (${uuid_function}, 'PAC', 0, 'Guatemala', 'GT', 'GTM'), + (${uuid_function}, 'PAC', 0, 'Guinea-Bissau', 'PU', 'GNB'), + (${uuid_function}, 'PAC', 0, 'Guinea', 'GV', 'GIN'), + (${uuid_function}, 'PAC', 0, 'Guyana', 'GY', 'GUY'), + (${uuid_function}, 'PAC', 0, 'Haiti', 'HA', 'HTI'), + (${uuid_function}, 'PAC', 0, 'Heard and McDonald Islands', 'HM', 'HMD'), + (${uuid_function}, 'PAC', 0, 'Honduras', 'HO', 'HND'), + (${uuid_function}, 'PAC', 0, 'Hong Kong', 'HK', 'HKG'), + (${uuid_function}, 'PAC', 0, 'Howland Island', 'HQ', 'HQI'), + (${uuid_function}, 'PAC', 0, 'Hungary', 'HU', 'HUN'), + (${uuid_function}, 'PAC', 0, 'Iceland', 'IC', 'ISL'), + (${uuid_function}, 'PAC', 0, 'India', 'IN', 'IND'), + (${uuid_function}, 'PAC', 0, 'Indonesia', 'ID', 'IDN'), + (${uuid_function}, 'PAC', 0, 'Iran', 'IR', 'IRN'), + (${uuid_function}, 'PAC', 0, 'Iraq', 'IZ', 'IRQ'), + (${uuid_function}, 'PAC', 0, 'Ireland', 'EI', 'IRL'), + (${uuid_function}, 'PAC', 0, 'Israel', 'IS', 'ISR'), + (${uuid_function}, 'PAC', 0, 'Italy', 'IT', 'ITA'), + (${uuid_function}, 'PAC', 0, 'Jamaica', 'JM', 'JAM'), + (${uuid_function}, 'PAC', 0, 'Jan Mayen Island', 'JN', 'JNM'), + (${uuid_function}, 'PAC', 0, 'Japan', 'JA', 'JPN'), + (${uuid_function}, 'PAC', 0, 'Johnston Atoll', 'JQ', 'JQA'), + (${uuid_function}, 'PAC', 0, 'Jordan', 'JO', 'JOR'), + (${uuid_function}, 'PAC', 0, 'Kazakhstan', 'KZ', 'KAZ'), + (${uuid_function}, 'PAC', 0, 'Kenya', 'KE', 'KEN'), + (${uuid_function}, 'PAC', 0, 'Kiribati', 'KR', 'KIR'), + (${uuid_function}, 'PAC', 0, 'Kosovo Albanian', NULL, 'KOA'), + (${uuid_function}, 'PAC', 0, 'Kosovo Bosniak', NULL, 'KOB'), + (${uuid_function}, 'PAC', 0, 'Kosovo Gorani', NULL, 'KOG'), + (${uuid_function}, 'PAC', 0, 'Kosovo Serbian', NULL, 'KOS'), + (${uuid_function}, 'PAC', 0, 'Kosovo Turks', NULL, 'KOT'), + (${uuid_function}, 'PAC', 0, 'Kuwait', 'KU', 'KWT'), + (${uuid_function}, 'PAC', 0, 'Kyrgyzstan', 'KG', 'KGZ'), + (${uuid_function}, 'PAC', 0, 'Laos', 'LA', 'LAO'), + (${uuid_function}, 'PAC', 0, 'Latvia', 'LG', 'LVA'), + (${uuid_function}, 'PAC', 0, 'Lebanon', 'LE', 'LBN'), + (${uuid_function}, 'PAC', 0, 'Lesotho', 'LT', 'LSO'), + (${uuid_function}, 'PAC', 0, 'Liberia', 'LI', 'LBR'), + (${uuid_function}, 'PAC', 0, 'Libya', 'LY', 'LBY'), + (${uuid_function}, 'PAC', 0, 'Liechtenstein', 'LS', 'LIE'), + (${uuid_function}, 'PAC', 0, 'Lithuania', 'LH', 'LTU'), + (${uuid_function}, 'PAC', 0, 'Luxembourg', 'LU', 'LUX'), + (${uuid_function}, 'PAC', 0, 'Macau', 'MC', 'MAC'), + (${uuid_function}, 'PAC', 0, 'Madagascar', 'MA', 'MDG'), + (${uuid_function}, 'PAC', 0, 'Malawi', 'MI', 'MWI'), + (${uuid_function}, 'PAC', 0, 'Malaysia', 'MY', 'MYS'), + (${uuid_function}, 'PAC', 0, 'Mali', 'ML', 'MLI'), + (${uuid_function}, 'PAC', 0, 'Malta', 'MT', 'MLT'), + (${uuid_function}, 'PAC', 0, 'Marshall Islands', 'RM', 'MHL'), + (${uuid_function}, 'PAC', 0, 'Martinique', 'MB', 'MTQ'), + (${uuid_function}, 'PAC', 0, 'Mauritania', 'MR', 'MRT'), + (${uuid_function}, 'PAC', 0, 'Mauritius', 'MP', 'MUS'), + (${uuid_function}, 'PAC', 0, 'Mayotte', 'YT', NULL), + (${uuid_function}, 'PAC', 0, 'Mexico', 'MX', 'MEX'), + (${uuid_function}, 'PAC', 0, 'Monaco', 'MN', 'MCO'), + (${uuid_function}, 'PAC', 0, 'Mongolia', 'MG', 'MNG'), + (${uuid_function}, 'PAC', 0, 'Montenegro', 'ME', 'MNE'), + (${uuid_function}, 'PAC', 0, 'Montserrat', 'MH', 'MSR'), + (${uuid_function}, 'PAC', 0, 'Morocco', 'MO', 'MAR'), + (${uuid_function}, 'PAC', 0, 'Mozambique', 'MZ', 'MOZ'), + (${uuid_function}, 'PAC', 0, 'Myanmar', 'MM', 'MMR'), + (${uuid_function}, 'PAC', 0, 'Namibia', 'WA', 'NAM'), + (${uuid_function}, 'PAC', 0, 'Nauru', 'NR', 'NRU'), + (${uuid_function}, 'PAC', 0, 'Nepal', 'NP', 'NPL'), + (${uuid_function}, 'PAC', 1, 'Netherlands Antilles', 'NA', 'ANT'), + (${uuid_function}, 'PAC', 0, 'Netherlands', 'NL', 'NLD'), + (${uuid_function}, 'PAC', 0, 'New Caledonia', 'NC', 'NCL'), + (${uuid_function}, 'PAC', 0, 'New Zealand', 'NZ', 'NZL'), + (${uuid_function}, 'PAC', 0, 'Nicaragua', 'NU', 'NIC'), + (${uuid_function}, 'PAC', 0, 'Nigeria', 'NG', 'NGA'), + (${uuid_function}, 'PAC', 0, 'Niger', 'NE', 'NER'), + (${uuid_function}, 'PAC', 0, 'Niue', 'NU', 'NIU'), + (${uuid_function}, 'PAC', 0, 'Norfolk Island', 'NF', 'NFK'), + (${uuid_function}, 'PAC', 0, 'Northern Mariana Islands', 'CQ', 'MNP'), + (${uuid_function}, 'PAC', 0, 'North Macedonia', 'MK', 'MKD'), + (${uuid_function}, 'PAC', 0, 'Norway', 'NO', 'NOR'), + (${uuid_function}, 'PAC', 0, 'Oman', 'MU', 'OMN'), + (${uuid_function}, 'PAC', 0, 'Pakistan', 'PK', 'PAK'), + (${uuid_function}, 'PAC', 0, 'Palau', 'PS', 'PLW'), + (${uuid_function}, 'PAC', 0, 'Palestinian Territory', 'PS', 'PSE'), + (${uuid_function}, 'PAC', 0, 'Panama', 'PM', 'PAN'), + (${uuid_function}, 'PAC', 0, 'Papua New Guinea', 'PP', 'PNG'), + (${uuid_function}, 'PAC', 0, 'Paracel Islands', 'PF', 'PFI'), + (${uuid_function}, 'PAC', 0, 'Paraguay', 'PA', 'PRY'), + (${uuid_function}, 'PAC', 0, 'People''s Republic of China', 'CH', 'CHN'), + (${uuid_function}, 'PAC', 0, 'Peru', 'PE', 'PER'), + (${uuid_function}, 'PAC', 0, 'Philippines', 'RP', 'PHL'), + (${uuid_function}, 'PAC', 0, 'Pitcairn Islands', 'PN', 'PCN'), + (${uuid_function}, 'PAC', 0, 'Poland', 'PL', 'POL'), + (${uuid_function}, 'PAC', 0, 'Portugal', 'PT', 'PRT'), + (${uuid_function}, 'PAC', 0, 'Puerto Rico', 'RQ', 'PRI'), + (${uuid_function}, 'PAC', 0, 'Qatar', 'QA', 'QAT'), + (${uuid_function}, 'PAC', 0, 'Republic of China (Taiwan)', 'TW', 'TWN'), + (${uuid_function}, 'PAC', 0, 'Republic of Korea', NULL, 'KOR'), + (${uuid_function}, 'PAC', 0, 'Republic of Korea', 'KS', 'KOR'), + (${uuid_function}, 'PAC', 0, 'Republic of Moldova', 'MD', 'MDA'), + (${uuid_function}, 'PAC', 0, 'Republic of the Congo', 'CF', 'COG'), + (${uuid_function}, 'PAC', 0, 'Réunion', 'RE', 'REU'), + (${uuid_function}, 'PAC', 0, 'Roma Ashkali Egyptian', NULL, 'RAE'), + (${uuid_function}, 'PAC', 0, 'Romania', 'RO', 'ROU'), + (${uuid_function}, 'PAC', 0, 'Russia', 'RU', 'RUS'), + (${uuid_function}, 'PAC', 0, 'Rwanda', 'RW', 'RWA'), + (${uuid_function}, 'PAC', 0, 'Saint Helena', 'SH', 'SHN'), + (${uuid_function}, 'PAC', 0, 'Saint Kitts and Nevis', 'SC', 'KNA'), + (${uuid_function}, 'PAC', 0, 'Saint Lucia', 'ST', 'LCA'), + (${uuid_function}, 'PAC', 0, 'Saint Pierre and Miquelon', 'SB', 'SPM'), + (${uuid_function}, 'PAC', 0, 'Saint Vincent and the Grenadines', 'VC', 'VCT'), + (${uuid_function}, 'PAC', 0, 'Samoa', 'SS', 'WSM'), + (${uuid_function}, 'PAC', 0, 'San Marino', 'SM', 'SMR'), + (${uuid_function}, 'PAC', 0, 'São Tomé and Príncipe', 'TP', 'STP'), + (${uuid_function}, 'PAC', 0, 'Saudi Arabia', 'SA', 'SAU'), + (${uuid_function}, 'PAC', 0, 'Senegal', 'SG', 'SEN'), + (${uuid_function}, 'PAC', 0, 'Serbia and Montenegro', NULL, 'SCG'), + (${uuid_function}, 'PAC', 0, 'Serbia', 'RS', 'SRB'), + (${uuid_function}, 'PAC', 0, 'Seychelles', 'SE', 'SYC'), + (${uuid_function}, 'PAC', 0, 'Sierra Leone', 'SL', 'SLE'), + (${uuid_function}, 'PAC', 0, 'Singapore', 'SN', 'SGP'), + (${uuid_function}, 'PAC', 0, 'Slovakia', 'LO', 'SVK'), + (${uuid_function}, 'PAC', 0, 'Slovenia', 'SI', 'SVN'), + (${uuid_function}, 'PAC', 0, 'Solomon Islands', 'BP', 'SLB'), + (${uuid_function}, 'PAC', 0, 'Somalia', 'SO', 'SOM'), + (${uuid_function}, 'PAC', 0, 'South Africa', 'SF', 'ZAF'), + (${uuid_function}, 'PAC', 0, 'South Georgia and South Sandwich Islands', 'SX', 'SGS'), + (${uuid_function}, 'PAC', 0, 'South Sudan', 'SS', 'SSD'), + (${uuid_function}, 'PAC', 0, 'Spain', 'ES', 'ESP'), + (${uuid_function}, 'PAC', 0, 'Sri Lanka', 'CE', 'LKA'), + (${uuid_function}, 'PAC', 0, 'Sudan', 'SU', 'SDN'), + (${uuid_function}, 'PAC', 0, 'Suriname', 'NS', 'SUR'), + (${uuid_function}, 'PAC', 0, 'Svalbard and Jan Mayen Islands', 'SJ', 'SJM'), + (${uuid_function}, 'PAC', 0, 'Swaziland', 'WZ', 'SWZ'), + (${uuid_function}, 'PAC', 0, 'Sweden', 'SW', 'SWE'), + (${uuid_function}, 'PAC', 0, 'Switzerland', 'SZ', 'CHE'), + (${uuid_function}, 'PAC', 0, 'Syria', 'SY', 'SYR'), + (${uuid_function}, 'PAC', 0, 'Tajikistan', 'TI', 'TJK'), + (${uuid_function}, 'PAC', 0, 'Tanzania', 'TZ', 'TZA'), + (${uuid_function}, 'PAC', 0, 'Thailand', 'TH', 'THA'), + (${uuid_function}, 'PAC', 0, 'The Bahamas', 'BF', 'BHS'), + (${uuid_function}, 'PAC', 0, 'The Gambia', 'GM', 'GMB'), + (${uuid_function}, 'PAC', 0, 'The Maldives', 'MV', 'MDV'), + (${uuid_function}, 'PAC', 0, 'Timor-Leste', 'TL', 'TLS'), + (${uuid_function}, 'PAC', 0, 'Togo', 'TO', 'TGO'), + (${uuid_function}, 'PAC', 0, 'Tokelau', 'TK', 'TKL'), + (${uuid_function}, 'PAC', 0, 'Tonga', 'TN', 'TON'), + (${uuid_function}, 'PAC', 0, 'Trinidad and Tobago', 'TD', 'TTO'), + (${uuid_function}, 'PAC', 0, 'Tunisia', 'TS', 'TUN'), + (${uuid_function}, 'PAC', 0, 'Türkiye', 'TU', 'TUR'), + (${uuid_function}, 'PAC', 0, 'Turkmenistan', 'TX', 'TKM'), + (${uuid_function}, 'PAC', 0, 'Turks and Caicos Islands', 'TK', 'TCA'), + (${uuid_function}, 'PAC', 0, 'Tuvalu', 'TV', 'TUV'), + (${uuid_function}, 'PAC', 0, 'Uganda', 'UG', 'UGA'), + (${uuid_function}, 'PAC', 0, 'Ukraine', 'UA', 'UKR'), + (${uuid_function}, 'PAC', 1, 'Union of Soviet Socialist Republics', 'UR', 'n/a'), + (${uuid_function}, 'PAC', 0, 'United Arab Emirates', 'TC', 'ARE'), + (${uuid_function}, 'PAC', 0, 'United Kingdom (Great Britain and Northern Ireland)', 'GB', 'GBR'), + (${uuid_function}, 'PAC', 0, 'United States', 'US', 'USA'), + (${uuid_function}, 'PAC', 0, 'Uruguay', 'UY', 'URY'), + (${uuid_function}, 'PAC', 0, 'U.S. Minor Outlying Islands', 'IQ', 'UMI'), + (${uuid_function}, 'PAC', 0, 'U.S. Virgin Islands', 'VI', 'VIR'), + (${uuid_function}, 'PAC', 0, 'Uzbekistan', 'UZ', 'UZB'), + (${uuid_function}, 'PAC', 0, 'Vanuatu', 'NH', 'VUT'), + (${uuid_function}, 'PAC', 0, 'Vatican City (Holy See)', 'VT', 'VAT'), + (${uuid_function}, 'PAC', 0, 'Venezuela', 'VE', 'VEN'), + (${uuid_function}, 'PAC', 0, 'Vietnam', 'VN', 'VNM'), + (${uuid_function}, 'PAC', 0, 'Wallis and Futuna Islands', 'WF', 'WLF'), + (${uuid_function}, 'PAC', 0, 'Western Sahara', 'WI', 'ESH'), + (${uuid_function}, 'PAC', 0, 'Yemen', 'YE', 'YEM'), + (${uuid_function}, 'PAC', 0, 'Yugoslavia (Federal Republic of)', 'YU', 'YUG'), + (${uuid_function}, 'PAC', 0, 'Zambia', 'ZA', 'ZMB'), + (${uuid_function}, 'PAC', 0, 'Zimbabwe', 'ZI', 'ZWE'), + -- Not an offical country, but used when nothing else seems to fit + (${uuid_function}, 'PAC', 0, 'Unknown', NULL, NULL); + + + + DELETE FROM locations + WHERE type = 'PAC'; + + + + + + + + + + + + + + -- Exact match + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country IS NOT NULL + AND l.type = 'PAC' + AND l.name = people.country; + + -- Exact match with trigram prefix + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country IS NOT NULL + AND l.type = 'PAC' + AND people.country = l.trigram || ' - ' || l.name; + + -- Some hard-coded exceptions + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country = 'Albania,' -- typo in some dictionaries + AND l.type = 'PAC' + AND l.name = 'Albania'; + + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country = 'Macedonia' -- old name + AND l.type = 'PAC' + AND l.name = 'North Macedonia'; + + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country = 'Turkey' -- old name + AND l.type = 'PAC' + AND l.name = 'Türkiye'; + + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country = 'TUR - Turkey' -- old name with prefix + AND l.type = 'PAC' + AND l.name = 'Türkiye'; + + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country = 'United Kingdom' -- shorter name + AND l.type = 'PAC' + AND l.name = 'United Kingdom (Great Britain and Northern Ireland)'; + + UPDATE people + SET "countryUuid" = l.uuid, + country = NULL -- we have an exact match + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country = 'United States of America' -- longer name + AND l.type = 'PAC' + AND l.name = 'United States'; + + -- Some heuristics (keep the old country for reference!): + -- prefix match + UPDATE people + SET "countryUuid" = l.uuid + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country IS NOT NULL + AND l.type = 'PAC' + AND l.name LIKE people.country || '%'; + + -- suffix match + UPDATE people + SET "countryUuid" = l.uuid + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country IS NOT NULL + AND l.type = 'PAC' + AND l.name LIKE '%' || people.country; + + -- infix match + UPDATE people + SET "countryUuid" = l.uuid + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country IS NOT NULL + AND l.type = 'PAC' + AND l.name LIKE '%' || people.country || '%'; + + -- Finally, set unmatched ones to Unknown + UPDATE people + SET "countryUuid" = l.uuid + FROM locations l + WHERE people."countryUuid" IS NULL + AND people.country IS NOT NULL + AND l.type = 'PAC' + AND l.name = 'Unknown'; + + + + UPDATE people + SET "countryUuid" = NULL, + country = l.name + FROM locations l + WHERE people."countryUuid" = l.uuid + AND people.country IS NULL; + + + + + + + + + + + + DROP MATERIALIZED VIEW mv_fts_locations; + + + ALTER TABLE locations DROP COLUMN full_text; + + + ALTER TABLE locations + ADD COLUMN full_text tsvector GENERATED ALWAYS AS ( + setweight(to_tsvector(${fts_config}, coalesce(locations.name, '')) + || to_tsvector('simple', coalesce(locations.name, '')), ${fts_high}) || + setweight(to_tsvector(${fts_config}, coalesce(locations.digram, '')) + || to_tsvector('simple', coalesce(locations.digram, '')), ${fts_low}) || + setweight(to_tsvector(${fts_config}, coalesce(locations.trigram, '')) + || to_tsvector('simple', coalesce(locations.trigram, '')), ${fts_low}) || + setweight(to_tsvector(${fts_config}, coalesce(locations.description, '')) + || to_tsvector('simple', coalesce(locations.description, '')), ${fts_low}) || + setweight(to_tsvector(${fts_config}, jsonb_value_agg(locations."customFields"::jsonb)) + || to_tsvector('simple', jsonb_value_agg(locations."customFields"::jsonb)), ${fts_lower}) + ) STORED; + + + CREATE MATERIALIZED VIEW IF NOT EXISTS mv_fts_locations(uuid, full_text) AS + SELECT + locations.uuid, + locations.full_text + || coalesce(tsvector_agg(notes.full_text), ''::tsvector) + FROM locations + LEFT JOIN "noteRelatedObjects" ON "noteRelatedObjects"."relatedObjectType" = 'locations' + AND "noteRelatedObjects"."relatedObjectUuid" = locations.uuid + LEFT JOIN notes ON notes.uuid = "noteRelatedObjects"."noteUuid" + GROUP BY locations.uuid + WITH DATA; + CREATE UNIQUE INDEX "UQ_mv_fts_locations_uuid" ON mv_fts_locations(uuid); + CREATE INDEX "FT_mv_fts_locations" ON mv_fts_locations USING gin(full_text); + CREATE INDEX "TR_locations_uuid" ON mv_fts_locations USING gin(uuid gin_trgm_ops); + + + + diff --git a/src/test/java/mil/dds/anet/test/integration/utils/TestBeans.java b/src/test/java/mil/dds/anet/test/integration/utils/TestBeans.java index 3eb35fc54b..8bf71b8345 100644 --- a/src/test/java/mil/dds/anet/test/integration/utils/TestBeans.java +++ b/src/test/java/mil/dds/anet/test/integration/utils/TestBeans.java @@ -25,7 +25,6 @@ public static Person getTestPerson() { p.setBiography(""); p.setDomainUsername("test"); p.setGender("Male"); - p.setCountry("United States of America"); p.setEndOfTourDate( ZonedDateTime.of(2036, 8, 1, 0, 0, 0, 0, DaoUtils.getServerNativeZoneId()).toInstant()); return p; diff --git a/src/test/java/mil/dds/anet/test/resources/PersonResourceTest.java b/src/test/java/mil/dds/anet/test/resources/PersonResourceTest.java index 0cf6c0b96f..56df6ef164 100644 --- a/src/test/java/mil/dds/anet/test/resources/PersonResourceTest.java +++ b/src/test/java/mil/dds/anet/test/resources/PersonResourceTest.java @@ -53,10 +53,11 @@ public class PersonResourceTest extends AbstractResourceTest { + " relatedObjectType relatedObjectUuid createdAt updatedAt }"; private static final String _POSITION_FIELDS = String.format( "uuid name code type role status organization { uuid } %1$s", _EMAIL_ADDRESSES_FIELDS); - private static final String _PERSON_FIELDS = - String.format("uuid name status user phoneNumber rank biography country avatarUuid code" + private static final String _PERSON_FIELDS = String.format( + "uuid name status user phoneNumber rank biography obsoleteCountry country { uuid name } avatarUuid code" + " gender endOfTourDate domainUsername openIdSubject pendingVerification createdAt updatedAt" - + " customFields %1$s", _EMAIL_ADDRESSES_FIELDS); + + " customFields %1$s", + _EMAIL_ADDRESSES_FIELDS); public static final String PERSON_FIELDS_ONLY_HISTORY = "{ uuid previousPositions { startTime endTime position { uuid } } }"; public static final String POSITION_FIELDS = String.format("{ %s person { %s } %s }", @@ -79,7 +80,7 @@ void testCreatePerson() { .withBiography(UtilsTest.getCombinedHtmlTestCase().getInput()) // set JSON of customFields .withCustomFields(UtilsTest.getCombinedJsonTestCase().getInput()).withGender("Female") - .withCountry("Canada").withCode("123456") + .withCode("123456") .withEndOfTourDate( ZonedDateTime.of(2020, 4, 1, 0, 0, 0, 0, DaoUtils.getServerNativeZoneId()).toInstant()) .build(); @@ -96,7 +97,6 @@ void testCreatePerson() { final PersonInput updatedNewPersonInput = getPersonInput(newPerson); updatedNewPersonInput.setName("testCreatePerson updated name"); - updatedNewPersonInput.setCountry("The Commonwealth of Canada"); updatedNewPersonInput.setCode("A123456"); // update HTML of biography diff --git a/src/test/java/mil/dds/anet/test/resources/ReportResourceTest.java b/src/test/java/mil/dds/anet/test/resources/ReportResourceTest.java index 897e922341..51f15f2392 100644 --- a/src/test/java/mil/dds/anet/test/resources/ReportResourceTest.java +++ b/src/test/java/mil/dds/anet/test/resources/ReportResourceTest.java @@ -91,7 +91,7 @@ class ReportResourceTest extends AbstractResourceTest { String.format("{ %1$s approvalSteps { uuid name nextStepUuid relatedObjectUuid } %2$s }", _ORGANIZATION_FIELDS, _EMAIL_ADDRESSES_FIELDS); private static final String _PERSON_FIELDS = - "uuid name status user phoneNumber rank biography country" + "uuid name status user phoneNumber rank biography obsoleteCountry country { uuid name }" + " gender endOfTourDate domainUsername openIdSubject pendingVerification createdAt updatedAt"; private static final String PERSON_FIELDS = String.format("{ %1$s %2$s }", _PERSON_FIELDS, _EMAIL_ADDRESSES_FIELDS); diff --git a/src/test/java/mil/dds/anet/test/resources/merge/LocationMergeTest.java b/src/test/java/mil/dds/anet/test/resources/merge/LocationMergeTest.java index 6ef97dfdfa..156dd8bbf8 100644 --- a/src/test/java/mil/dds/anet/test/resources/merge/LocationMergeTest.java +++ b/src/test/java/mil/dds/anet/test/resources/merge/LocationMergeTest.java @@ -10,6 +10,8 @@ import mil.dds.anet.test.client.Location; import mil.dds.anet.test.client.LocationInput; import mil.dds.anet.test.client.LocationType; +import mil.dds.anet.test.client.Person; +import mil.dds.anet.test.client.PersonInput; import mil.dds.anet.test.client.Status; import mil.dds.anet.test.resources.AbstractResourceTest; import mil.dds.anet.test.resources.AttachmentResourceTest; @@ -17,16 +19,18 @@ public class LocationMergeTest extends AbstractResourceTest { - public static final String FIELDS = - String.format("{ uuid name type description status lat lng customFields attachments %s }", - AttachmentResourceTest.ATTACHMENT_FIELDS); + public static final String FIELDS = String.format( + "{ uuid name type digram trigram description status lat lng customFields attachments %s }", + AttachmentResourceTest.ATTACHMENT_FIELDS); + private static final String PERSON_FIELDS = String.format("{ uuid country %s }", FIELDS); @Test void testMerge() { - // Create Loser Location - final LocationInput firstLocationInput = LocationInput.builder() - .withName("MergeLocationsTest First Location").withType(LocationType.POINT_LOCATION) - .withLat(47.613442).withLng(-52.740936).withStatus(Status.ACTIVE).build(); + // Create winner Location + final LocationInput firstLocationInput = + LocationInput.builder().withName("MergeLocationsTest First Location") + .withType(LocationType.COUNTRY).withDigram("FL").withTrigram("FLT").withLat(47.613442) + .withLng(-52.740936).withStatus(Status.ACTIVE).build(); final Location firstLocation = withCredentials(adminUser, t -> mutationExecutor.createLocation(FIELDS, firstLocationInput)); @@ -44,16 +48,26 @@ void testMerge() { t -> mutationExecutor.createAttachment("", firstLocationAttachmentInput)); assertThat(createdFirstLocationAttachmentUuid).isNotNull(); - // Create Winner Location - final LocationInput secondLocationInput = LocationInput.builder() - .withName("MergeLocationsTest Second Location").withType(LocationType.POINT_LOCATION) - .withLat(47.561517).withLng(-52.70876).withStatus(Status.ACTIVE).build(); + // Create loser Location + final LocationInput secondLocationInput = + LocationInput.builder().withName("MergeLocationsTest Second Location") + .withType(LocationType.COUNTRY).withDigram("SL").withTrigram("SLT").withLat(47.561517) + .withLng(-52.70876).withStatus(Status.ACTIVE).build(); final Location secondLocation = withCredentials(adminUser, t -> mutationExecutor.createLocation(FIELDS, secondLocationInput)); assertThat(secondLocation).isNotNull(); assertThat(secondLocation.getUuid()).isNotNull(); + // Create a person + final PersonInput testPersonInput = + PersonInput.builder().withName("Test person for location merge") + .withCountry(getLocationInput(secondLocation)).build(); + final Person testPerson = withCredentials(adminUser, + t -> mutationExecutor.createPerson(PERSON_FIELDS, testPersonInput)); + assertThat(testPerson).isNotNull(); + assertThat(testPerson.getUuid()).isNotNull(); + // Add an attachment final GenericRelatedObjectInput secondLocationAttachment = GenericRelatedObjectInput.builder() .withRelatedObjectType("locations").withRelatedObjectUuid(secondLocation.getUuid()).build(); @@ -84,6 +98,16 @@ void testMerge() { final Location mergedLocation = withCredentials(adminUser, t -> queryExecutor.location(FIELDS, mergedLocationInput.getUuid())); assertThat(mergedLocation.getAttachments()).hasSize(2); + + // Check that test person's country has been updated + final Person testPersonMerged = + withCredentials(adminUser, t -> queryExecutor.person(PERSON_FIELDS, testPerson.getUuid())); + assertThat(testPersonMerged).isNotNull(); + assertThat(testPersonMerged.getCountry()).isNotNull(); + assertThat(testPersonMerged.getCountry().getUuid()).isEqualTo(mergedLocation.getUuid()); + assertThat(testPersonMerged.getCountry().getName()).isEqualTo(mergedLocation.getName()); + assertThat(testPersonMerged.getCountry().getDigram()).isEqualTo(mergedLocation.getDigram()); + assertThat(testPersonMerged.getCountry().getTrigram()).isEqualTo(mergedLocation.getTrigram()); } } diff --git a/src/test/java/mil/dds/anet/test/resources/merge/PersonMergeTest.java b/src/test/java/mil/dds/anet/test/resources/merge/PersonMergeTest.java index fc57b20f16..f0b4c05011 100644 --- a/src/test/java/mil/dds/anet/test/resources/merge/PersonMergeTest.java +++ b/src/test/java/mil/dds/anet/test/resources/merge/PersonMergeTest.java @@ -15,8 +15,12 @@ import java.util.UUID; import mil.dds.anet.resources.AttachmentResource; import mil.dds.anet.test.TestData; +import mil.dds.anet.test.client.AnetBeanList_Location; import mil.dds.anet.test.client.AttachmentInput; import mil.dds.anet.test.client.GenericRelatedObjectInput; +import mil.dds.anet.test.client.Location; +import mil.dds.anet.test.client.LocationSearchQueryInput; +import mil.dds.anet.test.client.LocationType; import mil.dds.anet.test.client.Organization; import mil.dds.anet.test.client.Person; import mil.dds.anet.test.client.PersonInput; @@ -36,8 +40,18 @@ class PersonMergeTest extends AbstractResourceTest { @Test void testMerge() { + final LocationSearchQueryInput lsq = + LocationSearchQueryInput.builder().withType(LocationType.COUNTRY).withPageSize(2).build(); + final AnetBeanList_Location locationList = withCredentials(adminUser, + t -> queryExecutor.locationList(getListFields("{ uuid name }"), lsq)); + assertThat(locationList).isNotNull(); + assertThat(locationList.getList()).hasSize(2); + final Location loserCountry = locationList.getList().get(0); + final Location winnerCountry = locationList.getList().get(0); + // Create a person - final PersonInput loserInput1 = PersonInput.builder().withName("Loser for Merging").build(); + final PersonInput loserInput1 = PersonInput.builder().withName("Loser for Merging") + .withCountry(getLocationInput(loserCountry)).build(); final Person loser1 = withCredentials(adminUser, t -> mutationExecutor.createPerson(FIELDS, loserInput1)); assertThat(loser1).isNotNull(); @@ -118,7 +132,7 @@ void testMerge() { .withBiography(UtilsTest.getCombinedHtmlTestCase().getInput()) // set JSON of customFields .withCustomFields(UtilsTest.getCombinedJsonTestCase().getInput()).withGender("Female") - .withCountry("Canada").withCode("1234568") + .withCountry(getLocationInput(winnerCountry)).withCode("1234568") .withEndOfTourDate( ZonedDateTime.of(2020, 4, 1, 0, 0, 0, 0, DaoUtils.getServerNativeZoneId()).toInstant()) .build(); @@ -163,6 +177,11 @@ void testMerge() { withCredentials(adminUser, t -> queryExecutor.position(POSITION_FIELDS, created.getUuid())); assertThat(winnerPos.getPerson()).isNull(); + // Assert that winner has correct country + assertThat(mergedPerson.getCountry()).isNotNull(); + assertThat(mergedPerson.getCountry().getUuid()).isEqualTo(winnerCountry.getUuid()); + assertThat(mergedPerson.getCountry().getName()).isEqualTo(winnerCountry.getName()); + // Re-create loser and put into the position. final PersonInput loserInput2 = PersonInput.builder().withName("Loser for Merging").build(); final Person loser2 = @@ -207,7 +226,7 @@ void testMergeNoHistory() { .withBiography(UtilsTest.getCombinedHtmlTestCase().getInput()) // set JSON of customFields .withCustomFields(UtilsTest.getCombinedJsonTestCase().getInput()).withGender("Female") - .withCountry("Canada").withCode("1234568") + .withCode("1234568") .withEndOfTourDate( ZonedDateTime.of(2020, 4, 1, 0, 0, 0, 0, DaoUtils.getServerNativeZoneId()).toInstant()) .build(); diff --git a/src/test/resources/anet.graphql b/src/test/resources/anet.graphql index 920232f8bc..649b48e463 100644 --- a/src/test/resources/anet.graphql +++ b/src/test/resources/anet.graphql @@ -373,6 +373,7 @@ type Location { customFields: String customSensitiveInformation: [CustomSensitiveInformation] description: String + digram: String isSubscribed: Boolean lat: Float lng: Float @@ -380,6 +381,7 @@ type Location { notes: [Note] planningApprovalSteps: [ApprovalStep] status: Status + trigram: String type: LocationType updatedAt: Instant uuid: String @@ -392,11 +394,13 @@ input LocationInput { customFields: String customSensitiveInformation: [CustomSensitiveInformationInput] description: String + digram: String lat: Float lng: Float name: String planningApprovalSteps: [ApprovalStepInput] status: Status + trigram: String type: LocationType updatedAt: Instant uuid: String @@ -425,6 +429,7 @@ enum LocationSearchSortBy { """""" enum LocationType { + COUNTRY GEOGRAPHICAL_AREA PHYSICAL_LOCATION POINT_LOCATION @@ -617,7 +622,7 @@ type Person { avatarUuid: String biography: String code: String - country: String + country: Location createdAt: Instant customFields: String customSensitiveInformation: [CustomSensitiveInformation] @@ -628,6 +633,7 @@ type Person { isSubscribed: Boolean name: String notes: [Note] + obsoleteCountry: String openIdSubject: String pendingVerification: Boolean phoneNumber: String @@ -645,7 +651,7 @@ input PersonInput { avatarUuid: String biography: String code: String - country: String + country: LocationInput createdAt: Instant customFields: String customSensitiveInformation: [CustomSensitiveInformationInput] @@ -654,6 +660,7 @@ input PersonInput { endOfTourDate: Instant gender: String name: String + obsoleteCountry: String openIdSubject: String pendingVerification: Boolean phoneNumber: String @@ -688,7 +695,7 @@ input PersonPositionHistoryInput { """""" input PersonSearchQueryInput { - country: String + countryUuid: String emailNetwork: String endOfTourDateEnd: Instant endOfTourDateStart: Instant @@ -973,7 +980,7 @@ type ReportPerson { avatarUuid: String biography: String code: String - country: String + country: Location createdAt: Instant customFields: String customSensitiveInformation: [CustomSensitiveInformation] @@ -985,6 +992,7 @@ type ReportPerson { isSubscribed: Boolean name: String notes: [Note] + obsoleteCountry: String openIdSubject: String pendingVerification: Boolean phoneNumber: String @@ -1005,7 +1013,7 @@ input ReportPersonInput { avatarUuid: String biography: String code: String - country: String + country: LocationInput createdAt: Instant customFields: String customSensitiveInformation: [CustomSensitiveInformationInput] @@ -1015,6 +1023,7 @@ input ReportPersonInput { gender: String interlocutor: Boolean! name: String + obsoleteCountry: String openIdSubject: String pendingVerification: Boolean phoneNumber: String diff --git a/src/test/resources/graphQLTests/person.gql b/src/test/resources/graphQLTests/person.gql index fd0881fb12..11c3c79b10 100644 --- a/src/test/resources/graphQLTests/person.gql +++ b/src/test/resources/graphQLTests/person.gql @@ -15,7 +15,11 @@ person(uuid:"${personUuid}") { domainUsername openIdSubject biography - country + obsoleteCountry + country { + uuid + name + } gender endOfTourDate position { diff --git a/testDictionaries/no-custom-fields.yml b/testDictionaries/no-custom-fields.yml index 2a7cc21aca..c3cead2242 100644 --- a/testDictionaries/no-custom-fields.yml +++ b/testDictionaries/no-custom-fields.yml @@ -521,6 +521,12 @@ fields: placeholder: Fill in the name of this location type: label: Type + digram: + label: Digram + placeholder: Fill in the 2-letter code for this country + trigram: + label: Trigram + placeholder: Fill in the 3-letter code for this country description: label: Description placeholder: Fill in the description of this location @@ -807,9 +813,6 @@ fields: regular: person: name: Person - countries: [Afghanistan, Albania , Armenia, Australia, Austria, Azerbaijan, Belgium, Bosnia-Herzegovina, Bulgaria, Croatia, Czech Republic, Denmark, Estonia, Finland, - Georgia, Germany, Greece, Hungary, Iceland, Italy, Latvia, Lithuania, Luxembourg, Macedonia, Mongolia, Montenegro, Netherlands, New Zealand, - Norway, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden, Türkiye, Ukraine, United Kingdom, United States of America] # number of fields after Avatar in the left column for persons # adjust this number if two columns are not balanced on the Person Page numberOfFieldsInLeftColumn: 7