feat: add plaid sync
This commit is contained in:
@@ -13,6 +13,6 @@
|
||||
},
|
||||
"scripts": {
|
||||
"db:gen": "drizzle-zero generate -s ./src/db/schema/public.ts -o ./src/zero-schema.gen.ts -f && sed -i 's/enableLegacyQueries: true,/enableLegacyQueries: false,/g' src/zero-schema.gen.ts && sed -i 's/enableLegacyMutators: true,/enableLegacyMutators: false,/g' src/zero-schema.gen.ts",
|
||||
"db:migrate": "drizzle-kit push"
|
||||
"db:push": "drizzle-kit push"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ export const plaidAccessTokens = pgTable("plaidAccessToken", {
|
||||
logoUrl: text("logoUrl").notNull(),
|
||||
userId: text("user_id").notNull(),
|
||||
token: text("token").notNull(),
|
||||
syncCursor: text("sync_cursor"),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
});
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ export function createMutators(authData: AuthData | null) {
|
||||
link: {
|
||||
async create() {},
|
||||
async get(tx: Tx, { link_token }: { link_token: string }) {},
|
||||
async updateTransactions() {},
|
||||
async updateBalences() {},
|
||||
async webhook() {},
|
||||
async sync() {},
|
||||
// async updateTransactions() {},
|
||||
// async updateBalences() {},
|
||||
async deleteAccounts(tx: Tx, { accountIds }: { accountIds: string[] }) {
|
||||
isLoggedIn(authData);
|
||||
for (const id of accountIds) {
|
||||
|
||||
@@ -345,6 +345,16 @@ export const schema = {
|
||||
"token"
|
||||
>,
|
||||
},
|
||||
syncCursor: {
|
||||
type: "string",
|
||||
optional: true,
|
||||
customType: null as unknown as ZeroCustomType<
|
||||
ZeroSchema,
|
||||
"plaidAccessTokens",
|
||||
"syncCursor"
|
||||
>,
|
||||
serverName: "sync_cursor",
|
||||
},
|
||||
createdAt: {
|
||||
type: "number",
|
||||
optional: true,
|
||||
|
||||
Reference in New Issue
Block a user