|
|
|
|
@@ -10,8 +10,6 @@ const initializeTypes = async () => {
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
const getSettingsTypeId = (name) => settingsTypeMap[name];
|
|
|
|
|
console.log(settingsTypeMap, getSettingsTypeId('personal'));
|
|
|
|
|
|
|
|
|
|
const getUserParamTypeId = async(name) => {
|
|
|
|
|
const userParamType = await UserParamType.findOne({
|
|
|
|
|
where: {
|
|
|
|
|
@@ -20,132 +18,58 @@ const initializeTypes = async () => {
|
|
|
|
|
});
|
|
|
|
|
return userParamType.id;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'language' },
|
|
|
|
|
defaults: { description: 'language', datatype: 'singleselect', settingsId: getSettingsTypeId('personal') }
|
|
|
|
|
const userParams = {
|
|
|
|
|
language: {type: 'singleselect', setting: 'personal'},
|
|
|
|
|
birthdate: { type: 'date', setting: 'personal' },
|
|
|
|
|
zip: { type: 'string', setting: 'personal' },
|
|
|
|
|
town: { type: 'string', setting: 'personal' },
|
|
|
|
|
bodyheight: { type: 'float', setting: 'view' },
|
|
|
|
|
weight: { type: 'float', setting: 'view' },
|
|
|
|
|
eyecolor: { type: 'singleselect', setting: 'view' },
|
|
|
|
|
haircolor: { type: 'singleselect', setting: 'view' },
|
|
|
|
|
hairlength: { type: 'singleselect', setting: 'view' },
|
|
|
|
|
skincolor: { type: 'singleselect', setting: 'view' },
|
|
|
|
|
freckles: { type: 'singleselect', setting: 'view' },
|
|
|
|
|
piercings: { type: 'bool', setting: 'view' },
|
|
|
|
|
tattoos: { type: 'bool', setting: 'view' },
|
|
|
|
|
sexualpreference: { type: 'singleselect', 'setting': 'sexuality', minAge: 14 },
|
|
|
|
|
gender: { type: 'singleselect', setting: 'personal' },
|
|
|
|
|
pubichair: { type: 'singleselect', setting: 'sexuality', minAge: 14 },
|
|
|
|
|
penislenght: { type: 'int', setting: 'sexuality', minAge: 14, gender: 'm' },
|
|
|
|
|
brasize: { type: 'string', setting: 'sexuality', minAge: 14, gender: 'f' }
|
|
|
|
|
};
|
|
|
|
|
Object.keys(userParams).forEach(async(key) => {
|
|
|
|
|
const item = userParams[key];
|
|
|
|
|
const createItem = { description: key, datatype: item.type, settingsId: getSettingsTypeId(item.setting) };
|
|
|
|
|
if (item.minAge) createItem.minAge = item.minAge;
|
|
|
|
|
if (item.gender) createItem.gender = item.gender;
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: key },
|
|
|
|
|
defaults: createItem
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'birthdate' },
|
|
|
|
|
defaults: { description: 'birthdate', datatype: 'date', settingsId: getSettingsTypeId('personal') }
|
|
|
|
|
const valuesList = {
|
|
|
|
|
gender: ['male', 'female', 'transfemale', 'transmale', 'nonbinary'],
|
|
|
|
|
language: ['de', 'en'],
|
|
|
|
|
eyecolor: ['blue', 'green', 'brown', 'black', 'grey', 'hazel', 'amber', 'red', 'other'],
|
|
|
|
|
haircolor: ['black', 'brown', 'blonde', 'red', 'grey', 'white', 'other'],
|
|
|
|
|
hairlength: ['short', 'medium', 'long', 'bald', 'other'],
|
|
|
|
|
skincolor: ['light', 'medium', 'dark', 'other'],
|
|
|
|
|
freckles: ['much', 'medium', 'less', 'none'],
|
|
|
|
|
};
|
|
|
|
|
Object.keys(valuesList).forEach(async(key) => {
|
|
|
|
|
const values = valuesList[key];
|
|
|
|
|
const userParamTypeId = await getUserParamTypeId(key);
|
|
|
|
|
values.forEach(async(value) => {
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: userParamTypeId,
|
|
|
|
|
value: value
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: userParamTypeId, value: value }
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'zip' },
|
|
|
|
|
defaults: { description: 'zip', datatype: 'string', settingsId: getSettingsTypeId('personal') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'town' },
|
|
|
|
|
defaults: { description: 'town', datatype: 'string', settingsId: getSettingsTypeId('personal') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'bodyheight' },
|
|
|
|
|
defaults: { description: 'bodyheight', datatype: 'float', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'weight' },
|
|
|
|
|
defaults: { description: 'weight', datatype: 'float', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'eyecolor' },
|
|
|
|
|
defaults: { description: 'eyecolor', datatype: 'string', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'haircolor' },
|
|
|
|
|
defaults: { description: 'haircolor', datatype: 'string', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'hairlength' },
|
|
|
|
|
defaults: { description: 'hairlength', datatype: 'int', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'skincolor' },
|
|
|
|
|
defaults: { description: 'skincolor', datatype: 'int', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'freckles' },
|
|
|
|
|
defaults: { description: 'freckles', datatype: 'int', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'piercings' },
|
|
|
|
|
defaults: { description: 'piercings', datatype: 'bool', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'tattoos' },
|
|
|
|
|
defaults: { description: 'tattoos', datatype: 'bool', settingsId: getSettingsTypeId('view') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'sexualpreference' },
|
|
|
|
|
defaults: { description: 'sexualpreference', minAge: 14, datatype: 'int', settingsId: getSettingsTypeId('sexuality') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'gender' },
|
|
|
|
|
defaults: { description: 'gender', datatype: 'singleselect', settingsId: getSettingsTypeId('personal') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'pubichair' },
|
|
|
|
|
defaults: { description: 'pubichair', minAge: 14, datatype: 'int', settingsId: getSettingsTypeId('sexuality') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'penislength' },
|
|
|
|
|
defaults: { description: 'penislength', minAge: 14, gender: 'm', datatype: 'int', settingsId: getSettingsTypeId('sexuality') }
|
|
|
|
|
});
|
|
|
|
|
await UserParamType.findOrCreate({
|
|
|
|
|
where: { description: 'brasize' },
|
|
|
|
|
defaults: { description: 'brasize', minAge: 14, gender: 'f', datatype: 'string', settingsId: getSettingsTypeId('sexuality') }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const genderId = await getUserParamTypeId('gender');
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: genderId,
|
|
|
|
|
value: 'male'
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: genderId, value: 'male' }
|
|
|
|
|
});
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: genderId,
|
|
|
|
|
value: 'female'
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: genderId, value: 'female' }
|
|
|
|
|
});
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: genderId,
|
|
|
|
|
value: 'transfemale'
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: genderId, value: 'transfemale' }
|
|
|
|
|
});
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: genderId,
|
|
|
|
|
value: 'transmale'
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: genderId, value: 'transmale' }
|
|
|
|
|
});
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: genderId,
|
|
|
|
|
value: 'nonbinary'
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: genderId, value: 'nonbinary' }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const languageId = await getUserParamTypeId('language');
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: languageId,
|
|
|
|
|
value: 'de'
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: languageId, value: 'de' }
|
|
|
|
|
});
|
|
|
|
|
await UserParamValue.findOrCreate({
|
|
|
|
|
where: {
|
|
|
|
|
userParamTypeId: languageId,
|
|
|
|
|
value: 'en'
|
|
|
|
|
},
|
|
|
|
|
defaults: { userParamTypeId: languageId, value: 'en' }
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default initializeTypes;
|
|
|
|
|
|