1859 lines
36 KiB
JavaScript
1859 lines
36 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Profiles = db.profiles;
|
|
|
|
const Pairings = db.pairings;
|
|
|
|
const AnalysisReports = db.analysis_reports;
|
|
|
|
const AlgorithmConfigs = db.algorithm_configs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ProfilesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"full_name": "Lin Wei",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_datetime": new Date('1988-06-15T07:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_calendar": "solar",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "female",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birthplace": "Taipei, Taiwan",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Practices traditional ritual offerings",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"full_name": "Chen Mei",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_datetime": new Date('1992-11-02T22:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_calendar": "solar",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "female",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birthplace": "Tainan, Taiwan",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Favours name numerology in readings",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"full_name": "Alex Johnson",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_datetime": new Date('1990-05-12T08:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_calendar": "solar",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "female",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birthplace": "San Francisco, USA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Interested in synastry and karmic ties",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"full_name": "Sofia Park",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_datetime": new Date('1995-03-28T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birth_calendar": "solar",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender": "female",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"birthplace": "Seoul, South Korea",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Wants clarity about marriage timing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PairingsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Lin Wei & Chen Mei",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"relationship_suggestion": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_score": 82.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mutual_liking": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"marriage_potential": "uncertain",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"saved": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2023-09-10T00:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Alex Johnson & Chen Mei",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"relationship_suggestion": "friend",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_score": 64.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mutual_liking": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"marriage_potential": "no",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"saved": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2024-01-15T00:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Sofia Park & Yuki Tanaka",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"relationship_suggestion": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_score": 71.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mutual_liking": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"marriage_potential": "uncertain",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"saved": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2022-05-20T00:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Lin Wei & Yuki Tanaka",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"relationship_suggestion": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"overall_score": 53.4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"mutual_liking": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"marriage_potential": "no",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"saved": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date('2021-08-01T00:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AnalysisReportsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"analyst_comment": "月老觀察到名字與生辰互補,雙方有強烈情感契合但需化解少許業力",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"love_percentage": 78.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"friendship_percentage": 10.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"family_percentage": 5.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"karmic_percentage": 65.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"indicators_json": "{nameMatch:82,baziHarmony:70,numerology:74}",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_true_destiny": "not_destiny",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation": "建議兩人可進一步相處並以誠意溝通化解障礙",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"evaluated_at": new Date('2024-01-20T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"analyst_comment": "多為友情基礎,情感向心力不足以升溫為戀人",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"love_percentage": 22.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"friendship_percentage": 68.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"family_percentage": 5.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"karmic_percentage": 30.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"indicators_json": "{nameMatch:40,baziHarmony:55,numerology:60}",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_true_destiny": "not_destiny",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation": "保持朋友關係,若欲發展需長時間培養",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"evaluated_at": new Date('2024-02-10T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"analyst_comment": "屬於貴人緣分,會在事業或人生關鍵時助益彼此",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"love_percentage": 12.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"friendship_percentage": 30.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"family_percentage": 8.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"karmic_percentage": 80.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"indicators_json": "{nameMatch:60,baziHarmony:72,numerology:77}",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_true_destiny": "not_destiny",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation": "建議保持聯絡,在重要時刻互相扶持",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"evaluated_at": new Date('2023-11-05T09:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"analyst_comment": "互動有限,較偏向普通人緣,無明顯感情發展跡象",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"love_percentage": 8.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"friendship_percentage": 50.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"family_percentage": 10.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"karmic_percentage": 25.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"indicators_json": "{nameMatch:35,baziHarmony:40,numerology:45}",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_true_destiny": "true_destiny",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation": "維持友好互動即可,無需過度投入",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"evaluated_at": new Date('2022-10-12T16:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AlgorithmConfigsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Default Synastry v1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"version": "1.0.0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Baseline configuration combining name numerology and bazi harmony weights",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Marriage Potential Heuristics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"version": "1.1.0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Add marriage timing heuristics and karmic threshold adjustments",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Friendship Weighting",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"version": "0.9.0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Experimental config emphasizing friendship and benefactor signals",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Karmic Adjustment Pack",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"version": "1.0.2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Refinements for karmic percentage calculations",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProfileWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Profile0 = await Profiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Profile0?.setUser)
|
|
{
|
|
await
|
|
Profile0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Profile1 = await Profiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Profile1?.setUser)
|
|
{
|
|
await
|
|
Profile1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Profile2 = await Profiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Profile2?.setUser)
|
|
{
|
|
await
|
|
Profile2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Profile3 = await Profiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Profile3?.setUser)
|
|
{
|
|
await
|
|
Profile3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePairingWithProfile_a() {
|
|
|
|
const relatedProfile_a0 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing0 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Pairing0?.setProfile_a)
|
|
{
|
|
await
|
|
Pairing0.
|
|
setProfile_a(relatedProfile_a0);
|
|
}
|
|
|
|
const relatedProfile_a1 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing1 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Pairing1?.setProfile_a)
|
|
{
|
|
await
|
|
Pairing1.
|
|
setProfile_a(relatedProfile_a1);
|
|
}
|
|
|
|
const relatedProfile_a2 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing2 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Pairing2?.setProfile_a)
|
|
{
|
|
await
|
|
Pairing2.
|
|
setProfile_a(relatedProfile_a2);
|
|
}
|
|
|
|
const relatedProfile_a3 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing3 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Pairing3?.setProfile_a)
|
|
{
|
|
await
|
|
Pairing3.
|
|
setProfile_a(relatedProfile_a3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associatePairingWithProfile_b() {
|
|
|
|
const relatedProfile_b0 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing0 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Pairing0?.setProfile_b)
|
|
{
|
|
await
|
|
Pairing0.
|
|
setProfile_b(relatedProfile_b0);
|
|
}
|
|
|
|
const relatedProfile_b1 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing1 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Pairing1?.setProfile_b)
|
|
{
|
|
await
|
|
Pairing1.
|
|
setProfile_b(relatedProfile_b1);
|
|
}
|
|
|
|
const relatedProfile_b2 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing2 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Pairing2?.setProfile_b)
|
|
{
|
|
await
|
|
Pairing2.
|
|
setProfile_b(relatedProfile_b2);
|
|
}
|
|
|
|
const relatedProfile_b3 = await Profiles.findOne({
|
|
offset: Math.floor(Math.random() * (await Profiles.count())),
|
|
});
|
|
const Pairing3 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Pairing3?.setProfile_b)
|
|
{
|
|
await
|
|
Pairing3.
|
|
setProfile_b(relatedProfile_b3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePairingWithCreator() {
|
|
|
|
const relatedCreator0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Pairing0 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Pairing0?.setCreator)
|
|
{
|
|
await
|
|
Pairing0.
|
|
setCreator(relatedCreator0);
|
|
}
|
|
|
|
const relatedCreator1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Pairing1 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Pairing1?.setCreator)
|
|
{
|
|
await
|
|
Pairing1.
|
|
setCreator(relatedCreator1);
|
|
}
|
|
|
|
const relatedCreator2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Pairing2 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Pairing2?.setCreator)
|
|
{
|
|
await
|
|
Pairing2.
|
|
setCreator(relatedCreator2);
|
|
}
|
|
|
|
const relatedCreator3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Pairing3 = await Pairings.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Pairing3?.setCreator)
|
|
{
|
|
await
|
|
Pairing3.
|
|
setCreator(relatedCreator3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAnalysisReportWithPairing() {
|
|
|
|
const relatedPairing0 = await Pairings.findOne({
|
|
offset: Math.floor(Math.random() * (await Pairings.count())),
|
|
});
|
|
const AnalysisReport0 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AnalysisReport0?.setPairing)
|
|
{
|
|
await
|
|
AnalysisReport0.
|
|
setPairing(relatedPairing0);
|
|
}
|
|
|
|
const relatedPairing1 = await Pairings.findOne({
|
|
offset: Math.floor(Math.random() * (await Pairings.count())),
|
|
});
|
|
const AnalysisReport1 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AnalysisReport1?.setPairing)
|
|
{
|
|
await
|
|
AnalysisReport1.
|
|
setPairing(relatedPairing1);
|
|
}
|
|
|
|
const relatedPairing2 = await Pairings.findOne({
|
|
offset: Math.floor(Math.random() * (await Pairings.count())),
|
|
});
|
|
const AnalysisReport2 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AnalysisReport2?.setPairing)
|
|
{
|
|
await
|
|
AnalysisReport2.
|
|
setPairing(relatedPairing2);
|
|
}
|
|
|
|
const relatedPairing3 = await Pairings.findOne({
|
|
offset: Math.floor(Math.random() * (await Pairings.count())),
|
|
});
|
|
const AnalysisReport3 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AnalysisReport3?.setPairing)
|
|
{
|
|
await
|
|
AnalysisReport3.
|
|
setPairing(relatedPairing3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAnalysisReportWithEvaluator() {
|
|
|
|
const relatedEvaluator0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AnalysisReport0 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AnalysisReport0?.setEvaluator)
|
|
{
|
|
await
|
|
AnalysisReport0.
|
|
setEvaluator(relatedEvaluator0);
|
|
}
|
|
|
|
const relatedEvaluator1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AnalysisReport1 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AnalysisReport1?.setEvaluator)
|
|
{
|
|
await
|
|
AnalysisReport1.
|
|
setEvaluator(relatedEvaluator1);
|
|
}
|
|
|
|
const relatedEvaluator2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AnalysisReport2 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AnalysisReport2?.setEvaluator)
|
|
{
|
|
await
|
|
AnalysisReport2.
|
|
setEvaluator(relatedEvaluator2);
|
|
}
|
|
|
|
const relatedEvaluator3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AnalysisReport3 = await AnalysisReports.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AnalysisReport3?.setEvaluator)
|
|
{
|
|
await
|
|
AnalysisReport3.
|
|
setEvaluator(relatedEvaluator3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAlgorithmConfigWithCreator() {
|
|
|
|
const relatedCreator0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AlgorithmConfig0 = await AlgorithmConfigs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AlgorithmConfig0?.setCreator)
|
|
{
|
|
await
|
|
AlgorithmConfig0.
|
|
setCreator(relatedCreator0);
|
|
}
|
|
|
|
const relatedCreator1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AlgorithmConfig1 = await AlgorithmConfigs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AlgorithmConfig1?.setCreator)
|
|
{
|
|
await
|
|
AlgorithmConfig1.
|
|
setCreator(relatedCreator1);
|
|
}
|
|
|
|
const relatedCreator2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AlgorithmConfig2 = await AlgorithmConfigs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AlgorithmConfig2?.setCreator)
|
|
{
|
|
await
|
|
AlgorithmConfig2.
|
|
setCreator(relatedCreator2);
|
|
}
|
|
|
|
const relatedCreator3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AlgorithmConfig3 = await AlgorithmConfigs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AlgorithmConfig3?.setCreator)
|
|
{
|
|
await
|
|
AlgorithmConfig3.
|
|
setCreator(relatedCreator3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Profiles.bulkCreate(ProfilesData);
|
|
|
|
|
|
|
|
|
|
await Pairings.bulkCreate(PairingsData);
|
|
|
|
|
|
|
|
|
|
await AnalysisReports.bulkCreate(AnalysisReportsData);
|
|
|
|
|
|
|
|
|
|
await AlgorithmConfigs.bulkCreate(AlgorithmConfigsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProfileWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePairingWithProfile_a(),
|
|
|
|
|
|
|
|
|
|
await associatePairingWithProfile_b(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePairingWithCreator(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAnalysisReportWithPairing(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAnalysisReportWithEvaluator(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAlgorithmConfigWithCreator(),
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('profiles', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('pairings', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('analysis_reports', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('algorithm_configs', null, {});
|
|
|
|
|
|
},
|
|
}; |