Skip to content

Commit

Permalink
comit
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzasaleem2 committed Oct 9, 2024
1 parent 6c60622 commit 3940242
Show file tree
Hide file tree
Showing 84 changed files with 4,572 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
9 changes: 9 additions & 0 deletions .template.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Deployment used by `npx convex dev`
CONVEX_DEPLOYMENT=

VITE_CONVEX_URL=

VITE_CLERK_PUBLISHABLE_KEY=

VITE_POSTHOG_KEY=
VITE_POSTHOG_API_HOST=
Binary file added bun.lockb
Binary file not shown.
90 changes: 90 additions & 0 deletions convex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Welcome to your Convex functions directory!

Write your Convex functions here.
See https://docs.convex.dev/functions for more.

A query function that takes two arguments looks like:

```ts
// functions.js
import { query } from "./_generated/server";
import { v } from "convex/values";

export const myQueryFunction = query({
// Validators for arguments.
args: {
first: v.number(),
second: v.string(),
},

// Function implementation.
handler: async (ctx, args) => {
// Read the database as many times as you need here.
// See https://docs.convex.dev/database/reading-data.
const documents = await ctx.db.query("tablename").collect();

// Arguments passed from the client are properties of the args object.
console.log(args.first, args.second);

// Write arbitrary JavaScript here: filter, aggregate, build derived data,
// remove non-public properties, or create new objects.
return documents;
},
});
```

Using this query function in a React component looks like:

```ts
const data = useQuery(api.functions.myQueryFunction, {
first: 10,
second: "hello",
});
```

A mutation function looks like:

```ts
// functions.js
import { mutation } from "./_generated/server";
import { v } from "convex/values";

export const myMutationFunction = mutation({
// Validators for arguments.
args: {
first: v.string(),
second: v.string(),
},

// Function implementation.
handler: async (ctx, args) => {
// Insert or modify documents in the database here.
// Mutations can also read from the database like queries.
// See https://docs.convex.dev/database/writing-data.
const message = { body: args.first, author: args.second };
const id = await ctx.db.insert("messages", message);

// Optionally, return a value from your mutation.
return await ctx.db.get(id);
},
});
```

Using this mutation function in a React component looks like:

```ts
const mutation = useMutation(api.functions.myMutationFunction);
function handleButtonPress() {
// fire and forget, the most common way to use mutations
mutation({ first: "Hello!", second: "me" });
// OR
// use the result once the mutation has completed
mutation({ first: "Hello!", second: "me" }).then((result) =>
console.log(result),
);
}
```

Use the Convex CLI to push your functions to a deployment. See everything
the Convex CLI can do by running `npx convex -h` in your project root
directory. To learn more, launch the docs with `npx convex docs`.
219 changes: 219 additions & 0 deletions convex/_generated/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
/* prettier-ignore-start */

/* eslint-disable */
/**
* Generated `api` utility.
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* To regenerate, run `npx convex dev`.
* @module
*/

import type * as boardSharing from "../boardSharing.js";
import type * as boards from "../boards.js";
import type * as notes from "../notes.js";
import type * as presence from "../presence.js";
import type * as support from "../support.js";
import type * as users from "../users.js";

import type {
ApiFromModules,
FilterApi,
FunctionReference,
} from "convex/server";
/**
* A utility for referencing Convex functions in your app's API.
*
* Usage:
* ```js
* const myFunctionReference = api.myModule.myFunction;
* ```
*/
declare const fullApi: ApiFromModules<{
boardSharing: typeof boardSharing;
boards: typeof boards;
notes: typeof notes;
presence: typeof presence;
support: typeof support;
users: typeof users;
}>;
declare const fullApiWithMounts: typeof fullApi;

export declare const api: FilterApi<
typeof fullApiWithMounts,
FunctionReference<any, "public">
>;
export declare const internal: FilterApi<
typeof fullApiWithMounts,
FunctionReference<any, "internal">
>;

