Skip to content

Commit

Permalink
Changed bd
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatasfernandespimenta committed Nov 21, 2020
2 parents 97c408e + 3165f1a commit 2e3a4b1
Show file tree
Hide file tree
Showing 19 changed files with 933 additions and 68 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
# ******** NOTE ********

name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '37 20 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'java', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
9 changes: 5 additions & 4 deletions BackEnd/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ binary-extensions@^2.0.0:
integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==

bl@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/bl/-/bl-2.2.0.tgz#e1a574cdf528e4053019bb800b041c0ac88da493"
integrity sha512-wbgvOpqopSr7uq6fJrLH8EsvYMJf9gzfo2jCsL2eTy75qXPukA4pCgHamOQkZtY5vmfVtjB+P3LNlMHW5CEZXA==
version "2.2.1"
resolved "https://registry.yarnpkg.com/bl/-/bl-2.2.1.tgz#8c11a7b730655c5d56898cdc871224f40fd901d5"
integrity sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==
dependencies:
readable-stream "^2.3.5"
safe-buffer "^5.1.1"
Expand Down Expand Up @@ -3261,7 +3261,7 @@ safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==

safe-buffer@5.2.1:
safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
Expand All @@ -3272,6 +3272,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0:
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==

"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0":
"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.39.0
FLIPPER_VERSION=0.52.0
168 changes: 168 additions & 0 deletions FrontEnd/nano.save
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
import React, { useState } from 'react';
import { Text, Image, TouchableOpacity, Alert } from 'react-native';

import addPfpIcon from '../../assets/add_pfp.png';

import ImagePicker from 'react-native-image-picker';

import { Container } from './styles';
import Button from '../Button';
import Input from '../Input';

import {Form, Row, Column, ImagePreview} from './styles';

export default function Register({navigation, createUser}) {
const [nome, setNome] = useState('');
const [dataNasc, setDataNasc] = useState('');
const [email, setEmail] = useState('');
const [telefone, setTelefone] = useState('');
const [cpf, setCpf] = useState('');
const [senha, setSenha] = useState('');
const [confirmSenha, setConfirmSenha] = useState('');
const [cidade, setCidade] = useState('');
const [estado, setEstado] = useState('');
const [pfp, setPfp] = useState({ uri: '', name: '', type: '' });

const handleRegisterClick = async () => {
if(senha !== confirmSenha) {
Alert.alert('Erro', 'As senhas não coincidem', [
{ text: "OK" }
]);
}else {
createUser(nome, dataNasc, email, telefone, cpf, senha, cidade, estado, pfp).then(() => {
Alert.alert('Conta criada com sucesso', 'Sua conta foi criada, basta fazer o login', [
{ text: "OK", onPress: () => navigation.navigate('Login') }
],
{ cancelable: true });
}).catch((err) => {
console.log(err);
});
}
};

const addPfP = () => {
const options = {
title: 'Selecionar foto de perfil',
takePhotoButtonTitle: 'Tirar foto...',
mediaType: 'photo',
allowsEditing: true,
chooseFromLibraryButtonTitle: 'Escolher da galeria...',
storageOptions: {
skipBackup: true,
path: 'images',
},
};
ImagePicker.showImagePicker(options, response => {
if(!response.didCancel) {
setPfp({
uri: response.uri,
name: response.fileName,
type: response.type,
});
}
});
};

return (
<Container>
<Form>

<TouchableOpacity onPress={addPfP}>
<Image source={pfp.uri ? { uri: pfp.uri} : addPfpIcon} style={{width: 150, height: 150, borderRadius: 150}} resizeMode="cover"/>
</TouchableOpacity>

<Text style={{ color: 'white', marginBottom: 10 }}>Adicionar foto</Text>

<Input
icon="account"
iconColor="#fff"
placeholder="Nome de Usuario"
placeholderTextColor="white"
onChangeText={(text) => setNome(text)}
value={nome}
/>
<Input
icon="email"
iconColor="#fff"
placeholder="E-mail"
placeholderTextColor="white"
onChangeText={(text) => setEmail(text)}
value={email}
/>
<Input
icon="lock"
iconColor="#fff"
placeholder="Senha"
secureTextEntry={true}
placeholderTextColor="white"
onChangeText={(text) => setSenha(text)}
value={senha}
/>
<Input
icon="lock-alert"
iconColor="#fff"
placeholder="Confirmar Senha"
secureTextEntry={true}
placeholderTextColor="white"
onChangeText={(text) => setConfirmSenha(text)}
value={confirmSenha}
/>
<Input
icon="account-card-details"
iconColor="#fff"
placeholder="CPF"
placeholderTextColor="white"
onChangeText={(text) => setCpf(text)}
value={cpf}
/>
<Input
icon="calendar"
iconColor="#fff"
placeholder="Data de Nascimento"
placeholderTextColor="white"
onChangeText={(text) => setDataNasc(text)}
value={dataNasc}
/>
<Input
icon="cellphone"
iconColor="#fff"
placeholder="Telefone"
placeholderTextColor="white"
onChangeText={(text) => setTelefone(text)}
value={telefone}
/>

<Row>
<Column>
<Input
icon="home"
iconColor="#fff"
placeholder="Cidade"
placeholderTextColor="white"
onChangeText={(text) => setCidade(text)}
/>
</Column>
<Column fill=".6">
<Input
icon="city-variant"
iconColor="#fff"
placeholder="Estado"
placeholderTextColor="white"
maxLength={2}
onChangeText={(text) => setEstado(text)}
/>
</Column>
</Row>

<Button
marginY={20}
color="blue"
width={200}
height={40}
onPress={handleRegisterClick}>
Registrar
</Button>
</Form>
</Container>
);
}
3 changes: 2 additions & 1 deletion FrontEnd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.1.6",
"@react-navigation/stack": "^5.2.13",
"axios": "^0.19.2",
"axios": "^0.21.0",
"mime": "^2.4.6",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-elements": "^1.2.7",
Expand Down
115 changes: 115 additions & 0 deletions FrontEnd/src/Components/BookDetails/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import {useNavigation, useRoute} from '@react-navigation/native';
import React, {useCallback, useEffect, useState} from 'react';
import {Linking} from 'react-native';
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';

