Skip to content

Commit

Permalink
Merge pull request #87 from Carifio24/response-optional
Browse files Browse the repository at this point in the history
Allow eclipse mini response to be null
  • Loading branch information
Carifio24 authored Oct 4, 2023
2 parents 993416e + f1d5b44 commit 91658ca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/stories/minids/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface EclipseMiniData {
export function isValidEclipseMiniData(data: any): data is EclipseMiniData {

return typeof data.user_uuid === "string" &&
typeof data.response === "string" &&
(!data.response || typeof data.response === "string") &&
isStringArray(data.preset_locations) &&
isArrayThatSatisfies(data.user_selected_locations, (arr) => {
return arr.every(x => isNumberArray(x) && x.length === 2);
Expand Down
2 changes: 1 addition & 1 deletion src/stories/minids/models/eclipse_response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function initializeEclipseMiniResponseModel(sequelize: Sequelize) {
},
response: {
type: DataTypes.CHAR,
allowNull: false
defaultValue: null
},
preset_locations: {
type: DataTypes.JSON,
Expand Down
2 changes: 1 addition & 1 deletion src/stories/minids/sql/create_eclipse_response_table.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE EclipseMiniResponses (
id int(11) UNSIGNED NOT NULL UNIQUE AUTO_INCREMENT,
user_uuid varchar(36) NOT NULL UNIQUE,
response char(1) NOT NULL,
response char(1) DEFAULT NULL,
preset_locations JSON NOT NULL,
preset_locations_count INT NOT NULL,
user_selected_locations JSON NOT NULL,
Expand Down

0 comments on commit 91658ca

Please sign in to comment.