-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make basic auth backend for siwe * remove graphprotocol package * yarn * use jose instead of jsonwebtoken * wip siwe frontend * fix es-lint * try use node util with compatibility flag * just not import TextEncoder * add contenet type headers * update client to call auth server * update dev DO instance * add test endpoint * test cookie * handle error on nonce * wrap auth endpoints in try-catch * add missing response statements * await on jwt sign * fix jwt algo * fix sign out endpoint * fix proxy * try resolve bigint ** to Math.pow() errir * refactor auth api * set JWT_SECRET as env variable * update api endpoints on FE * add error response on absent cookie * await on response * fix path split * do not unwrap payload for get requests * fix path * fix proxy * setup test ennvironment * add postgres * add ballot service & get ballot * save ballot * set update_at field on ballot save * add likesService and like * get likes * get all likes * add nullable to serde * fix bytes type on typechain * index attestations * fix followChain init in workers * remove console.log * remove console.logs * add topics filter for local fetch * add comment on topics filter * update attestation schema: split into own entities * update filter defnition * basic resolver for attestations * fix fakeLogProvider types * fix retroPGF schema * fix tests * use prisma instead of pg * remove postgres query * run prisma migrate for remote dev db * set prisma db url dynamically * configure ballot routes in workers * log more data in error response * don't log prisma instance * log prisma connection * log prisma connection to sentry * log more data * use prisma edge client * log connection url * remove unnecessary logs * add like routes to workers * remove unused import * use PostgresSingleton the way it's supposed to * import Prisma from prisma edge * fix ballotService init * remove unused * add request wrappers * fix authWrap type * fix authWrap * fix path parsing * handler types * debug * cleanup * cleanup * fix path parsing * naming * fix handlers * wrap veryfy token block * remove loser comments * fix sign on FE after view upgrade * add signature column to ballots * add submit ballot endpoint * get address from the payload * fix error response * setup provider in handler * wrap submit request * split query
- Loading branch information
Showing
54 changed files
with
3,031 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/backend/prisma/migrations/20230920145206_init/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- CreateTable | ||
CREATE TABLE "ballots" ( | ||
"address" TEXT NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3), | ||
"published_at" TIMESTAMP(3), | ||
"votes" JSONB NOT NULL DEFAULT '[]', | ||
|
||
CONSTRAINT "ballots_pkey" PRIMARY KEY ("address") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "likes" ( | ||
"id" TEXT NOT NULL, | ||
"addresses" TEXT[] DEFAULT ARRAY[]::TEXT[], | ||
"last_updated" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "likes_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "ballots_address_key" ON "ballots"("address"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "likes_id_key" ON "likes"("id"); |
2 changes: 2 additions & 0 deletions
2
packages/backend/prisma/migrations/20230921192003_added_signature_to_ballots/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "ballots" ADD COLUMN "signature" TEXT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
model Ballot { | ||
address String @id @unique | ||
createdAt DateTime @default(now()) @map("created_at") | ||
updatedAt DateTime? @map("updated_at") | ||
publishedAt DateTime? @map("published_at") | ||
votes Json @default("[]") @db.JsonB | ||
signature String? @map("signature") | ||
@@map("ballots") | ||
} | ||
|
||
model Like { | ||
id String @id @unique | ||
addresses String[] @default([]) | ||
lastUpdated DateTime @default(now()) @map("last_updated") | ||
@@map("likes") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import express from "express"; | ||
import { createProxyMiddleware } from "http-proxy-middleware"; | ||
|
||
export function startProxyServer() { | ||
const app = express(); | ||
|
||
app.use( | ||
"/graphql", | ||
createProxyMiddleware({ | ||
target: "http://0.0.0.0:4002/", | ||
changeOrigin: true, | ||
}) | ||
); | ||
app.use( | ||
"/api", | ||
createProxyMiddleware({ | ||
target: "http://0.0.0.0:4003/", | ||
changeOrigin: true, | ||
}) | ||
); | ||
|
||
app.listen(4001); | ||
} |
Oops, something went wrong.