import {
Container,
Header,
User,
UserImage,
UserName,
UserAge,
UserAddress,
BookAvailability,
BookImage,
Body,
BookInfo,
BookAuthor,
BookCondition,
BookSynopsis,
BookSynopsisTitle,
BookSynopsisContent,
WhatsappFAB,
} from './styles';

const BookDetails = () => {
const {params} = useRoute();
const {setOptions} = useNavigation();

const [book, setBook] = useState();

useEffect(() => {
async function loadBookData() {
// const response = await api.get(`/getbook/${params.bookId}`);
// setBook(response.data);

setBook({
id: 1,
autor: 'Roberto Carlos',
titulo: 'O milagre da cela 8',
sinopse:
'Gandalf envolve Bilbo em uma festa para Thorin e seu grupo de anões, que cantam sobre recuperar a Montanha Solitária e seu vasto tesouro do dragão Smaug.[11] Quando a música termina, Gandalf revela um mapa que mostra uma porta secreta na montanha e propõe que um estupefato Bilbo sirva como "ladrão" daexpedição.[12] Os anões ridicularizam tal ideia, mas o hobbit, indignado, junta-se a eles mesmo sem querer.[13] O grupo viaja rumo às terras selvagens,[14] onde Bilbo e Gandalf salvam a companhia de um grupo de trolls[15]. Este último os leva à Rivendell,[16] onde Elrond revela os segredos do mapa que Thorin possui para a entrada secreta de Erebor.[17] Passando por cima das Montanhas Sombrias, eles são capturados por goblins e conduzidos ao subterrâneo profundo.[18] Embora Gandalf consiga resgatá-los, Bilbo acaba separado dos demais no momento da fuga.',
foto:
'https://images-na.ssl-images-amazon.com/images/I/61VxEKq8B1L._SX365_BO1,204,203,200_.jpg',
});
}

loadBookData();
}, [params]);

useEffect(() => {
setOptions({
title: book?.titulo ? book.titulo : 'Detalhes do livro',
});
}, [book, setOptions]);

const handleSendMessage = useCallback(() => {
Linking.openURL('whatsapp://send?phone=5519998487686');
}, []);

return (
<>
<Container>
<Header>
<User>
<UserImage
source={{
uri:
'https://upload.wikimedia.org/wikipedia/commons/0/01/Jos%C3%A9_Mayer_Foto_final.jpg',
}}
/>

<UserName>José Meyer</UserName>

<UserAge>70 anos</UserAge>

<UserAddress>Rio de Janeiro, RJ</UserAddress>

<BookAvailability>Disponível</BookAvailability>
</User>

{book?.foto && (
<BookImage
source={{
uri: book.foto,
}}
/>
)}
</Header>

<Body>
<BookInfo>
{book?.autor && <BookAuthor>Autor: {book.autor}</BookAuthor>}

<BookCondition>Condição: Pouco usado</BookCondition>

{book?.sinopse && (
<BookSynopsis>
<BookSynopsisTitle>Sinopse:</BookSynopsisTitle>

<BookSynopsisContent>{book.sinopse}</BookSynopsisContent>
</BookSynopsis>
)}
</BookInfo>
</Body>
</Container>

<WhatsappFAB onPress={handleSendMessage}>
<MaterialCommunityIcon name="whatsapp" color="#fff" size={25} />
</WhatsappFAB>
</>
);
};

export default BookDetails;
Loading

0 comments on commit 2e3a4b1

Please sign in to comment.