Skip to content

Commit

Permalink
Lx 301 backsearch feedback backend (#53)
Browse files Browse the repository at this point in the history
Thanks @rogup for advice, @lin-d-hop everything resolve bar unit tests.
  • Loading branch information
ms0ur1s authored Feb 7, 2024
1 parent fdf0bfd commit ad14b22
Show file tree
Hide file tree
Showing 6 changed files with 1,155 additions and 656 deletions.
23 changes: 23 additions & 0 deletions migrations/2024011018230000-create-user-feedback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";

module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.query(
`CREATE TABLE user_feedback (
id bigint NOT NULL AUTO_INCREMENT,
question_use_case text,
question_impact text,
question_who_benefits text,
question_improvements text,
user_id bigint DEFAULT NULL,
submission_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY user_id (user_id),
CONSTRAINT user_feedback_user FOREIGN KEY (user_id) REFERENCES user (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1`
);
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable("user_feedback");
},
};
21 changes: 21 additions & 0 deletions seeders/10_user_feedback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use strict";

const { faker } = require("@faker-js/faker");

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.bulkInsert("user_feedback", [
{
question_use_case: faker.lorem.paragraph(),
question_impact: faker.lorem.paragraph(),
question_who_benefits: faker.lorem.paragraph(),
question_improvements: faker.lorem.paragraph(),
feedback_user_id: 1,
},
]);
},

down: (queryInterface, Sequelize) => {
return queryInterface.bulkDelete("user_feedback", null, {});
},
};
Loading

0 comments on commit ad14b22

Please sign in to comment.