Compare commits
2 Commits
4a6fb3f61e
...
8eb2156845
Author | SHA1 | Date |
---|---|---|
adriano | 8eb2156845 | |
adriano | b85aa4d5ba |
|
@ -43,8 +43,7 @@ export const createUser = async (
|
||||||
const user = await CreateUserService({
|
const user = await CreateUserService({
|
||||||
email: user_tax_id || user_email,
|
email: user_tax_id || user_email,
|
||||||
password: "12345",
|
password: "12345",
|
||||||
name: user_first_name,
|
name: user_first_name,
|
||||||
positionCompany: user_title,
|
|
||||||
profile: "user",
|
profile: "user",
|
||||||
ignoreThrow: true
|
ignoreThrow: true
|
||||||
});
|
});
|
||||||
|
@ -204,8 +203,7 @@ export const updateUser = async (
|
||||||
|
|
||||||
const userData = {
|
const userData = {
|
||||||
email: user_tax_id || user_email,
|
email: user_tax_id || user_email,
|
||||||
name: user_first_name,
|
name: user_first_name,
|
||||||
positionCompany: user_title
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let user: any = await UpdateUserService({
|
let user: any = await UpdateUserService({
|
||||||
|
|
|
@ -142,8 +142,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
name,
|
name,
|
||||||
profile,
|
profile,
|
||||||
positionCompany,
|
|
||||||
positionId,
|
positionId,
|
||||||
queueIds,
|
queueIds,
|
||||||
transferToOtherQueues
|
transferToOtherQueues
|
||||||
|
@ -169,8 +168,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
|
||||||
const user = await CreateUserService({
|
const user = await CreateUserService({
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
name,
|
name,
|
||||||
positionCompany,
|
|
||||||
positionId,
|
positionId,
|
||||||
profile,
|
profile,
|
||||||
queueIds,
|
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 {
|
interface SerializedUser {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
positionCompany: string;
|
|
||||||
positionId: string | number;
|
positionId: string | number;
|
||||||
position: object;
|
position: object;
|
||||||
email: string;
|
email: string;
|
||||||
|
@ -15,8 +14,7 @@ interface SerializedUser {
|
||||||
export const SerializeUser = (user: User): SerializedUser => {
|
export const SerializeUser = (user: User): SerializedUser => {
|
||||||
return {
|
return {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
positionCompany: user.positionCompany,
|
|
||||||
positionId: user.positionId,
|
positionId: user.positionId,
|
||||||
position: user.position,
|
position: user.position,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
|
|
|
@ -43,10 +43,7 @@ class User extends Model<User> {
|
||||||
|
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@Column
|
@Column
|
||||||
tokenVersion: number;
|
tokenVersion: number;
|
||||||
|
|
||||||
@Column
|
|
||||||
positionCompany: string;
|
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
secondaryId: string;
|
secondaryId: string;
|
||||||
|
|
|
@ -9,8 +9,7 @@ import Queue from "../../models/Queue";
|
||||||
|
|
||||||
interface SerializedUser {
|
interface SerializedUser {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
positionCompany: string;
|
|
||||||
email: string;
|
email: string;
|
||||||
profile: string;
|
profile: string;
|
||||||
queues: Queue[];
|
queues: Queue[];
|
||||||
|
|
|
@ -8,8 +8,7 @@ import ShowUserService from "./ShowUserService";
|
||||||
interface Request {
|
interface Request {
|
||||||
email: string;
|
email: string;
|
||||||
password: string;
|
password: string;
|
||||||
name: string;
|
name: string;
|
||||||
positionCompany?: string;
|
|
||||||
positionId?: string;
|
positionId?: string;
|
||||||
queueIds?: number[];
|
queueIds?: number[];
|
||||||
profile?: string;
|
profile?: string;
|
||||||
|
@ -19,8 +18,7 @@ interface Request {
|
||||||
|
|
||||||
interface Response {
|
interface Response {
|
||||||
email: string;
|
email: string;
|
||||||
name: string;
|
name: string;
|
||||||
positionCompany: string;
|
|
||||||
positionId: string;
|
positionId: string;
|
||||||
id: number;
|
id: number;
|
||||||
profile: string;
|
profile: string;
|
||||||
|
@ -30,8 +28,7 @@ interface Response {
|
||||||
const CreateUserService = async ({
|
const CreateUserService = async ({
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
name,
|
name,
|
||||||
positionCompany,
|
|
||||||
positionId,
|
positionId,
|
||||||
queueIds = [],
|
queueIds = [],
|
||||||
profile = "master",
|
profile = "master",
|
||||||
|
@ -84,8 +81,7 @@ const CreateUserService = async ({
|
||||||
{
|
{
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
name,
|
name,
|
||||||
positionCompany,
|
|
||||||
positionId: !positionId ? null : positionId,
|
positionId: !positionId ? null : positionId,
|
||||||
profile,
|
profile,
|
||||||
transferToOtherQueues: transferToOtherQueues? transferToOtherQueues : false
|
transferToOtherQueues: transferToOtherQueues? transferToOtherQueues : false
|
||||||
|
|
|
@ -75,7 +75,7 @@ const ListUser = async ({
|
||||||
const users = await User.findAll({
|
const users = await User.findAll({
|
||||||
where: where_clause,
|
where: where_clause,
|
||||||
raw,
|
raw,
|
||||||
attributes: ["id", "name", "email", "positionCompany", "transferToOtherQueues"],
|
attributes: ["id", "name", "email", "transferToOtherQueues"],
|
||||||
|
|
||||||
include: [
|
include: [
|
||||||
{ model: Queue, as: "queues", attributes: ["id", "name", "color"] }
|
{ model: Queue, as: "queues", attributes: ["id", "name", "color"] }
|
||||||
|
|
|
@ -63,8 +63,7 @@ const ListUsersService = async ({
|
||||||
attributes: [
|
attributes: [
|
||||||
"name",
|
"name",
|
||||||
"id",
|
"id",
|
||||||
"email",
|
"email",
|
||||||
"positionCompany",
|
|
||||||
"profile",
|
"profile",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"transferToOtherQueues"
|
"transferToOtherQueues"
|
||||||
|
|
|
@ -9,8 +9,7 @@ const ShowUserService = async (id: string | number): Promise<User> => {
|
||||||
"name",
|
"name",
|
||||||
"id",
|
"id",
|
||||||
"email",
|
"email",
|
||||||
"profile",
|
"profile",
|
||||||
"positionCompany",
|
|
||||||
"positionId",
|
"positionId",
|
||||||
"tokenVersion",
|
"tokenVersion",
|
||||||
"transferToOtherQueues"
|
"transferToOtherQueues"
|
||||||
|
|
|
@ -7,8 +7,7 @@ import User from "../../models/User";
|
||||||
interface UserData {
|
interface UserData {
|
||||||
email?: string;
|
email?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
positionCompany?: string;
|
|
||||||
positionId?: string;
|
positionId?: string;
|
||||||
profile?: string;
|
profile?: string;
|
||||||
queueIds?: number[];
|
queueIds?: number[];
|
||||||
|
@ -73,8 +72,7 @@ const UpdateUserService = async ({
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
profile,
|
profile,
|
||||||
name,
|
name,
|
||||||
positionCompany,
|
|
||||||
positionId,
|
positionId,
|
||||||
queueIds = [],
|
queueIds = [],
|
||||||
transferToOtherQueues
|
transferToOtherQueues
|
||||||
|
@ -89,8 +87,7 @@ const UpdateUserService = async ({
|
||||||
await user.update({
|
await user.update({
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
profile,
|
profile,
|
||||||
positionCompany,
|
|
||||||
positionId: !positionId ? null : positionId,
|
positionId: !positionId ? null : positionId,
|
||||||
name,
|
name,
|
||||||
transferToOtherQueues
|
transferToOtherQueues
|
||||||
|
|
|
@ -84,8 +84,7 @@ const UserModal = ({ open, onClose, userId, }) => {
|
||||||
const initialState = {
|
const initialState = {
|
||||||
name: "",
|
name: "",
|
||||||
email: "",
|
email: "",
|
||||||
password: "",
|
password: "",
|
||||||
positionCompany: "",
|
|
||||||
profile: "user",
|
profile: "user",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,17 +260,7 @@ const UserModal = ({ open, onClose, userId, }) => {
|
||||||
margin="dense"
|
margin="dense"
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
<div className={classes.multFieldLine}>
|
<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
|
|
||||||
/> */}
|
|
||||||
<label style={{display: 'flex', alignItems:'center'}}>
|
<label style={{display: 'flex', alignItems:'center'}}>
|
||||||
Transferir para outras filas
|
Transferir para outras filas
|
||||||
<Switch
|
<Switch
|
||||||
|
|
Loading…
Reference in New Issue