Skip to content

Commit

Permalink
Correção no model, migration e add seed
Browse files Browse the repository at this point in the history
  • Loading branch information
rtenorioh committed Dec 8, 2024
1 parent 5ac3ea7 commit 0b0c31b
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 24 deletions.
3 changes: 2 additions & 1 deletion backend/api.rest
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

#Variaveis
@baseUrl = http://localhost:8080
# @baseUrl = https://apidev.pressticket.com.br
@token = 6175c0d0-acd5-4776-95a9-592c795da986
@token2 = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Ik1hc3RlckFkbWluIiwicHJvZmlsZSI6Im1hc3RlcmFkbWluIiwiaWQiOjIsImlhdCI6MTczMzEzNjUxOCwiZXhwIjoxNzMzMTQwMTE4fQ.UOA-goHaIATCvMs_eAXIIR6bjEBuOg1VbF40Q2zxUn0
@token2 = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Ik1hc3RlckFkbWluIiwicHJvZmlsZSI6Im1hc3RlcmFkbWluIiwiaWQiOjIsImlhdCI6MTczMzY4OTk2NiwiZXhwIjoxNzMzNjkzNTY2fQ.g_jJs3vovlU5i9sS0IUoJ3Ew_m7W8GzqjWd-kieFFpc

@refreshToken = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidG9rZW5WZXJzaW9uIjowLCJpYXQiOjE3MzI4ODUzMzQsImV4cCI6MTczMzQ5MDEzNH0.RwuRIufYUB9dQZQg0aeaVtnOryn-sESNL1mFlShmBM4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ module.exports = {
},
theme: {
type: DataTypes.STRING,
allowNull: false
allowNull: true
},
company: {
type: DataTypes.STRING,
allowNull: false
allowNull: true
},
url: {
type: DataTypes.STRING,
allowNull: false
allowNull: true
},
primaryColor: {
type: DataTypes.STRING,
allowNull: false
allowNull: true
},
secondaryColor: {
type: DataTypes.STRING,
allowNull: false
allowNull: true
},
backgroundDefault: {
type: DataTypes.STRING,
allowNull: false
allowNull: true
},
backgroundPaper: {
type: DataTypes.STRING,
allowNull: false
allowNull: true
},
favico: {
type: DataTypes.TEXT,
Expand All @@ -49,6 +49,34 @@ module.exports = {
type: DataTypes.TEXT,
allowNull: true
},
toolbarColor: {
type: DataTypes.STRING,
allowNull: true
},
toolbarIconColor: {
type: DataTypes.STRING,
allowNull: true
},
menuItens: {
type: DataTypes.STRING,
allowNull: true
},
sub: {
type: DataTypes.STRING,
allowNull: true
},
textPrimary: {
type: DataTypes.STRING,
allowNull: true
},
textSecondary: {
type: DataTypes.STRING,
allowNull: true
},
divide: {
type: DataTypes.STRING,
allowNull: true
},
createdAt: {
type: DataTypes.DATE,
allowNull: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { QueryInterface } from "sequelize";

module.exports = {
up: (queryInterface: QueryInterface) => {
return queryInterface.bulkInsert(
"Personalizations",
[
{
theme: "light",
company: "Press Ticket",
url: "https://pressticket.com.br",
primaryColor: "#5C4B9B",
secondaryColor: "#D5C6F0",
backgroundDefault: "#FFFFFF",
backgroundPaper: "#F7F7F7",
toolbarColor: "#5C4B9B",
toolbarIconColor: "#FFFFFF",
menuItens: "#FFFFFF",
sub: "#F7F7F7",
textPrimary: "#000000",
textSecondary: "#333333",
divide: "#E0E0E0",
favico: null,
logo: null,
logoTicket: null,
createdAt: new Date(),
updatedAt: new Date()
},
{
theme: "dark",
primaryColor: "#8A7DCC",
secondaryColor: "#CCCCCC",
backgroundDefault: "#2E2E3A",
backgroundPaper: "#383850",
toolbarColor: "#8A7DCC",
toolbarIconColor: "#FFFFFF",
menuItens: "#181D22",
sub: "#383850",
textPrimary: "#FFFFFF",
textSecondary: "#CCCCCC",
divide: "#2E2E3A",
favico: null,
logo: null,
logoTicket: null,
createdAt: new Date(),
updatedAt: new Date()
}
],
{}
);
},

down: (queryInterface: QueryInterface) => {
return queryInterface.bulkDelete("Personalizations", {});
}
};
53 changes: 37 additions & 16 deletions backend/src/models/Personalization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,57 @@ class Personalization extends Model<Personalization> {
@Column
id: number;

@Column(DataType.STRING)
@Column({ type: DataType.STRING, allowNull: true })
theme: string;

@Column(DataType.STRING)
company: string;
@Column({ type: DataType.STRING, allowNull: true })
company: string | null;

@Column(DataType.STRING)
url: string;
@Column({ type: DataType.STRING, allowNull: true })
url: string | null;

@Column(DataType.STRING)
primaryColor: string;
@Column({ type: DataType.STRING, allowNull: true })
primaryColor: string | null;

@Column(DataType.STRING)
secondaryColor: string;
@Column({ type: DataType.STRING, allowNull: true })
secondaryColor: string | null;

@Column(DataType.STRING)
backgroundDefault: string;
@Column({ type: DataType.STRING, allowNull: true })
backgroundDefault: string | null;

@Column(DataType.STRING)
backgroundPaper: string;
@Column({ type: DataType.STRING, allowNull: true })
backgroundPaper: string | null;

@Column(DataType.TEXT)
@Column({ type: DataType.TEXT, allowNull: true })
favico: string | null;

@Column(DataType.TEXT)
@Column({ type: DataType.TEXT, allowNull: true })
logo: string | null;

@Column(DataType.TEXT)
@Column({ type: DataType.TEXT, allowNull: true })
logoTicket: string | null;

@Column({ type: DataType.STRING, allowNull: true })
toolbarColor: string | null;

@Column({ type: DataType.STRING, allowNull: true })
toolbarIconColor: string | null;

@Column({ type: DataType.STRING, allowNull: true })
menuItens: string | null;

@Column({ type: DataType.STRING, allowNull: true })
sub: string | null;

@Column({ type: DataType.STRING, allowNull: true })
textPrimary: string | null;

@Column({ type: DataType.STRING, allowNull: true })
textSecondary: string | null;

@Column({ type: DataType.STRING, allowNull: true })
divide: string | null;

@CreatedAt
@Column(DataType.DATE(6))
createdAt: Date;
Expand Down

0 comments on commit 0b0c31b

Please sign in to comment.