New gyoza, with new backend and up to date frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
1.1 KiB

const PocketBase = require('pocketbase').default
// Initialize the PocketBase client
// const pb = new PocketBase('https://stock.hfsplay.fr')
const pb = new PocketBase('http://127.0.0.1:8090')
async function main () {
try {
// Authenticate as an admin
// await pb.admins.authWithPassword('gyoza@hfsplay.fr', 'gyozagyoza') // Replace with your admin credentials
await pb.collection('_superusers').authWithPassword('karkinge@gmail.com', 'k4rk1ng3*') // Replace with your admin credentials
console.log('connected !')
let stock = await pb.collection('stock').getFullList({
sort: 'created'
})
console.log('Stock items count:', stock.length)
for (let i = 0; i < stock.length; i++) {
const item = stock[i]
if (!item) continue
// Update the item with a new ID
const updatedItem = await pb.collection('stock').update(item.id, {
short_id: i + 1 // Adjust the ID as needed
})
console.log(`Updated item ${item.id} to new ID ${updatedItem.id}`)
}
} catch (error) {
console.error('Error:', error)
}
}
main()