remove test endpoint

This commit is contained in:
Michael Freno
2026-01-21 15:50:49 -05:00
parent 3845c768e2
commit e6d5b40acd

View File

@@ -185,10 +185,6 @@ const loginSchema = z.object({
password: z.string().min(1) password: z.string().min(1)
}); });
const testTokenSchema = z.object({
userId: z.string().min(1)
});
export const cairnDbRouter = createTRPCRouter({ export const cairnDbRouter = createTRPCRouter({
health: cairnProcedure.query(async () => { health: cairnProcedure.query(async () => {
try { try {
@@ -239,15 +235,39 @@ export const cairnDbRouter = createTRPCRouter({
}); });
await conn.execute({ await conn.execute({
sql: "INSERT INTO authProviders (id, userId, provider, providerUserId, email, displayName, avatarUrl) VALUES (?, ?, ?, ?, ?, ?, ?)", sql: "INSERT INTO authProviders (id, userId, provider, providerUserId, email, displayName, avatarUrl) VALUES (?, ?, ?, ?, ?, ?, ?)",
args: [crypto.randomUUID(), userId, "email", null, input.email, null, null] args: [
crypto.randomUUID(),
userId,
"email",
null,
input.email,
null,
null
]
}); });
await conn.execute({ await conn.execute({
sql: "INSERT INTO authProviders (id, userId, provider, providerUserId, email, displayName, avatarUrl) VALUES (?, ?, ?, ?, ?, ?, ?)", sql: "INSERT INTO authProviders (id, userId, provider, providerUserId, email, displayName, avatarUrl) VALUES (?, ?, ?, ?, ?, ?, ?)",
args: [crypto.randomUUID(), userId, "password", passwordHash, input.email, null, null] args: [
crypto.randomUUID(),
userId,
"password",
passwordHash,
input.email,
null,
null
]
}); });
await conn.execute({ await conn.execute({
sql: "INSERT INTO workoutPlans (id, userId, name, category, difficulty, type, isPublic) VALUES (?, ?, ?, ?, ?, ?, ?)", sql: "INSERT INTO workoutPlans (id, userId, name, category, difficulty, type, isPublic) VALUES (?, ?, ?, ?, ?, ?, ?)",
args: [crypto.randomUUID(), userId, "Getting Started", "strength", "beginner", "strength", 0] args: [
crypto.randomUUID(),
userId,
"Getting Started",
"strength",
"beginner",
"strength",
0
]
}); });
const token = await signCairnToken(userId); const token = await signCairnToken(userId);
@@ -264,9 +284,7 @@ export const cairnDbRouter = createTRPCRouter({
} }
}), }),
login: publicProcedure login: publicProcedure.input(loginSchema).mutation(async ({ input }) => {
.input(loginSchema)
.mutation(async ({ input }) => {
try { try {
const conn = CairnConnectionFactory(); const conn = CairnConnectionFactory();
const result = await conn.execute({ const result = await conn.execute({
@@ -334,21 +352,6 @@ export const cairnDbRouter = createTRPCRouter({
} }
}), }),
createTestToken: publicProcedure
.input(testTokenSchema)
.mutation(async ({ input }) => {
try {
const token = await signCairnToken(input.userId);
return { success: true, token, userId: input.userId };
} catch (error) {
console.error("Failed to create Cairn test token:", error);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
message: "Failed to create test token"
});
}
}),
getUsers: cairnProcedure getUsers: cairnProcedure
.input(paginatedQuerySchema) .input(paginatedQuerySchema)
.query(async ({ input, ctx }) => { .query(async ({ input, ctx }) => {