mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
feat(cli): add alchemy and improve cli tooling and structure (#520)
This commit is contained in:
8
packages/backend/convex/_generated/api.d.ts
vendored
8
packages/backend/convex/_generated/api.d.ts
vendored
@@ -9,8 +9,12 @@
|
||||
*/
|
||||
|
||||
import type * as healthCheck from "../healthCheck.js";
|
||||
import type * as hooks from "../hooks.js";
|
||||
import type * as http from "../http.js";
|
||||
import type * as showcase from "../showcase.js";
|
||||
import type * as sponsors from "../sponsors.js";
|
||||
import type * as stats from "../stats.js";
|
||||
import type * as testimonials from "../testimonials.js";
|
||||
|
||||
import type {
|
||||
ApiFromModules,
|
||||
@@ -28,8 +32,12 @@ import type {
|
||||
*/
|
||||
declare const fullApi: ApiFromModules<{
|
||||
healthCheck: typeof healthCheck;
|
||||
hooks: typeof hooks;
|
||||
http: typeof http;
|
||||
showcase: typeof showcase;
|
||||
sponsors: typeof sponsors;
|
||||
stats: typeof stats;
|
||||
testimonials: typeof testimonials;
|
||||
}>;
|
||||
declare const fullApiWithMounts: typeof fullApi;
|
||||
|
||||
|
||||
@@ -8,29 +8,29 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { AnyDataModel } from "convex/server";
|
||||
import type {
|
||||
DataModelFromSchemaDefinition,
|
||||
DocumentByName,
|
||||
TableNamesInDataModel,
|
||||
SystemTableNames,
|
||||
} from "convex/server";
|
||||
import type { GenericId } from "convex/values";
|
||||
|
||||
/**
|
||||
* No `schema.ts` file found!
|
||||
*
|
||||
* This generated code has permissive types like `Doc = any` because
|
||||
* Convex doesn't know your schema. If you'd like more type safety, see
|
||||
* https://docs.convex.dev/using/schemas for instructions on how to add a
|
||||
* schema file.
|
||||
*
|
||||
* After you change a schema, rerun codegen with `npx convex dev`.
|
||||
*/
|
||||
import schema from "../schema.js";
|
||||
|
||||
/**
|
||||
* The names of all of your Convex tables.
|
||||
*/
|
||||
export type TableNames = string;
|
||||
export type TableNames = TableNamesInDataModel<DataModel>;
|
||||
|
||||
/**
|
||||
* The type of a document stored in Convex.
|
||||
*
|
||||
* @typeParam TableName - A string literal type of the table name (like "users").
|
||||
*/
|
||||
export type Doc = any;
|
||||
export type Doc<TableName extends TableNames> = DocumentByName<
|
||||
DataModel,
|
||||
TableName
|
||||
>;
|
||||
|
||||
/**
|
||||
* An identifier for a document in Convex.
|
||||
@@ -42,8 +42,10 @@ export type Doc = any;
|
||||
*
|
||||
* IDs are just strings at runtime, but this type can be used to distinguish them from other
|
||||
* strings when type checking.
|
||||
*
|
||||
* @typeParam TableName - A string literal type of the table name (like "users").
|
||||
*/
|
||||
export type Id<TableName extends TableNames = TableNames> =
|
||||
export type Id<TableName extends TableNames | SystemTableNames> =
|
||||
GenericId<TableName>;
|
||||
|
||||
/**
|
||||
@@ -55,4 +57,4 @@ export type Id<TableName extends TableNames = TableNames> =
|
||||
* This type is used to parameterize methods like `queryGeneric` and
|
||||
* `mutationGeneric` to make them type-safe.
|
||||
*/
|
||||
export type DataModel = AnyDataModel;
|
||||
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
|
||||
|
||||
4
packages/backend/convex/hooks.ts
Normal file
4
packages/backend/convex/hooks.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { useQueries } from "convex/react";
|
||||
import { makeUseQueryWithStatus } from "convex-helpers/react";
|
||||
|
||||
export const useQueryWithStatus = makeUseQueryWithStatus(useQueries);
|
||||
39
packages/backend/convex/schema.ts
Normal file
39
packages/backend/convex/schema.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { defineSchema, defineTable } from "convex/server";
|
||||
import { v } from "convex/values";
|
||||
|
||||
export default defineSchema({
|
||||
sponsors: defineTable({
|
||||
sponsor: v.object({
|
||||
login: v.string(),
|
||||
name: v.string(),
|
||||
avatarUrl: v.string(),
|
||||
websiteUrl: v.optional(v.string()),
|
||||
linkUrl: v.string(),
|
||||
customLogoUrl: v.optional(v.string()),
|
||||
type: v.string(),
|
||||
}),
|
||||
isOneTime: v.boolean(),
|
||||
monthlyDollars: v.number(),
|
||||
privacyLevel: v.string(),
|
||||
tierName: v.string(),
|
||||
createdAt: v.string(),
|
||||
provider: v.string(),
|
||||
}),
|
||||
|
||||
videos: defineTable({
|
||||
embedId: v.string(),
|
||||
title: v.string(),
|
||||
}),
|
||||
|
||||
tweets: defineTable({
|
||||
tweetId: v.string(),
|
||||
}),
|
||||
|
||||
showcase: defineTable({
|
||||
title: v.string(),
|
||||
description: v.string(),
|
||||
imageUrl: v.string(),
|
||||
liveUrl: v.string(),
|
||||
tags: v.array(v.string()),
|
||||
}),
|
||||
});
|
||||
20
packages/backend/convex/showcase.ts
Normal file
20
packages/backend/convex/showcase.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { v } from "convex/values";
|
||||
import { query } from "./_generated/server";
|
||||
|
||||
export const getShowcaseProjects = query({
|
||||
args: {},
|
||||
returns: v.array(
|
||||
v.object({
|
||||
_id: v.id("showcase"),
|
||||
_creationTime: v.number(),
|
||||
title: v.string(),
|
||||
description: v.string(),
|
||||
imageUrl: v.string(),
|
||||
liveUrl: v.string(),
|
||||
tags: v.array(v.string()),
|
||||
}),
|
||||
),
|
||||
handler: async (ctx) => {
|
||||
return await ctx.db.query("showcase").collect();
|
||||
},
|
||||
});
|
||||
30
packages/backend/convex/sponsors.ts
Normal file
30
packages/backend/convex/sponsors.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { v } from "convex/values";
|
||||
import { query } from "./_generated/server";
|
||||
|
||||
export const getSponsors = query({
|
||||
args: {},
|
||||
returns: v.array(
|
||||
v.object({
|
||||
_id: v.id("sponsors"),
|
||||
_creationTime: v.number(),
|
||||
sponsor: v.object({
|
||||
login: v.string(),
|
||||
name: v.string(),
|
||||
avatarUrl: v.string(),
|
||||
websiteUrl: v.optional(v.string()),
|
||||
linkUrl: v.string(),
|
||||
customLogoUrl: v.optional(v.string()),
|
||||
type: v.string(),
|
||||
}),
|
||||
isOneTime: v.boolean(),
|
||||
monthlyDollars: v.number(),
|
||||
privacyLevel: v.string(),
|
||||
tierName: v.string(),
|
||||
createdAt: v.string(),
|
||||
provider: v.string(),
|
||||
}),
|
||||
),
|
||||
handler: async (ctx) => {
|
||||
return await ctx.db.query("sponsors").collect();
|
||||
},
|
||||
});
|
||||
31
packages/backend/convex/testimonials.ts
Normal file
31
packages/backend/convex/testimonials.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { v } from "convex/values";
|
||||
import { query } from "./_generated/server";
|
||||
|
||||
export const getVideos = query({
|
||||
args: {},
|
||||
returns: v.array(
|
||||
v.object({
|
||||
_id: v.id("videos"),
|
||||
_creationTime: v.number(),
|
||||
embedId: v.string(),
|
||||
title: v.string(),
|
||||
}),
|
||||
),
|
||||
handler: async (ctx) => {
|
||||
return await ctx.db.query("videos").collect();
|
||||
},
|
||||
});
|
||||
|
||||
export const getTweets = query({
|
||||
args: {},
|
||||
returns: v.array(
|
||||
v.object({
|
||||
_id: v.id("tweets"),
|
||||
_creationTime: v.number(),
|
||||
tweetId: v.string(),
|
||||
}),
|
||||
),
|
||||
handler: async (ctx) => {
|
||||
return await ctx.db.query("tweets").collect();
|
||||
},
|
||||
});
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@erquhart/convex-oss-stats": "^0.8.1",
|
||||
"convex": "^1.25.4"
|
||||
"convex": "^1.25.4",
|
||||
"convex-helpers": "^0.1.104"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user