Skip to content

Commit

Permalink
fix: Use domain field instead of one in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR committed Oct 10, 2024
1 parent 2313dac commit 47dc4da
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/graphql/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function checkLimits(args: any = {}, type) {
export function formatSpace({
id,
settings,
domain,
verified,
turbo,
flagged,
Expand All @@ -72,6 +73,7 @@ export function formatSpace({
const space = { ...jsonParse(settings, {}), ...spaceMetadata.counts };

space.id = id;
space.domain = domain || '';
space.private = space.private || false;
space.avatar = space.avatar || '';
space.about = space.about || '';
Expand Down Expand Up @@ -403,6 +405,7 @@ export function formatProposal(proposal) {
proposal.space = formatSpace({
id: proposal.space,
settings: proposal.settings,
domain: proposal.spaceDomain,
verified: proposal.spaceVerified,
turbo: proposal.spaceTurbo,
flagged: proposal.spaceFlagged,
Expand All @@ -426,6 +429,7 @@ export function formatVote(vote) {
vote.vp_by_strategy = jsonParse(vote.vp_by_strategy, []);
vote.space = formatSpace({
id: vote.space,
domain: vote.spaceDomain,
settings: vote.settings,
verified: vote.spaceVerified,
turbo: vote.spaceTurbo,
Expand All @@ -439,6 +443,7 @@ export function formatFollow(follow) {
follow.space = formatSpace({
id: follow.space,
settings: follow.settings,
domain: follow.spaceDomain,
verified: follow.spaceVerified,
turbo: follow.spaceTurbo,
flagged: follow.spaceFlagged,
Expand All @@ -451,6 +456,7 @@ export function formatSubscription(subscription) {
subscription.space = formatSpace({
id: subscription.space,
settings: subscription.settings,
domain: subscription.spaceDomain,
verified: subscription.spaceVerified,
turbo: subscription.spaceTurbo,
flagged: subscription.spaceFlagged,
Expand Down
1 change: 1 addition & 0 deletions src/graphql/operations/follows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default async function (parent, args) {
const query = `
SELECT f.*,
spaces.settings,
spaces.domain as spaceDomain,
spaces.flagged as spaceFlagged,
spaces.verified as spaceVerified,
spaces.turbo as spaceTurbo,
Expand Down
1 change: 1 addition & 0 deletions src/graphql/operations/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default async function (parent, { id }) {
const query = `
SELECT p.*,
spaces.settings,
spaces.domain as spaceDomain,
spaces.flagged as spaceFlagged,
spaces.verified as spaceVerified,
spaces.turbo as spaceTurbo,
Expand Down
1 change: 1 addition & 0 deletions src/graphql/operations/proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export default async function (parent, args) {
const query = `
SELECT p.*,
spaces.settings,
spaces.domain as spaceDomain,
spaces.flagged as spaceFlagged,
spaces.verified as spaceVerified,
spaces.turbo as spaceTurbo,
Expand Down
1 change: 1 addition & 0 deletions src/graphql/operations/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default async function (parent, args) {
const query = `
SELECT s.*,
spaces.settings,
spaces.domain as spaceDomain,
spaces.flagged as spaceFlagged,
spaces.verified as spaceVerified,
spaces.turbo as spaceTurbo,
Expand Down
1 change: 1 addition & 0 deletions src/graphql/operations/votes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ async function query(parent, args, context?, info?) {
const query = `
SELECT p.*,
spaces.settings,
spaces.domain as spaceDomain,
spaces.flagged as spaceFlagged,
spaces.verified as spaceVerified,
spaces.turbo as spaceTurbo,
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ async function loadSpacesMetrics() {

export async function getSpace(id: string) {
const query = `
SELECT settings, flagged, verified, turbo, hibernated, deleted, follower_count, proposal_count, vote_count
SELECT settings, domain, flagged, verified, turbo, hibernated, deleted, follower_count, proposal_count, vote_count
FROM spaces
WHERE id = ?
LIMIT 1`;
Expand All @@ -279,6 +279,7 @@ export async function getSpace(id: string) {

return {
...JSON.parse(space.settings),
domain: space.domain,
flagged: space.flagged === 1,
verified: space.verified === 1,
turbo: space.turbo === 1,
Expand Down

0 comments on commit 47dc4da

Please sign in to comment.