update choice for opinion
All checks were successful
backend-action / build-image (push) Successful in 42s

This commit is contained in:
2024-05-02 17:19:32 +07:00
parent 0889c2426d
commit be42901480
2 changed files with 12 additions and 4 deletions

View File

@@ -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] }),

View File

@@ -143,6 +143,7 @@ async function getAllUserCount(
.where(and(...conditions))
.then((v) => v[0].count);
}
async function getAllUser(
offset: number,
limit: number,