export declare const components: {
aggregateBoardsByUser: {
btree: {
aggregateBetween: FunctionReference<
"query",
"internal",
{ k1?: any; k2?: any },
{ count: number; sum: number }
>;
aggregateBetweenHandler: FunctionReference<
"query",
"internal",
{ k1?: any; k2?: any },
{ count: number; sum: number }
>;
atNegativeOffset: FunctionReference<
"query",
"internal",
{ k1?: any; k2?: any; offset: number },
{ k: any; s: number; v: any }
>;
atNegativeOffsetHandler: FunctionReference<
"query",
"internal",
{ k1?: any; k2?: any; offset: number },
{ k: any; s: number; v: any }
>;
atOffset: FunctionReference<
"query",
"internal",
{ k1?: any; k2?: any; offset: number },
{ k: any; s: number; v: any }
>;
atOffsetHandler: FunctionReference<
"query",
"internal",
{ k1?: any; k2?: any; offset: number },
{ k: any; s: number; v: any }
>;
count: FunctionReference<"query", "internal", {}, any>;
countHandler: FunctionReference<"query", "internal", {}, any>;
get: FunctionReference<
"query",
"internal",
{ key: any },
null | { k: any; s: number; v: any }
>;
getHandler: FunctionReference<
"query",
"internal",
{ key: any },
null | { k: any; s: number; v: any }
>;
offset: FunctionReference<
"query",
"internal",
{ k1?: any; key: any },
number
>;
offsetHandler: FunctionReference<
"query",
"internal",
{ k1?: any; key: any },
number
>;
offsetUntil: FunctionReference<
"query",
"internal",
{ k2?: any; key: any },
number
>;
offsetUntilHandler: FunctionReference<
"query",
"internal",
{ k2?: any; key: any },
number
>;
paginate: FunctionReference<
"query",
"internal",
{
cursor?: string;
k1?: any;
k2?: any;
limit: number;
order: "asc" | "desc";
},
{
cursor: string;
isDone: boolean;
page: Array<{ k: any; s: number; v: any }>;
}
>;
paginateHandler: FunctionReference<
"query",
"internal",
{
cursor?: string;
k1?: any;
k2?: any;
limit: number;
order: "asc" | "desc";
},
{
cursor: string;
isDone: boolean;
page: Array<{ k: any; s: number; v: any }>;
}
>;
sum: FunctionReference<"query", "internal", {}, number>;
sumHandler: FunctionReference<"query", "internal", {}, number>;
validate: FunctionReference<"query", "internal", {}, any>;
validateTree: FunctionReference<"query", "internal", {}, any>;
};
inspect: {
display: FunctionReference<"query", "internal", {}, any>;
dump: FunctionReference<"query", "internal", {}, string>;
inspectNode: FunctionReference<
"query",
"internal",
{ node?: string },
null
>;
};
public: {
clear: FunctionReference<
"mutation",
"internal",
{ maxNodeSize?: number; rootLazy?: boolean },
null
>;
deleteIfExists: FunctionReference<
"mutation",
"internal",
{ key: any },
any
>;
delete_: FunctionReference<"mutation", "internal", { key: any }, null>;
init: FunctionReference<
"mutation",
"internal",
{ maxNodeSize?: number; rootLazy?: boolean },
null
>;
insert: FunctionReference<
"mutation",
"internal",
{ key: any; summand?: number; value: any },
null
>;
makeRootLazy: FunctionReference<"mutation", "internal", {}, null>;
replace: FunctionReference<
"mutation",
"internal",
{ currentKey: any; newKey: any; summand?: number; value: any },
null
>;
replaceOrInsert: FunctionReference<
"mutation",
"internal",
{ currentKey: any; newKey: any; summand?: number; value: any },
any
>;
};
};
};

/* prettier-ignore-end */
27 changes: 27 additions & 0 deletions convex/_generated/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* prettier-ignore-start */

/* eslint-disable */
/**
* Generated `api` utility.
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* To regenerate, run `npx convex dev`.
* @module
*/

import { anyApi, componentsGeneric } from "convex/server";

/**
* A utility for referencing Convex functions in your app's API.
*
* Usage:
* ```js
* const myFunctionReference = api.myModule.myFunction;
* ```
*/
export const api = anyApi;
export const internal = anyApi;
export const components = componentsGeneric();

/* prettier-ignore-end */
Loading

0 comments on commit 3940242

Please sign in to comment.