feat: add leaderboard category

This commit is contained in:
2024-08-09 20:33:07 +07:00
parent e8ed08d49b
commit a5cd6383f3
33 changed files with 744 additions and 277 deletions
@@ -9,6 +9,8 @@ CREATE TABLE `repositories` (
`last_update` text NOT NULL,
`languages` text,
`contributors` text,
`is_pending` integer DEFAULT false NOT NULL,
`is_error` integer DEFAULT false NOT NULL,
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_at` text NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
+17 -1
View File
@@ -1,7 +1,7 @@
{
"version": "6",
"dialect": "sqlite",
"id": "891041fb-3c81-46b0-ac5a-cd85a640fe8c",
"id": "13d859a6-4c32-46a6-90e9-19740b2bb13a",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"repositories": {
@@ -77,6 +77,22 @@
"notNull": false,
"autoincrement": false
},
"is_pending": {
"name": "is_pending",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"is_error": {
"name": "is_error",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"created_at": {
"name": "created_at",
"type": "text",
+2 -2
View File
@@ -5,8 +5,8 @@
{
"idx": 0,
"version": "6",
"when": 1723077872529,
"tag": "0000_medical_magma",
"when": 1723210265266,
"tag": "0000_young_emma_frost",
"breakpoints": true
}
]
+3 -6
View File
@@ -3,7 +3,6 @@ import db from ".";
import logger from "../lib/logger";
import { sql } from "drizzle-orm";
import { faker } from "@faker-js/faker";
import queue from "@server/lib/queue";
const seed = async () => {
logger.info("🌿 Seeding database...");
@@ -11,9 +10,9 @@ const seed = async () => {
await db.transaction(async (tx) => {
tx.run(sql`DELETE FROM users`);
await tx
.insert(users)
.values({ username: "khairul169", name: "Khairul Hidayat" });
// await tx
// .insert(users)
// .values({ username: "khairul169", name: "Khairul Hidayat" });
await tx.insert(users).values(
[...Array(50)].map(() => ({
@@ -29,8 +28,6 @@ const seed = async () => {
);
});
await queue.add("fetchUserProfile", { userId: 1 });
logger.info("🌱 Database seeded");
process.exit();