Job search and people-to-sql with Bun
This commit is contained in:
50
Scripts/immich.js
Normal file
50
Scripts/immich.js
Normal file
@ -0,0 +1,50 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const url = 'https://immich.bchs.duckdns.org';
|
||||
|
||||
let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
// url: url + '/api/users',
|
||||
url: url + '/api/assets/f89d0de1-2762-4f9e-b60e-c7eeec93c4e9',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'x-api-key': 'Pm2CbhJvgStEPAFKRVclW88qrOAy79OeIEcfj3k'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
axios.request(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
// let data = JSON.stringify({
|
||||
// "avatar": {
|
||||
// "color": "green"
|
||||
// }
|
||||
// });
|
||||
|
||||
// let configB = {
|
||||
// method: 'put',
|
||||
// maxBodyLength: Infinity,
|
||||
// url: url + '/api/users/me/preferences',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json',
|
||||
// 'Accept': 'application/json',
|
||||
// 'x-api-key': 'Pm2CbhJvgStEPAFKRVclW88qrOAy79OeIEcfj3k'
|
||||
// },
|
||||
// data: data
|
||||
// };
|
||||
|
||||
// axios.request(configB)
|
||||
// .then((response) => {
|
||||
// console.log(JSON.stringify(response.data));
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// console.log(error);
|
||||
// });
|
||||
|
36
Scripts/job-search.js
Normal file
36
Scripts/job-search.js
Normal file
@ -0,0 +1,36 @@
|
||||
import year from '../.vscode/helper/year.job.json' with { type: 'json' };
|
||||
import event from '../.vscode/helper/event.job.json' with { type: 'json' };
|
||||
|
||||
let file;
|
||||
let fromYear = [];
|
||||
let fromEvent = [];
|
||||
let fromYearEventPresent = [];
|
||||
let fromEventYearPresent = [];
|
||||
const pathA = 'L:/Git/AA/.vscode/helper/from-year-event-present.json';
|
||||
const pathB = 'L:/Git/AA/.vscode/helper/from-event-year-present.json';
|
||||
|
||||
year.Files.forEach(element => {
|
||||
file = element.RelativePath.split('\\')[1];
|
||||
fromYear.push(file);
|
||||
});
|
||||
|
||||
event.Files.forEach(element => {
|
||||
file = element.RelativePath.split('\\')[1];
|
||||
fromEvent.push(file);
|
||||
if (fromYear.includes(file)){
|
||||
fromYearEventPresent.push(file);
|
||||
}
|
||||
});
|
||||
|
||||
year.Files.forEach(element => {
|
||||
file = element.RelativePath.split('\\')[1];
|
||||
if (fromEvent.includes(file)){
|
||||
fromEventYearPresent.push(file);
|
||||
};
|
||||
});
|
||||
|
||||
const jsonA = JSON.stringify(fromYearEventPresent);
|
||||
await Bun.write(pathA, jsonA);
|
||||
|
||||
const jsonB = JSON.stringify(fromEventYearPresent);
|
||||
await Bun.write(pathB, jsonB);
|
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