BinCode/db/queries.js

33 lines
657 B
JavaScript
Raw Normal View History

2025-01-17 20:05:21 +00:00
const snippetQueries = {
insert: `
INSERT INTO snippets (id, user_id, title, html, css, js, share_id)
VALUES (?, ?, ?, ?, ?, ?, ?)
`,
getUserSnippets: `
SELECT * FROM snippets
WHERE user_id = ?
ORDER BY created_at DESC
`,
getByShareId: `
SELECT html, css, js, title
FROM snippets
WHERE share_id = ?
`
};
const userQueries = {
findByEmail: `
SELECT * FROM users
WHERE email = ?
`,
insert: `
INSERT INTO users (id, email, password)
VALUES (?, ?, ?)
`
};
module.exports = {
snippets: snippetQueries,
users: userQueries
};