mirror of
https://github.com/outline/outline.git
synced 2026-06-30 11:44:24 +03:00
03de720f6f
- Add Emoji model with team and user associations - Create migration for emojis table with proper indexes - Implement API routes: emojis.list, emojis.create, emojis.delete - Add emoji presenter for consistent API responses - Implement emoji policies for team-based authorization - Register emoji routes and exports in main API Addresses issue #9278
64 lines
1.6 KiB
JavaScript
64 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up (queryInterface, Sequelize) {
|
|
await queryInterface.sequelize.transaction(async (transaction) => {
|
|
await queryInterface.createTable("emojis", {
|
|
id: {
|
|
type: Sequelize.UUID,
|
|
primaryKey: true,
|
|
allowNull: false
|
|
},
|
|
name: {
|
|
type: Sequelize.STRING,
|
|
allowNull: false
|
|
},
|
|
url: {
|
|
type: Sequelize.STRING,
|
|
allowNull: false
|
|
},
|
|
teamId: {
|
|
type: Sequelize.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: "teams",
|
|
key: "id"
|
|
},
|
|
onDelete: "CASCADE"
|
|
},
|
|
createdById: {
|
|
type: Sequelize.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: "users",
|
|
key: "id"
|
|
},
|
|
onDelete: "CASCADE"
|
|
},
|
|
createdAt: {
|
|
type: Sequelize.DATE,
|
|
allowNull: false
|
|
},
|
|
updatedAt: {
|
|
type: Sequelize.DATE,
|
|
allowNull: false
|
|
}
|
|
}, { transaction });
|
|
|
|
await queryInterface.addIndex("emojis", ["teamId"], { transaction });
|
|
await queryInterface.addIndex("emojis", ["createdById"], { transaction });
|
|
await queryInterface.addIndex("emojis", ["teamId", "name"], {
|
|
unique: true,
|
|
transaction
|
|
});
|
|
});
|
|
},
|
|
|
|
async down (queryInterface, Sequelize) {
|
|
await queryInterface.sequelize.transaction(async (transaction) => {
|
|
await queryInterface.dropTable("emojis", { transaction });
|
|
});
|
|
}
|
|
};
|