Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desenvolvendo issues #127 e #103 #131

Merged
merged 7 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/__tests__/Client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test("store a Client and fetch it", async () => {
name: "Joe",
email:"joe2@gmail.com",
phone:"(86)8988-8989",
nickbame:"joezinho",
password:"doidinho123",
type:0
}
Expand All @@ -54,6 +55,7 @@ test("store a Client and update it", async () => {
name: "Joe",
email:"joe2@gmail.com",
phone:"(86)8988-8989",
nickbame:"joezinho",
password:"doidinho123",
type:0
}
Expand Down
40 changes: 3 additions & 37 deletions backend/__tests__/Professional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ test("store a Professional and fetch it", async () => {

const newProfessional = {
name: "Joe",
nickbame:"joezao",
email:"joe2@gmail.com",
speciality:"psicologia forense",
crm_crp:"071.122.811-79",
Expand All @@ -49,43 +50,6 @@ test("store a Professional and fetch it", async () => {
});


test("store a Client and update it", async () => {

const newProfessional = {
name: "Joe",
email:"joe2@gmail.com",
speciality:"psicologia forense",
crm_crp:"071.122.811-79",
password:"joepsicologia",
type:1
}


const userService = new UserService();

await userService.createUser(newProfessional);


let joe = await getRepository(Professional).findOne({
where: {
crm_crp:"071.122.811-79"
}
});

const professionalService = new ProfessionalService();

await professionalService.update({id:joe.id, name:"Joe Atualizado",});

let joe2 = await getRepository(Professional).findOne({
where: {
id:joe.id
}
});


expect(joe2.name).toBe("Joe Atualizado");
});

test("Fetch all clients from a professional", async () => {
const professional = {
name: "Maria Soares",
Expand All @@ -94,6 +58,7 @@ test("Fetch all clients from a professional", async () => {
crm_crp:"071.122.811-79",
association_code: "#322T",
password:"mariapsicologia",
nickbame:"mariazinha",
type:1
}

Expand All @@ -102,6 +67,7 @@ test("Fetch all clients from a professional", async () => {

const client = {
name: "Joe",
nickbame:"joezinho",
email: "joe2@gmail.com",
phone: "(86)8988-8989",
password: "joe123",
Expand Down
2 changes: 2 additions & 0 deletions backend/__tests__/User.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test("store a User and recognize him/her as a Client or a Professional", async (
name: "Maria Soares",
email: "maria_soares@gmail.com",
speciality: "psicologia forense",
nickbame:"joezinho",
crm_crp: "071.122.811-79",
association_code: "#322T",
password: "mariapsicologia",
Expand All @@ -41,6 +42,7 @@ test("store a User and recognize him/her as a Client or a Professional", async (
const client = {
name: "Joe",
email: "joe2@gmail.com",
nickbame:"joezinho",
phone: "(86)8988-8989",
password: "joe123",
type: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {MigrationInterface, QueryRunner, TableColumn} from "typeorm";

export class UpadateProfessionalColumns1625436997301 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn('professionals', new TableColumn({
name:"nickname",
type:"varchar",
default:'""'
}))
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn("professionals",'nickname')
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {MigrationInterface, QueryRunner, TableColumn} from "typeorm";

export class UpadateClientColumns1625439373381 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn('clients', new TableColumn({
name:"nickname",
type:"varchar",
default:'""'
}))
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn("clients",'nickname')
}

}
3 changes: 3 additions & 0 deletions backend/src/entities/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import { EmotionalReaction } from './EmotionalReaction';
@Column()
name:string;

@Column({default:""})
nickname:string;

@Column()
phone:string;

Expand Down
3 changes: 3 additions & 0 deletions backend/src/entities/Professional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { User } from './User';
@Column()
name:string;

@Column({default:""})
nickname:string;

@Column()
speciality:string;

Expand Down
10 changes: 6 additions & 4 deletions frontend/src/views/RecordsList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';
import { FlatList,ActivityIndicator} from 'react-native';
import { useNavigation } from '@react-navigation/native';
import Alert2Options from '../../components/Alert2Options';
import Record_card from '../../components/Record_card';
import { Title,Container,NothingFound,ContainerAll,TextNothingFound } from './styles';
Expand All @@ -13,8 +14,9 @@ interface Record{
}

export default function RecordsList() {

const client_id = "1";

const navigation = useNavigation();
const client_id = "1avb";
const [idCurrent, setIdCurrent] = useState<string>("");
const [loading, setLoading] = useState<boolean>(true);
const [modalIsVisible, setModalIsVisible] = useState<boolean>(false);
Expand All @@ -39,7 +41,7 @@ export default function RecordsList() {

const fields = Object.entries(record);

const fields_cont = fields.filter( field => field[1] !== '').length;
const fields_cont = fields.filter( field => ( (field[1] !== null) && (field[1] !== "") && (String(field[1]).length > 1) )).length;

const fields_completed = Math.round(fields_cont / fields.length * 100);

Expand Down Expand Up @@ -85,7 +87,7 @@ export default function RecordsList() {
}

function onPressCard(){

navigation.navigate('Registration');
SamuelSSan28 marked this conversation as resolved.
Show resolved Hide resolved
}

return (
Expand Down