mov ecx, 420
mov ecx, 420
Explore posts from servers
BABetter Auth
Created by mov ecx, 420 on 4/13/2025 in #help
organization type error.
:aPES3_NerdGlasses: bump x2
5 replies
BABetter Auth
Created by mov ecx, 420 on 4/13/2025 in #help
How to set a password if we are logged in via a provider?
Ahh thank you so basically same as what I am doing now reset password flow
6 replies
BABetter Auth
Created by mov ecx, 420 on 4/13/2025 in #help
How to set a password if we are logged in via a provider?
No description
6 replies
BABetter Auth
Created by mov ecx, 420 on 4/13/2025 in #help
organization type error.
bump, using the latest version of better auth
5 replies
BABetter Auth
Created by mov ecx, 420 on 4/13/2025 in #help
organization type error.
No description
5 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
No worries, glad we could help each other
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
and you can call it like this
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
No description
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
No description
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
:aPES_LulLaugh:
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
I just realized it right after I sent the message.
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
I already pass the env field to get the db url when I create the auth instance, I can just reuse that :PES_Facepalm:
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
I am dumb.
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/11/2025 in #help
get env bindings from better auth email function context.
:PES2_HmmmmRobber: man
15 replies
BABetter Auth
Created by mov ecx, 420 on 4/2/2025 in #bug-reports
Custom Plugin is not type safe.
Anyways, you are a legend man, thank you. I'll try it out soon.
10 replies
BABetter Auth
Created by mov ecx, 420 on 4/2/2025 in #bug-reports
Custom Plugin is not type safe.
:PU_monkaShake: ahh, I guess I gotta learn typescript all over again
10 replies
BABetter Auth
Created by mov ecx, 420 on 4/2/2025 in #bug-reports
Custom Plugin is not type safe.
it would be nice to have a warning in the docs, saying if you don't use satisfies typesafety won't work
10 replies
BABetter Auth
Created by mov ecx, 420 on 4/2/2025 in #bug-reports
Custom Plugin is not type safe.
ahh :PES_ThumbsUp: alright, do you have any article on why we need to do that? interested to learn about this
10 replies
BABetter Auth
Created by mov ecx, 420 on 4/2/2025 in #bug-reports
Custom Plugin is not type safe.
import type { BetterAuthPlugin } from "better-auth/plugins";
import {
DEFAULT_CART_TABLE_NAME,
DEFAULT_MAX_CART_ITEMS,
DEFAULT_MAX_ITEM_PRICE,
DEFAULT_MAX_ITEM_QUANTITY,
createErrorCodes,
} from "./constants";
import { createEndpoints } from "./routes";
import { CartPluginOptions } from "./types";

/**
* Cart plugin for BetterAuth
* Provides shopping cart functionality with database storage
*/
export const cart = (options?: CartPluginOptions): BetterAuthPlugin => {
// Set defaults
const cartTableName = options?.cartTableName || DEFAULT_CART_TABLE_NAME;
const maxCartItems = options?.maxCartItems || DEFAULT_MAX_CART_ITEMS;
const maxItemPrice = options?.maxItemPrice || DEFAULT_MAX_ITEM_PRICE;
const maxItemQuantity = options?.maxItemQuantity || DEFAULT_MAX_ITEM_QUANTITY;

// Create error codes
const ERROR_CODES = createErrorCodes(
maxCartItems,
maxItemPrice,
maxItemQuantity,
);

// Define database schema
const schema = {
[cartTableName]: {
fields: {
userId: {
type: "string" as const,
required: true,
},
productId: {
type: "string" as const,
required: true,
},
name: {
type: "string" as const,
required: true,
},
price: {
type: "number" as const,
required: true,
},
quantity: {
type: "number" as const,
required: true,
},
image: {
type: "string" as const,
required: false,
},
createdAt: {
type: "date" as const,
required: true,
},
updatedAt: {
type: "date" as const,
required: true,
},
},
modelName: cartTableName,
},
};

// Create endpoints
const endpoints = createEndpoints(cartTableName, ERROR_CODES, {
maxCartItems,
maxItemPrice,
maxItemQuantity,
onCheckout: options?.onCheckout,
});

return {
id: "cart",
schema,
endpoints,
$ERROR_CODES: ERROR_CODES,
};
};

// Re-export types
export * from "./types";
import type { BetterAuthPlugin } from "better-auth/plugins";
import {
DEFAULT_CART_TABLE_NAME,
DEFAULT_MAX_CART_ITEMS,
DEFAULT_MAX_ITEM_PRICE,
DEFAULT_MAX_ITEM_QUANTITY,
createErrorCodes,
} from "./constants";
import { createEndpoints } from "./routes";
import { CartPluginOptions } from "./types";

/**
* Cart plugin for BetterAuth
* Provides shopping cart functionality with database storage
*/
export const cart = (options?: CartPluginOptions): BetterAuthPlugin => {
// Set defaults
const cartTableName = options?.cartTableName || DEFAULT_CART_TABLE_NAME;
const maxCartItems = options?.maxCartItems || DEFAULT_MAX_CART_ITEMS;
const maxItemPrice = options?.maxItemPrice || DEFAULT_MAX_ITEM_PRICE;
const maxItemQuantity = options?.maxItemQuantity || DEFAULT_MAX_ITEM_QUANTITY;

// Create error codes
const ERROR_CODES = createErrorCodes(
maxCartItems,
maxItemPrice,
maxItemQuantity,
);

// Define database schema
const schema = {
[cartTableName]: {
fields: {
userId: {
type: "string" as const,
required: true,
},
productId: {
type: "string" as const,
required: true,
},
name: {
type: "string" as const,
required: true,
},
price: {
type: "number" as const,
required: true,
},
quantity: {
type: "number" as const,
required: true,
},
image: {
type: "string" as const,
required: false,
},
createdAt: {
type: "date" as const,
required: true,
},
updatedAt: {
type: "date" as const,
required: true,
},
},
modelName: cartTableName,
},
};

// Create endpoints
const endpoints = createEndpoints(cartTableName, ERROR_CODES, {
maxCartItems,
maxItemPrice,
maxItemQuantity,
onCheckout: options?.onCheckout,
});

return {
id: "cart",
schema,
endpoints,
$ERROR_CODES: ERROR_CODES,
};
};

// Re-export types
export * from "./types";
10 replies