mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-26 02:24:44 +03:00
chore(survey): rename ownerId param to userId to match other tables
This commit is contained in:
parent
150ea7710f
commit
4050d2a2c3
@ -1,11 +1,11 @@
|
||||
import { runQuery } from "~/node_common/data/utilities";
|
||||
|
||||
export default async ({ ownerId, prevTools, usecases, referrals }) => {
|
||||
export default async ({ userId, prevTools, usecases, referrals }) => {
|
||||
return await runQuery({
|
||||
label: "CREATE_SURVEY",
|
||||
queryFn: async (DB) => {
|
||||
let query = await DB.insert({
|
||||
ownerId,
|
||||
userId,
|
||||
prevTools,
|
||||
usecases,
|
||||
referrals,
|
||||
|
@ -37,7 +37,7 @@ export default async ({ id }) => {
|
||||
|
||||
const usage = await DB.from("usage").where({ userId: id }).del();
|
||||
|
||||
const surveys = await DB.from("surveys").where({ ownerId: id }).del();
|
||||
const surveys = await DB.from("surveys").where({ userId: id }).del();
|
||||
|
||||
const data = await DB.from("users").where({ id }).del().returning("*");
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { runQuery } from "~/node_common/data/utilities";
|
||||
|
||||
export default async ({ ownerId }) => {
|
||||
export default async ({ userId }) => {
|
||||
return await runQuery({
|
||||
label: "GET_SURVEY_BY_USER_ID",
|
||||
queryFn: async (DB) => {
|
||||
let query = await DB.select("*").from("surveys").where({ ownerId });
|
||||
let query = await DB.select("*").from("surveys").where({ userId });
|
||||
|
||||
if (!query || query.error) {
|
||||
return null;
|
||||
|
@ -159,7 +159,7 @@ export const getById = async ({ id }) => {
|
||||
Data.getSubscriptionsByUserId({ ownerId: id }),
|
||||
Data.getFollowingByUserId({ ownerId: id }),
|
||||
Data.getFollowersByUserId({ userId: id }),
|
||||
Data.getSurveyByUserId({ ownerId: id }),
|
||||
Data.getSurveyByUserId({ userId: id }),
|
||||
])
|
||||
).map((item) => item.value);
|
||||
|
||||
|
@ -21,7 +21,7 @@ export default async (req, res) => {
|
||||
const { id } = userInfo;
|
||||
|
||||
const survey = Data.createSurvey({
|
||||
ownerId: id,
|
||||
userId: id,
|
||||
prevTools: tools,
|
||||
usecases: useCases,
|
||||
referrals,
|
||||
|
@ -183,7 +183,7 @@ const createTwitterTokensTable = db.schema.createTable("twitterTokens", function
|
||||
|
||||
const createSurveysTable = db.schema.createTable("surveys", function (table) {
|
||||
table.uuid("id").primary().unique().notNullable().defaultTo(db.raw("uuid_generate_v4()"));
|
||||
table.uuid("ownerId").references("id").inTable("users");
|
||||
table.uuid("userId").references("id").inTable("users");
|
||||
table.string("prevTools").notNullable();
|
||||
table.string("usecases").notNullable();
|
||||
table.string("referrals").notNullable();
|
||||
|
Loading…
Reference in New Issue
Block a user