Skip to content

Commit

Permalink
chore: proper formatting for comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed May 22, 2024
1 parent 1f0c7ff commit bbe52ba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
File renamed without changes.
15 changes: 11 additions & 4 deletions src/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@ import { SupabaseClient } from "@supabase/supabase-js";
import { Context } from "../types/context";

export function createAdapters(supabaseClient: SupabaseClient, context: Context) {
void context;
return {
supabase: {
access: {
async getAccess(userId: number) {
const { data } = await supabaseClient.from("users").select().eq("user_id", userId).single();
const { data, error } = await supabaseClient.from("access").select("*, users(*)").eq("users.id", userId).single();
if (error) {
context.logger.error(error.message, error);
return null;
}
return data;
},
},
wallet: {
async getWallet(userId: number) {
const { data } = await supabaseClient.from("users").select("*, wallets(address)").eq("id", userId).single();
return data;
const { data, error } = await supabaseClient.from("users").select("*, wallets(address)").eq("id", userId).single();
if (error) {
context.logger.error("Failed to fetch wallet for user", userId, error);
return null;
}
return data.wallets;
},
},
},
Expand Down
13 changes: 4 additions & 9 deletions src/handlers/query-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,16 @@ User information for ${username} was not found.
} else {
body.push(`
| Property | Value |
-----------|--------
`);
|----------|-------|`);
if (wallet) {
body.push(`
| Wallet | ${wallet.address} |
`);
body.push(`| Wallet | ${wallet.address} |`);
}
if (access) {
body.push(`
| Access | ${access.multiplier_reason} |
`);
body.push(`| Access | ${access.multiplier_reason} |`);
}
}
await octokit.issues.createComment({
body: body.join(""),
body: body.join("\n"),
owner: payload.repository.owner.login,
repo: payload.repository.name,
issue_number: payload.issue.number,
Expand Down

0 comments on commit bbe52ba

Please sign in to comment.