Umbau auf postgres 2. step
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
import yargs from 'yargs'
|
||||
import fs from 'fs-extra';
|
||||
import { hideBin } from 'yargs/helpers'
|
||||
import { BusinessListing } from "../common-models/src/main.model"
|
||||
// import yargs from 'yargs'
|
||||
// import fs from 'fs-extra';
|
||||
// import { hideBin } from 'yargs/helpers'
|
||||
// import { BusinessListing } from "../common-models/src/main.model"
|
||||
|
||||
const argv = yargs(hideBin(process.argv)).argv
|
||||
// const argv = yargs(hideBin(process.argv)).argv
|
||||
|
||||
if (!argv.userId){
|
||||
console.log(' --userId [any valid userId]')
|
||||
process.exit(1)
|
||||
}
|
||||
// if (!argv.userId){
|
||||
// console.log(' --userId [any valid userId]')
|
||||
// process.exit(1)
|
||||
// }
|
||||
|
||||
(async () => {
|
||||
console
|
||||
const response = await fetch('http://localhost:3000/bizmatch/listings', {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
const listings:Array<BusinessListing> = await response.json();
|
||||
for (const listing of listings) {
|
||||
listing.userId=argv.userId;
|
||||
listing.created=new Date()
|
||||
listing.updated=new Date()
|
||||
const response = await fetch(`http://localhost:3000/bizmatch/listings/${listing.id}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(listing),
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
}
|
||||
})();
|
||||
// (async () => {
|
||||
// console
|
||||
// const response = await fetch('http://localhost:3000/bizmatch/listings', {
|
||||
// method: 'GET',
|
||||
// headers: { 'Content-Type': 'application/json' },
|
||||
// })
|
||||
// const listings:Array<BusinessListing> = await response.json();
|
||||
// for (const listing of listings) {
|
||||
// listing.userId=argv.userId;
|
||||
// listing.created=new Date()
|
||||
// listing.updated=new Date()
|
||||
// const response = await fetch(`http://localhost:3000/bizmatch/listings/${listing.id}`, {
|
||||
// method: 'PUT',
|
||||
// body: JSON.stringify(listing),
|
||||
// headers: { 'Content-Type': 'application/json' },
|
||||
// });
|
||||
// }
|
||||
// })();
|
||||
|
||||
Reference in New Issue
Block a user