rename clients to devices
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ipAllocations, users, wgClients } from './schema';
|
||||
import { ipAllocations, users, devices } from './schema';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import assert from 'node:assert';
|
||||
import { drizzle } from 'drizzle-orm/libsql';
|
||||
@@ -11,10 +11,10 @@ async function seed() {
|
||||
const user = await db.query.users.findFirst({ where: eq(users.username, 'CaZzzer') });
|
||||
assert(user, 'User not found');
|
||||
|
||||
const clients: typeof wgClients.$inferInsert[] = [
|
||||
const newDevices: typeof devices.$inferInsert[] = [
|
||||
{
|
||||
userId: user.id,
|
||||
name: 'Client1',
|
||||
name: 'Device1',
|
||||
publicKey: 'BJ5faPVJsDP4CCxNYilmKnwlQXOtXEOJjqIwb4U/CgM=',
|
||||
privateKey: 'KKqsHDu30WCSrVsyzMkOKbE3saQ+wlx0sBwGs61UGXk=',
|
||||
preSharedKey: '0LWopbrISXBNHUxr+WOhCSAg+0hD8j3TLmpyzHkBHCQ=',
|
||||
@@ -22,10 +22,10 @@ async function seed() {
|
||||
// allowedIps: '10.18.11.101/32,fd00::1/112',
|
||||
},
|
||||
];
|
||||
const returned = await db.insert(wgClients).values(clients).returning({ insertedId: wgClients.id });
|
||||
const returned = await db.insert(devices).values(newDevices).returning({ insertedId: devices.id });
|
||||
|
||||
const ipAllocation: typeof ipAllocations.$inferInsert = {
|
||||
clientId: returned[0].insertedId,
|
||||
deviceId: returned[0].insertedId,
|
||||
};
|
||||
await db.insert(ipAllocations).values(ipAllocation);
|
||||
}
|
||||
|
Reference in New Issue
Block a user