diff --git a/src/schema.ts b/src/schema.ts index 86d3119..13fff73 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -69,8 +69,8 @@ export const groupRelation = relations(group, ({ many }) => ({ export const opinion = sqliteTable("opinions", { id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }), name: text("name").unique().notNull(), - type: text("type", { enum: ["3Choice", "4Choice"] }) - .default("3Choice") + type: text("type", { enum: ["3Choice", "4Choice", "5Choice"] }) + .default("5Choice") .notNull(), }); @@ -85,8 +85,15 @@ export const userOpinion = sqliteTable( .notNull() .references(() => opinion.id), choice: text("choice", { - enum: ["agree", "disagree", "deciding", "ignore"], - }).default("deciding"), + enum: [ + "strongly agree", + "agree", + "disagree", + "strongly disagree", + "ignore", + "deciding", + ], + }).default("ignore"), }, (t) => ({ pk: primaryKey({ columns: [t.userId, t.opinionId] }), diff --git a/src/userRoute.ts b/src/userRoute.ts index f547190..22bcc2c 100644 --- a/src/userRoute.ts +++ b/src/userRoute.ts @@ -143,6 +143,7 @@ async function getAllUserCount( .where(and(...conditions)) .then((v) => v[0].count); } + async function getAllUser( offset: number, limit: number,