- Added new FAQ sections for account security, ordering and checkout, returns, shipping, and contact information. - Introduced legal documents including privacy policy, terms of service, data protection, and general terms and conditions. - Updated package dependencies to include gray-matter and remark-gfm for enhanced markdown support.
33 lines
716 B
TypeScript
33 lines
716 B
TypeScript
import { mutation } from "./_generated/server";
|
|
import { v } from "convex/values";
|
|
|
|
const topicValidator = v.union(
|
|
v.literal("products"),
|
|
v.literal("orders"),
|
|
v.literal("support"),
|
|
v.literal("other"),
|
|
);
|
|
|
|
/**
|
|
* Public mutation: submit a contact message. No auth required.
|
|
*/
|
|
export const submit = mutation({
|
|
args: {
|
|
fullName: v.string(),
|
|
email: v.string(),
|
|
topic: topicValidator,
|
|
message: v.string(),
|
|
},
|
|
handler: async (ctx, args) => {
|
|
const now = Date.now();
|
|
return await ctx.db.insert("messages", {
|
|
fullName: args.fullName,
|
|
email: args.email,
|
|
topic: args.topic,
|
|
message: args.message,
|
|
createdAt: now,
|
|
bookmarked: false,
|
|
});
|
|
},
|
|
});
|