-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validação de contato com ticket aberto II
- Loading branch information
Showing
20 changed files
with
559 additions
and
208 deletions.
There are no files selected for viewing
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
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
17 changes: 17 additions & 0 deletions
17
backend/src/database/migrations/20241230140500-remove-whatsapp-to-user.ts
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,17 @@ | ||
import { DataTypes, QueryInterface } from "sequelize"; | ||
|
||
module.exports = { | ||
up: async (queryInterface: QueryInterface) => { | ||
await queryInterface.removeColumn("Users", "whatsappId"); | ||
}, | ||
|
||
down: async (queryInterface: QueryInterface) => { | ||
await queryInterface.addColumn("Users", "whatsappId", { | ||
type: DataTypes.INTEGER, | ||
allowNull: true, | ||
references: { model: "Whatsapps", key: "id" }, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
}); | ||
}, | ||
}; |
40 changes: 40 additions & 0 deletions
40
backend/src/database/migrations/20241230140800-whatsapp-users-queue.ts
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,40 @@ | ||
import { DataTypes, QueryInterface } from "sequelize"; | ||
|
||
module.exports = { | ||
up: async (queryInterface: QueryInterface) => { | ||
await queryInterface.createTable("UserWhatsapps", { | ||
id: { | ||
type: DataTypes.INTEGER, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
allowNull: false, | ||
}, | ||
userId: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
references: { model: "Users", key: "id" }, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
}, | ||
whatsappId: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
references: { model: "Whatsapps", key: "id" }, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
}, | ||
createdAt: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
}, | ||
updatedAt: { | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
}, | ||
}); | ||
}, | ||
|
||
down: async (queryInterface: QueryInterface) => { | ||
await queryInterface.dropTable("UserWhatsapps"); | ||
}, | ||
}; |
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
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
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
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,29 @@ | ||
import { | ||
Column, | ||
CreatedAt, | ||
ForeignKey, | ||
Model, | ||
Table, | ||
UpdatedAt | ||
} from "sequelize-typescript"; | ||
import User from "./User"; | ||
import Whatsapp from "./Whatsapp"; | ||
|
||
@Table | ||
class UserWhatsapp extends Model<UserWhatsapp> { | ||
@ForeignKey(() => User) | ||
@Column | ||
userId: number; | ||
|
||
@ForeignKey(() => Whatsapp) | ||
@Column | ||
whatsappId: number; | ||
|
||
@CreatedAt | ||
createdAt: Date; | ||
|
||
@UpdatedAt | ||
updatedAt: Date; | ||
} | ||
|
||
export default UserWhatsapp; |
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
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
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
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
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.