update choice for opinion
All checks were successful
backend-action / build-image (push) Successful in 42s
All checks were successful
backend-action / build-image (push) Successful in 42s
This commit is contained in:
@@ -69,8 +69,8 @@ export const groupRelation = relations(group, ({ many }) => ({
|
|||||||
export const opinion = sqliteTable("opinions", {
|
export const opinion = sqliteTable("opinions", {
|
||||||
id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }),
|
id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }),
|
||||||
name: text("name").unique().notNull(),
|
name: text("name").unique().notNull(),
|
||||||
type: text("type", { enum: ["3Choice", "4Choice"] })
|
type: text("type", { enum: ["3Choice", "4Choice", "5Choice"] })
|
||||||
.default("3Choice")
|
.default("5Choice")
|
||||||
.notNull(),
|
.notNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,8 +85,15 @@ export const userOpinion = sqliteTable(
|
|||||||
.notNull()
|
.notNull()
|
||||||
.references(() => opinion.id),
|
.references(() => opinion.id),
|
||||||
choice: text("choice", {
|
choice: text("choice", {
|
||||||
enum: ["agree", "disagree", "deciding", "ignore"],
|
enum: [
|
||||||
}).default("deciding"),
|
"strongly agree",
|
||||||
|
"agree",
|
||||||
|
"disagree",
|
||||||
|
"strongly disagree",
|
||||||
|
"ignore",
|
||||||
|
"deciding",
|
||||||
|
],
|
||||||
|
}).default("ignore"),
|
||||||
},
|
},
|
||||||
(t) => ({
|
(t) => ({
|
||||||
pk: primaryKey({ columns: [t.userId, t.opinionId] }),
|
pk: primaryKey({ columns: [t.userId, t.opinionId] }),
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ async function getAllUserCount(
|
|||||||
.where(and(...conditions))
|
.where(and(...conditions))
|
||||||
.then((v) => v[0].count);
|
.then((v) => v[0].count);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAllUser(
|
async function getAllUser(
|
||||||
offset: number,
|
offset: number,
|
||||||
limit: number,
|
limit: number,
|
||||||
|
|||||||
Reference in New Issue
Block a user