-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:tattle-made/Uli into main
- Loading branch information
Showing
34 changed files
with
4,255 additions
and
155 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
browser-extension/api-server/db/migrations/20230906084000-create-slur.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.createTable('slurs', { | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: Sequelize.UUID, | ||
defaultValue: Sequelize.UUIDV4, | ||
}, | ||
userId: { | ||
type: Sequelize.UUID, | ||
defaultValue: Sequelize.UUIDV4, | ||
references: { | ||
model:'users', | ||
key: 'id', | ||
} | ||
}, | ||
label: { | ||
type: Sequelize.STRING, | ||
}, | ||
levelOfSeverity : { | ||
type: Sequelize.ENUM(['low', 'medium', 'high']), | ||
}, | ||
casual : { | ||
type: Sequelize.BOOLEAN, | ||
}, | ||
appropriated: { | ||
type: Sequelize.BOOLEAN, | ||
}, | ||
appropriationContext: { | ||
type: Sequelize.BOOLEAN, | ||
}, | ||
labelMeaning: { | ||
type: Sequelize.TEXT, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
}); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.dropTable('slurs'); | ||
}, | ||
}; |
48 changes: 48 additions & 0 deletions
48
browser-extension/api-server/db/migrations/20230906085000-create-category.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.createTable('categories', { | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: Sequelize.UUID, | ||
defaultValue: Sequelize.UUIDV4, | ||
}, | ||
slurId: { | ||
type: Sequelize.UUID, | ||
defaultValue: Sequelize.UUIDV4, | ||
references: { | ||
model: 'slurs', | ||
key: 'id', | ||
}, | ||
}, | ||
category: { | ||
type: Sequelize.ENUM([ | ||
"gendered", | ||
"sexualized", | ||
"religion", | ||
"ethnicity", | ||
"political affiliation", | ||
"caste", | ||
"class", | ||
"body shaming", | ||
"ableist", | ||
"sexual identity", | ||
"other", | ||
]), | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
}); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.dropTable('categories'); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use strict"; | ||
const { Model } = require("sequelize"); | ||
|
||
module.exports = (sequelize, DataTypes) => { | ||
class category extends Model { | ||
static associate(models) { | ||
// Define associations here if needed | ||
} | ||
} | ||
|
||
category.init( | ||
{ | ||
id: { | ||
primaryKey: true, | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
}, | ||
slurId: { | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
foreignKey: true, | ||
allowNull: false, | ||
}, | ||
category: { | ||
type: DataTypes.ENUM([ | ||
"gendered", | ||
"sexualized", | ||
"religion", | ||
"ethnicity", | ||
"political affiliation", | ||
"caste", | ||
"class", | ||
"body shaming", | ||
"ableist", | ||
"sexual identity", | ||
"other", | ||
]), | ||
}, | ||
}, | ||
{ | ||
sequelize, | ||
modelName: "category", | ||
} | ||
); | ||
|
||
return category; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"use strict"; | ||
const { Model } = require("sequelize"); | ||
|
||
module.exports = (sequelize, DataTypes) => { | ||
class slur extends Model { | ||
/** | ||
* Helper method for defining associations. | ||
* This method is not a part of Sequelize lifecycle. | ||
* The `models/index` file will call this method automatically. | ||
*/ | ||
static associate(models) { | ||
// Define associations here if needed | ||
slur.hasMany(models.category, { | ||
foreignKey: "slurId", | ||
as: "categories", | ||
}); | ||
} | ||
} | ||
|
||
slur.init( | ||
{ | ||
id: { | ||
primaryKey: true, | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
}, | ||
userId: { | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
foreignKey: true, | ||
allowNull: false, | ||
}, | ||
label: { | ||
type: DataTypes.STRING, | ||
}, | ||
levelOfSeverity: { | ||
type: DataTypes.ENUM(['low', 'medium', 'high']), | ||
}, | ||
casual: { | ||
type: DataTypes.BOOLEAN, | ||
}, | ||
appropriated: { | ||
type: DataTypes.BOOLEAN, | ||
}, | ||
appropriationContext: { | ||
type: DataTypes.BOOLEAN, | ||
}, | ||
labelMeaning: { | ||
type: DataTypes.TEXT, | ||
}, | ||
}, | ||
{ | ||
sequelize, | ||
modelName: "slur", | ||
} | ||
); | ||
|
||
return slur; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.