Job search and people-to-sql with Bun
This commit is contained in:
27
Scripts/people-to-sql.js
Normal file
27
Scripts/people-to-sql.js
Normal file
@ -0,0 +1,27 @@
|
||||
import people from '../.vscode/helper/.638443643487798783/people.json' with { type: 'json' };
|
||||
|
||||
const pathA = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.sql';
|
||||
const pathB = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.json';
|
||||
|
||||
let results = [];
|
||||
let name = '';
|
||||
let person = {};
|
||||
let line = '';
|
||||
let lines = [];
|
||||
for (const property in people) {
|
||||
person = people[property];
|
||||
name = person.Name.Suffix == undefined || person.Name.Suffix.length === 0
|
||||
? person.Name.ForwardSlashFull
|
||||
: person.Name.ForwardSlashFull + ' ' + person.Name.Suffix;
|
||||
line = `update Tags set name = '${name}' where name = '${person.Birth.Note}';`
|
||||
lines.push(line);
|
||||
line = `update TagProperties set value = '${name}' where value = '${person.Birth.Note}';`
|
||||
lines.push(line);
|
||||
results.push({ id: person.Birth.Note, name: name });
|
||||
}
|
||||
|
||||
const text = lines.join('\n');
|
||||
await Bun.write(pathA, text);
|
||||
|
||||
const json = JSON.stringify(results);
|
||||
await Bun.write(pathB, json);
|
Reference in New Issue
Block a user