Skip to content

Commit

Permalink
πŸ’» mocked project routes (#242)
Browse files Browse the repository at this point in the history
* πŸ’» add route for fetching projects by round
* πŸ’» add /rf/rounds/[id]/projects
* πŸ” πŸ’» drop extraneous fields on team member; add farcasterId
* πŸ’» update default team with farcasterId
* πŸ’» return default team
  • Loading branch information
Flip-Liquid authored Apr 23, 2024
1 parent 1158013 commit 941bdab
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 25 deletions.
58 changes: 33 additions & 25 deletions spec/oas_v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -622,21 +622,23 @@ components:
A team member on a RetroFunding project.
type: object
properties:
address:
summary: EOA address of the team member
type: string
name:
type: string
description:
type: string
socialLinks:
$ref: "#/components/schemas/SocialLinks"
externalLink:
type: string
avatarUrls:
type: array
items:
type: string
# address:
# summary: EOA address of the team member
# type: string
# name:
# type: string
# description:
# type: string
farcasterId:
summary: Farcaster ID for project team member
desription: Farcaster ID for project team member.
type: string
# externalLink:
# type: string
# avatarUrls:
# type: array
# items:
# type: string
RetroFundingCategory:
summary: A category for an RetroFunding project
description: >
Expand Down Expand Up @@ -707,18 +709,24 @@ components:
type: object
properties:
ventureCapital:
$ref: "#/components/schemas/FundingInfo"
type: array
items:
$ref: "#/components/schemas/FundingInfo"
grants:
$ref: "#/components/schemas/FundingInfo"
type: array
items:
$ref: "#/components/schemas/FundingInfo"
optimismGrants:
allOf:
- $ref: "#/components/schemas/FundingInfo"
- type: object
properties:
link:
type: string
type:
$ref: "#/components/schemas/OptimismGrantType"
type: array
items:
allOf:
- $ref: "#/components/schemas/FundingInfo"
- type: object
properties:
link:
type: string
type:
$ref: "#/components/schemas/OptimismGrantType"
SocialLinks:
summary: Social media links for a project
description: >
Expand Down
93 changes: 93 additions & 0 deletions src/app/api/common/projects/getProjects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { cache } from "react";

async function getProjectsApi() {
const pageMetadata = {
hasNext: true,
totalReturned: 1,
nextOffset: 1,
};
const defaultSocialLinks = {
twitter: "@flip_liquide",
farcaster: "@flip-liquid",
mirror: "",
website: "flipliquid.xyz",
};

const defaultTeam = [
{
farcasterId: defaultSocialLinks.farcaster,
},
];

const defaultVCFunding = [
{
amount: "1000000000 Double Dollars",
source: "Weyland-Yutani Venture Capital",
date: "2024-04-20",
details: "Seed round",
},
];

const defaultDeployedContracts = [
{
address: "0xcDF27F107725988f2261Ce2256bDfCdE8B382B10",
chainId: "10",
deployer: "0x42004661285881D4B0F245B1eD3774d8166CF314",
creationBlock: "71801427",
transactionId:
"0x6ff5f386e46b2fb0099a78429ecd104f552fe545c65d51068098211d8b11560d",
verificationProof: "trust me ;)",
openSourceObserverSlug: "---",
},
];
const defaultOptiGrants = [
{
amount: "2000000000 OP",
source: "OP Foundation",
date: "2024-04-20",
details: "Great job!",
link: "---",
type: "DEVELOPMENT",
},
];
const defaultGrants = [
{
amount: "100 ETH",
source: "Ethereum Foundation",
date: "2024-04-20",
details: "For being nice with it",
},
];
const defaultFunding = {
ventureCapital: defaultVCFunding,
grants: defaultGrants,
optimismGrants: defaultOptiGrants,
};
const defaultCategories = [
{
name: "string",
description: "string",
},
];
const defaultProject = {
avatarUrl: "string",
coverImageUrl: "string",
attestationUid: "string",
approvalAttestationUid: "string",
name: "string",
description: "string",
externalLink: "string",
socialLinks: defaultSocialLinks,
team: defaultTeam,
repositories: ["https://github.com/voteagora/agora-next"],
deployedContracts: defaultDeployedContracts,
categories: defaultCategories,
funding: defaultFunding,
};
return {
metadata: pageMetadata,
projects: [defaultProject],
};
}

export const fetchProjectsApi = cache(getProjectsApi);
8 changes: 8 additions & 0 deletions src/app/api/v1/projects/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { fetchProjectsApi } from "@/app/api/common/projects/getProjects";

export async function GET(request: Request) {
const projects = await fetchProjectsApi();
return new Response(JSON.stringify(projects), {
status: 200,
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { fetchProjectsApi } from "@/app/api/common/projects/getProjects";

export async function GET(request: Request) {
const projects = await fetchProjectsApi();
return new Response(JSON.stringify(projects), {
status: 200,
});
}
8 changes: 8 additions & 0 deletions src/app/api/v1/rounds/[roundId]/projects/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { fetchProjectsApi } from "@/app/api/common/projects/getProjects";

export async function GET(request: Request) {
const projects = await fetchProjectsApi();
return new Response(JSON.stringify(projects), {
status: 200,
});
}

0 comments on commit 941bdab

Please sign in to comment.