-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧 customers crud - add status field, enable seed and query routes
- Loading branch information
1 parent
9737805
commit f4df377
Showing
6 changed files
with
47 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,36 +15,49 @@ const customers = [ | |
name: 'Evil Rabbit', | ||
email: '[email protected]', | ||
image_url: '/customers/evil-rabbit.png', | ||
status: 'active', | ||
}, | ||
{ | ||
id: '3958dc9e-712f-4377-85e9-fec4b6a6442a', | ||
name: 'Delba de Oliveira', | ||
email: '[email protected]', | ||
image_url: '/customers/delba-de-oliveira.png', | ||
status: 'active', | ||
}, | ||
{ | ||
id: '3958dc9e-742f-4377-85e9-fec4b6a6442a', | ||
name: 'Lee Robinson', | ||
email: '[email protected]', | ||
image_url: '/customers/lee-robinson.png', | ||
status: 'active', | ||
}, | ||
{ | ||
id: '76d65c26-f784-44a2-ac19-586678f7c2f2', | ||
name: 'Michael Novotny', | ||
email: '[email protected]', | ||
image_url: '/customers/michael-novotny.png', | ||
status: 'active', | ||
}, | ||
{ | ||
id: 'CC27C14A-0ACF-4F4A-A6C9-D45682C144B9', | ||
name: 'Amy Burns', | ||
email: '[email protected]', | ||
image_url: '/customers/amy-burns.png', | ||
status: 'active', | ||
}, | ||
{ | ||
id: '13D07535-C59E-4157-A011-F8D2EF4E0CBB', | ||
name: 'Balazs Orban', | ||
email: '[email protected]', | ||
image_url: '/customers/balazs-orban.png', | ||
status: 'active', | ||
}, | ||
{ | ||
id: '15D07535-C79E-4157-A031-F8D2EF4E0CBB', | ||
name: 'Kind Rabbit', | ||
email: '[email protected]', | ||
image_url: '/customers/kind-rabbit.png', | ||
status: 'deleted', | ||
}, | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { db } from '@vercel/postgres'; | ||
|
||
const client = await db.connect(); | ||
|
||
// TODO edit somehow data, drop or migration | ||
async function listInvoices() { | ||
// const data = await client.sql` | ||
// SELECT invoices.amount, customers.name | ||
// FROM invoices | ||
// JOIN customers ON invoices.customer_id = customers.id | ||
// WHERE invoices.amount = 666; | ||
// `; | ||
const data = await client.sql` | ||
DROP table customers; | ||
`; | ||
|
||
return data; | ||
} | ||
|
||
export async function GET() { | ||
try { | ||
Response.json(await listInvoices()); | ||
} catch (error) { | ||
return Response.json({ error }, { status: 500 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.