Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding 'faucet' namespace to SQL queries #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/api/getbalances/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const GET = async (_req: Request) => {
});

const result = await pgClient.query(
"SELECT account, balance, date FROM solana_balances WHERE date >= CURRENT_DATE - INTERVAL '1 month' ORDER BY date ",
"SELECT account, balance, date FROM faucet.solana_balances WHERE date >= CURRENT_DATE - INTERVAL '1 month' ORDER BY date ",
);

return new Response(
Expand Down
2 changes: 1 addition & 1 deletion app/api/monitorfaucet/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const GET = async (_req: Request) => {

// Insert the balance and current date into the database
await pgClient.query(
"INSERT INTO solana_balances (account, balance, date) VALUES ($1, $2, $3)",
"INSERT INTO faucet.solana_balances (account, balance, date) VALUES ($1, $2, $3)",
[account.toString(), balance, new Date()],
);
}
Expand Down
6 changes: 3 additions & 3 deletions app/api/request/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ const getOrCreateAndVerifyDatabaseEntry = async (
key: string,
rateLimit: AirdropRateLimit,
) => {
const entryQuery = "SELECT * FROM rate_limits WHERE key = $1;";
const entryQuery = "SELECT * FROM faucet.rate_limits WHERE key = $1;";
const insertQuery =
"INSERT INTO rate_limits (key, timestamps) VALUES ($1, $2);";
const updateQuery = "UPDATE rate_limits SET timestamps = $2 WHERE key = $1;";
"INSERT INTO faucet.rate_limits (key, timestamps) VALUES ($1, $2);";
const updateQuery = "UPDATE faucet.rate_limits SET timestamps = $2 WHERE key = $1;";

const timeAgo = Date.now() - rateLimit.coveredHours * (60 * 60 * 1000);

Expand Down