mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-19 14:29:21 -04:00
Add Big 5 profile field
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@compass/api",
|
||||
"description": "Backend API endpoints",
|
||||
"version": "1.5.1",
|
||||
"version": "1.6.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"watch:serve": "tsx watch src/serve.ts",
|
||||
|
||||
@@ -17,6 +17,16 @@ export type profileQueryType = {
|
||||
pref_age_max?: number | undefined,
|
||||
drinks_min?: number | undefined,
|
||||
drinks_max?: number | undefined,
|
||||
big5_openness_min?: number | undefined,
|
||||
big5_openness_max?: number | undefined,
|
||||
big5_conscientiousness_min?: number | undefined,
|
||||
big5_conscientiousness_max?: number | undefined,
|
||||
big5_extraversion_min?: number | undefined,
|
||||
big5_extraversion_max?: number | undefined,
|
||||
big5_agreeableness_min?: number | undefined,
|
||||
big5_agreeableness_max?: number | undefined,
|
||||
big5_neuroticism_min?: number | undefined,
|
||||
big5_neuroticism_max?: number | undefined,
|
||||
pref_relation_styles?: string[] | undefined,
|
||||
pref_romantic_styles?: string[] | undefined,
|
||||
diet?: string[] | undefined,
|
||||
@@ -60,6 +70,16 @@ export const loadProfiles = async (props: profileQueryType) => {
|
||||
pref_age_max,
|
||||
drinks_min,
|
||||
drinks_max,
|
||||
big5_openness_min,
|
||||
big5_openness_max,
|
||||
big5_conscientiousness_min,
|
||||
big5_conscientiousness_max,
|
||||
big5_extraversion_min,
|
||||
big5_extraversion_max,
|
||||
big5_agreeableness_min,
|
||||
big5_agreeableness_max,
|
||||
big5_neuroticism_min,
|
||||
big5_neuroticism_max,
|
||||
pref_relation_styles,
|
||||
pref_romantic_styles,
|
||||
diet,
|
||||
@@ -211,6 +231,42 @@ export const loadProfiles = async (props: profileQueryType) => {
|
||||
drinks_max &&
|
||||
where(`drinks_per_month <= $(drinks_max) or drinks_per_month is null`, {drinks_max}),
|
||||
|
||||
big5_openness_min &&
|
||||
where(`big5_openness >= $(big5_openness_min) or big5_openness is null`, {big5_openness_min}),
|
||||
|
||||
big5_openness_max &&
|
||||
where(`big5_openness <= $(big5_openness_max) or big5_openness is null`, {big5_openness_max}),
|
||||
|
||||
big5_conscientiousness_min &&
|
||||
where(
|
||||
`big5_conscientiousness >= $(big5_conscientiousness_min) or big5_conscientiousness is null`,
|
||||
{big5_conscientiousness_min}
|
||||
),
|
||||
|
||||
big5_conscientiousness_max &&
|
||||
where(
|
||||
`big5_conscientiousness <= $(big5_conscientiousness_max) or big5_conscientiousness is null`,
|
||||
{big5_conscientiousness_max}
|
||||
),
|
||||
|
||||
big5_extraversion_min &&
|
||||
where(`big5_extraversion >= $(big5_extraversion_min) or big5_extraversion is null`, {big5_extraversion_min}),
|
||||
|
||||
big5_extraversion_max &&
|
||||
where(`big5_extraversion <= $(big5_extraversion_max) or big5_extraversion is null`, {big5_extraversion_max}),
|
||||
|
||||
big5_agreeableness_min &&
|
||||
where(`big5_agreeableness >= $(big5_agreeableness_min) or big5_agreeableness is null`, {big5_agreeableness_min}),
|
||||
|
||||
big5_agreeableness_max &&
|
||||
where(`big5_agreeableness <= $(big5_agreeableness_max) or big5_agreeableness is null`, {big5_agreeableness_max}),
|
||||
|
||||
big5_neuroticism_min &&
|
||||
where(`big5_neuroticism >= $(big5_neuroticism_min) or big5_neuroticism is null`, {big5_neuroticism_min}),
|
||||
|
||||
big5_neuroticism_max &&
|
||||
where(`big5_neuroticism <= $(big5_neuroticism_max) or big5_neuroticism is null`, {big5_neuroticism_max}),
|
||||
|
||||
pref_relation_styles?.length &&
|
||||
where(
|
||||
`pref_relation_styles IS NULL OR pref_relation_styles = '{}' OR pref_relation_styles && $(pref_relation_styles)`,
|
||||
|
||||
@@ -113,6 +113,11 @@ export const sinclairProfile: ProfileRow = {
|
||||
search_text: 'the futa in futarchy',
|
||||
search_tsv: 'the futa in futarchy',
|
||||
age: 25,
|
||||
big5_agreeableness: 10,
|
||||
big5_openness: 10,
|
||||
big5_conscientiousness: 10,
|
||||
big5_extraversion: 10,
|
||||
big5_neuroticism: 10,
|
||||
}
|
||||
|
||||
export const jamesUser: User = {
|
||||
@@ -226,4 +231,9 @@ export const jamesProfile: ProfileRow = {
|
||||
search_text: 'the futa in futarchy',
|
||||
search_tsv: 'the futa in futarchy',
|
||||
age: 32,
|
||||
big5_agreeableness: 10,
|
||||
big5_openness: 10,
|
||||
big5_conscientiousness: 10,
|
||||
big5_extraversion: 10,
|
||||
big5_neuroticism: 10,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
ALTER TABLE profiles
|
||||
ADD COLUMN big5_openness SMALLINT,
|
||||
ADD COLUMN big5_conscientiousness SMALLINT,
|
||||
ADD COLUMN big5_extraversion SMALLINT,
|
||||
ADD COLUMN big5_agreeableness SMALLINT,
|
||||
ADD COLUMN big5_neuroticism SMALLINT;
|
||||
|
||||
|
||||
ALTER TABLE profiles
|
||||
ADD CONSTRAINT big5_range_check
|
||||
CHECK (
|
||||
big5_openness BETWEEN 0 AND 100 AND
|
||||
big5_conscientiousness BETWEEN 0 AND 100 AND
|
||||
big5_extraversion BETWEEN 0 AND 100 AND
|
||||
big5_agreeableness BETWEEN 0 AND 100 AND
|
||||
big5_neuroticism BETWEEN 0 AND 100
|
||||
);
|
||||
|
||||
CREATE INDEX profiles_big5_open_idx ON profiles (big5_openness);
|
||||
CREATE INDEX profiles_big5_cons_idx ON profiles (big5_conscientiousness);
|
||||
CREATE INDEX profiles_big5_extra_idx ON profiles (big5_extraversion);
|
||||
CREATE INDEX profiles_big5_agree_idx ON profiles (big5_agreeableness);
|
||||
CREATE INDEX profiles_big5_neur_idx ON profiles (big5_neuroticism);
|
||||
Reference in New Issue
Block a user