feat: Remove positionCompany column from usuario table and references in frontend and backend
parent
b85aa4d5ba
commit
8eb2156845
|
@ -142,8 +142,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
|
|||
email,
|
||||
password,
|
||||
name,
|
||||
profile,
|
||||
positionCompany,
|
||||
profile,
|
||||
positionId,
|
||||
queueIds,
|
||||
transferToOtherQueues
|
||||
|
@ -169,8 +168,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
|
|||
const user = await CreateUserService({
|
||||
email,
|
||||
password,
|
||||
name,
|
||||
positionCompany,
|
||||
name,
|
||||
positionId,
|
||||
profile,
|
||||
queueIds,
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import { QueryInterface, DataTypes } from "sequelize";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.removeColumn("Users", "positionCompany");
|
||||
},
|
||||
|
||||
down: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.addColumn("Users", "positionCompany", {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true
|
||||
});
|
||||
}
|
||||
};
|
|
@ -3,8 +3,7 @@ import User from "../models/User";
|
|||
|
||||
interface SerializedUser {
|
||||
id: number;
|
||||
name: string;
|
||||
positionCompany: string;
|
||||
name: string;
|
||||
positionId: string | number;
|
||||
position: object;
|
||||
email: string;
|
||||
|
@ -15,8 +14,7 @@ interface SerializedUser {
|
|||
export const SerializeUser = (user: User): SerializedUser => {
|
||||
return {
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
positionCompany: user.positionCompany,
|
||||
name: user.name,
|
||||
positionId: user.positionId,
|
||||
position: user.position,
|
||||
email: user.email,
|
||||
|
|
|
@ -43,10 +43,7 @@ class User extends Model<User> {
|
|||
|
||||
@Default(0)
|
||||
@Column
|
||||
tokenVersion: number;
|
||||
|
||||
@Column
|
||||
positionCompany: string;
|
||||
tokenVersion: number;
|
||||
|
||||
@Column
|
||||
secondaryId: string;
|
||||
|
|
|
@ -9,8 +9,7 @@ import Queue from "../../models/Queue";
|
|||
|
||||
interface SerializedUser {
|
||||
id: number;
|
||||
name: string;
|
||||
positionCompany: string;
|
||||
name: string;
|
||||
email: string;
|
||||
profile: string;
|
||||
queues: Queue[];
|
||||
|
|
|
@ -8,8 +8,7 @@ import ShowUserService from "./ShowUserService";
|
|||
interface Request {
|
||||
email: string;
|
||||
password: string;
|
||||
name: string;
|
||||
positionCompany?: string;
|
||||
name: string;
|
||||
positionId?: string;
|
||||
queueIds?: number[];
|
||||
profile?: string;
|
||||
|
@ -19,8 +18,7 @@ interface Request {
|
|||
|
||||
interface Response {
|
||||
email: string;
|
||||
name: string;
|
||||
positionCompany: string;
|
||||
name: string;
|
||||
positionId: string;
|
||||
id: number;
|
||||
profile: string;
|
||||
|
@ -30,8 +28,7 @@ interface Response {
|
|||
const CreateUserService = async ({
|
||||
email,
|
||||
password,
|
||||
name,
|
||||
positionCompany,
|
||||
name,
|
||||
positionId,
|
||||
queueIds = [],
|
||||
profile = "master",
|
||||
|
@ -84,8 +81,7 @@ const CreateUserService = async ({
|
|||
{
|
||||
email,
|
||||
password,
|
||||
name,
|
||||
positionCompany,
|
||||
name,
|
||||
positionId: !positionId ? null : positionId,
|
||||
profile,
|
||||
transferToOtherQueues: transferToOtherQueues? transferToOtherQueues : false
|
||||
|
|
|
@ -75,7 +75,7 @@ const ListUser = async ({
|
|||
const users = await User.findAll({
|
||||
where: where_clause,
|
||||
raw,
|
||||
attributes: ["id", "name", "email", "positionCompany", "transferToOtherQueues"],
|
||||
attributes: ["id", "name", "email", "transferToOtherQueues"],
|
||||
|
||||
include: [
|
||||
{ model: Queue, as: "queues", attributes: ["id", "name", "color"] }
|
||||
|
|
|
@ -63,8 +63,7 @@ const ListUsersService = async ({
|
|||
attributes: [
|
||||
"name",
|
||||
"id",
|
||||
"email",
|
||||
"positionCompany",
|
||||
"email",
|
||||
"profile",
|
||||
"createdAt",
|
||||
"transferToOtherQueues"
|
||||
|
|
|
@ -9,8 +9,7 @@ const ShowUserService = async (id: string | number): Promise<User> => {
|
|||
"name",
|
||||
"id",
|
||||
"email",
|
||||
"profile",
|
||||
"positionCompany",
|
||||
"profile",
|
||||
"positionId",
|
||||
"tokenVersion",
|
||||
"transferToOtherQueues"
|
||||
|
|
|
@ -7,8 +7,7 @@ import User from "../../models/User";
|
|||
interface UserData {
|
||||
email?: string;
|
||||
password?: string;
|
||||
name?: string;
|
||||
positionCompany?: string;
|
||||
name?: string;
|
||||
positionId?: string;
|
||||
profile?: string;
|
||||
queueIds?: number[];
|
||||
|
@ -73,8 +72,7 @@ const UpdateUserService = async ({
|
|||
email,
|
||||
password,
|
||||
profile,
|
||||
name,
|
||||
positionCompany,
|
||||
name,
|
||||
positionId,
|
||||
queueIds = [],
|
||||
transferToOtherQueues
|
||||
|
@ -89,8 +87,7 @@ const UpdateUserService = async ({
|
|||
await user.update({
|
||||
email,
|
||||
password,
|
||||
profile,
|
||||
positionCompany,
|
||||
profile,
|
||||
positionId: !positionId ? null : positionId,
|
||||
name,
|
||||
transferToOtherQueues
|
||||
|
|
|
@ -84,8 +84,7 @@ const UserModal = ({ open, onClose, userId, }) => {
|
|||
const initialState = {
|
||||
name: "",
|
||||
email: "",
|
||||
password: "",
|
||||
positionCompany: "",
|
||||
password: "",
|
||||
profile: "user",
|
||||
}
|
||||
|
||||
|
@ -261,17 +260,7 @@ const UserModal = ({ open, onClose, userId, }) => {
|
|||
margin="dense"
|
||||
fullWidth
|
||||
/>
|
||||
<div className={classes.multFieldLine}>
|
||||
{/* <Field
|
||||
as={TextField}
|
||||
label="Cargo"
|
||||
name="positionCompany"
|
||||
error={touched.name && Boolean(errors.name)}
|
||||
helperText={touched.name && errors.name}
|
||||
variant="outlined"
|
||||
margin="dense"
|
||||
fullWidth
|
||||
/> */}
|
||||
<div className={classes.multFieldLine}>
|
||||
<label style={{display: 'flex', alignItems:'center'}}>
|
||||
Transferir para outras filas
|
||||
<Switch
|
||||
|
|
Loading…
Reference in New Issue