-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from digidem/background-jobs
feat: add basic background jobs #9
- Loading branch information
Showing
40 changed files
with
1,320 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.11 |
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
PORT=3001 | ||
PORT=3040 | ||
REMIX_APP_PORT=3030 | ||
|
||
NODE_ENV=production | ||
|
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 |
---|---|---|
|
@@ -34,9 +34,10 @@ | |
"@biomejs/biome": "1.9.4", | ||
"@t3-oss/env-nextjs": "^0.11.1", | ||
"lefthook": "^1.8.2", | ||
"tsc-files": "^1.1.4", | ||
"turbo": "^2.2.3", | ||
"typescript": "^5.6.3" | ||
}, | ||
"packageManager": "[email protected].33", | ||
"packageManager": "[email protected].34", | ||
"private": true | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { z } from "zod"; | ||
|
||
// Define specific types for meta values | ||
const metaValueSchema = z.union([ | ||
z.string(), | ||
z.number(), | ||
z.boolean(), | ||
z.null(), | ||
z.array(z.union([z.string(), z.number(), z.boolean(), z.null()])), | ||
z.record( | ||
z.string(), | ||
z.union([z.string(), z.number(), z.boolean(), z.null()]), | ||
), | ||
]); | ||
|
||
export const querySchema = z | ||
.object({ | ||
userId: z.string().optional(), | ||
limit: z.number().int().min(0).optional(), | ||
offset: z.number().int().min(0).optional(), | ||
status: z.enum(["open", "closed", "draft"]).optional(), | ||
focusArea: z.string().optional(), | ||
minAmount: z.number().min(0).optional(), | ||
maxAmount: z.number().min(0).optional(), | ||
}) | ||
.refine( | ||
(data) => | ||
!data.minAmount || !data.maxAmount || data.maxAmount >= data.minAmount, | ||
{ message: "maxAmount must be greater than or equal to minAmount" }, | ||
); | ||
|
||
export const saveGrantCallSchema = z.object({ | ||
id: z.string().optional(), | ||
title: z.string(), | ||
description: z.string(), | ||
organization: z.string(), | ||
funding_amount: z.number().min(0), | ||
deadline: z.string(), | ||
focus_areas: z.array(z.string()), | ||
eligibility_criteria: z.array(z.string()), | ||
requirements: z.array(z.string()), | ||
status: z.enum(["open", "closed", "draft"]), | ||
meta: z.record(z.string(), metaValueSchema).optional(), | ||
}); | ||
|
||
export type MetaValue = | ||
| string | ||
| number | ||
| boolean | ||
| null | ||
| Array<string | number | boolean | null> | ||
| Record<string, string | number | boolean | null>; | ||
|
||
export type GrantCallResult = { | ||
id: string; | ||
title: string; | ||
description: string; | ||
organization: string; | ||
funding_amount: number; | ||
deadline: string; | ||
focus_areas: string[]; | ||
eligibility_criteria: string[]; | ||
requirements: string[]; | ||
status: "open" | "closed" | "draft"; | ||
meta?: Record<string, MetaValue>; | ||
}; |
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,55 @@ | ||
import { z } from "zod"; | ||
|
||
// Define specific types for meta values | ||
const metaValueSchema = z.union([ | ||
z.string(), | ||
z.number(), | ||
z.boolean(), | ||
z.null(), | ||
z.array(z.union([z.string(), z.number(), z.boolean(), z.null()])), | ||
z.record( | ||
z.string(), | ||
z.union([z.string(), z.number(), z.boolean(), z.null()]), | ||
), | ||
]); | ||
|
||
// Query schema for getting profiles | ||
export const querySchema = z.object({ | ||
userId: z.string().optional(), | ||
biome: z.string().optional(), | ||
ethnicGroup: z.string().optional(), | ||
territory: z.string().optional(), | ||
community: z.string().optional(), | ||
limit: z.number().int().min(0).optional(), | ||
offset: z.number().int().min(0).optional(), | ||
}); | ||
|
||
// Schema for saving profiles | ||
export const saveProfileSchema = z.object({ | ||
id: z.string().optional(), | ||
userId: z.string().min(1), | ||
biome: z.string().min(1), | ||
ethnicGroup: z.string().min(1), | ||
territory: z.string().min(1), | ||
community: z.string().min(1), | ||
meta: z.record(z.string(), metaValueSchema).optional(), | ||
}); | ||
|
||
export type MetaValue = | ||
| string | ||
| number | ||
| boolean | ||
| null | ||
| Array<string | number | boolean | null> | ||
| Record<string, string | number | boolean | null>; | ||
|
||
export type ProfileResult = { | ||
id: string; | ||
user_id: string; | ||
biome: string; | ||
ethnic_group: string; | ||
territory: string; | ||
community: string; | ||
meta?: Record<string, MetaValue>; | ||
created_at: string; | ||
}; |
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,43 @@ | ||
import { z } from "zod"; | ||
|
||
export const querySchema = z | ||
.object({ | ||
userId: z.string().optional(), | ||
limit: z.number().int().min(0).optional(), | ||
offset: z.number().int().min(0).optional(), | ||
fromTimestamp: z.number().min(0).optional(), | ||
toTimestamp: z.number().min(0).optional(), | ||
}) | ||
.refine( | ||
(data) => | ||
!data.fromTimestamp || | ||
!data.toTimestamp || | ||
data.toTimestamp >= data.fromTimestamp, | ||
{ message: "toTimestamp must be greater than or equal to fromTimestamp" }, | ||
); | ||
|
||
export const messageSchema = z.object({ | ||
id: z.string(), | ||
_id: z.string(), | ||
from: z.string(), | ||
to: z.string(), | ||
userId: z.string(), | ||
data: z.object({ | ||
text: z.string(), | ||
}), | ||
timestamp: z.number(), | ||
type: z.string(), | ||
isGroupChat: z.boolean(), | ||
chatId: z.string(), | ||
created: z.string(), | ||
}); | ||
|
||
export type MessageResult = { | ||
id: string; | ||
user_id: string; | ||
text: string; | ||
timestamp: number; | ||
processed: boolean; | ||
meta: Record<string, unknown>; | ||
created_at: string; | ||
}; |
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,47 @@ | ||
import { z } from "zod"; | ||
|
||
export const querySchema = z | ||
.object({ | ||
userId: z.string().optional(), | ||
limit: z.number().int().min(0).optional(), | ||
offset: z.number().int().min(0).optional(), | ||
fromTimestamp: z.number().min(0).optional(), | ||
toTimestamp: z.number().min(0).optional(), | ||
processed: z.boolean().optional(), | ||
}) | ||
.refine( | ||
(data) => | ||
!data.fromTimestamp || | ||
!data.toTimestamp || | ||
data.toTimestamp >= data.fromTimestamp, | ||
{ message: "toTimestamp must be greater than or equal to fromTimestamp" }, | ||
); | ||
|
||
const metaValueSchema = z.union([ | ||
z.string(), | ||
z.number(), | ||
z.boolean(), | ||
z.null(), | ||
z.array(z.union([z.string(), z.number(), z.boolean(), z.null()])), | ||
z.record( | ||
z.string(), | ||
z.union([z.string(), z.number(), z.boolean(), z.null()]), | ||
), | ||
]); | ||
|
||
const messageSchema = z.object({ | ||
userId: z.string().min(1), | ||
text: z.string().min(1), | ||
timestamp: z.number(), | ||
meta: z.record(z.string(), metaValueSchema).optional(), | ||
}); | ||
|
||
export type MetaValue = | ||
| string | ||
| number | ||
| boolean | ||
| null | ||
| Array<string | number | boolean | null> | ||
| Record<string, string | number | boolean | null>; | ||
|
||
export { messageSchema }; |
Oops, something went wrong.