Add API endpoints and frontend components for tool management and analytics
Implement CRUD operations for tools and ratings, introduce analytics endpoints, and develop frontend components for displaying tools, ratings, and analytics data. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 776963d0-f75d-42e2-a57b-cc36bdff8495 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: feaa4ce1-5aed-4cc0-bcea-47855b615b48 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0683fb79-a27c-485c-9333-5f4b288c4567/776963d0-f75d-42e2-a57b-cc36bdff8495/rx9K7bW Replit-Helium-Checkpoint-Created: true
This commit is contained in:
@@ -1,20 +1,2 @@
|
||||
// Export your models here. Add one export per file
|
||||
// export * from "./posts";
|
||||
//
|
||||
// Each model/table should ideally be split into different files.
|
||||
// Each model/table should define a Drizzle table, insert schema, and types:
|
||||
//
|
||||
// import { pgTable, text, serial } from "drizzle-orm/pg-core";
|
||||
// import { createInsertSchema } from "drizzle-zod";
|
||||
// import { z } from "zod/v4";
|
||||
//
|
||||
// export const postsTable = pgTable("posts", {
|
||||
// id: serial("id").primaryKey(),
|
||||
// title: text("title").notNull(),
|
||||
// });
|
||||
//
|
||||
// export const insertPostSchema = createInsertSchema(postsTable).omit({ id: true });
|
||||
// export type InsertPost = z.infer<typeof insertPostSchema>;
|
||||
// export type Post = typeof postsTable.$inferSelect;
|
||||
|
||||
export {}
|
||||
export * from "./tools";
|
||||
export * from "./ratings";
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { pgTable, text, serial, integer, timestamp } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { z } from "zod/v4";
|
||||
import { toolsTable } from "./tools";
|
||||
|
||||
export const ratingsTable = pgTable("ratings", {
|
||||
id: serial("id").primaryKey(),
|
||||
toolId: integer("tool_id").notNull().references(() => toolsTable.id, { onDelete: "cascade" }),
|
||||
usefulness: integer("usefulness").notNull(),
|
||||
usability: integer("usability").notNull(),
|
||||
comment: text("comment"),
|
||||
reviewerName: text("reviewer_name"),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
});
|
||||
|
||||
export const insertRatingSchema = createInsertSchema(ratingsTable).omit({ id: true, createdAt: true });
|
||||
export type InsertRating = z.infer<typeof insertRatingSchema>;
|
||||
export type Rating = typeof ratingsTable.$inferSelect;
|
||||
@@ -0,0 +1,19 @@
|
||||
import { pgTable, text, serial, timestamp } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const toolsTable = pgTable("tools", {
|
||||
id: serial("id").primaryKey(),
|
||||
name: text("name").notNull(),
|
||||
description: text("description").notNull(),
|
||||
category: text("category").notNull(),
|
||||
websiteUrl: text("website_url"),
|
||||
features: text("features").array().notNull().default([]),
|
||||
tags: text("tags").array().notNull().default([]),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),
|
||||
});
|
||||
|
||||
export const insertToolSchema = createInsertSchema(toolsTable).omit({ id: true, createdAt: true, updatedAt: true });
|
||||
export type InsertTool = z.infer<typeof insertToolSchema>;
|
||||
export type Tool = typeof toolsTable.$inferSelect;
|
||||
Reference in New Issue
Block a user