This commit is contained in:
henrydays 2019-03-18 17:04:50 +00:00
parent 5af35dcce3
commit eb543397a2
22 changed files with 1958 additions and 549 deletions

View File

@ -24,27 +24,12 @@ const SCREEN_HEIGHT = Dimensions.get("window").height;
const SCREEN_WIDTH = Dimensions.get("window").width;
const FirstRoute = () => (
<View style={[styles.scene, {backgroundColor: "#ff4081"}]}/>
);
const SecondRoute = () => (
<View style={[styles.scene, {backgroundColor: "#673ab7"}]}/>
);
const ThirdRoute = () => (
<View style={[styles.scene, {backgroundColor: "#673ab7"}]}/>
);
const FourthRoute = () => (
<View style={[styles.scene, {backgroundColor: "#673ab7"}]}/>
);
import PTRView from "react-native-pull-to-refresh";
class Eventos extends React.Component {
_update=()=> {
this.props.getAllEvents("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ"
);
this.props.getAllEvents(this.props.internalToken);
}
state = {
index: 0,
@ -57,8 +42,7 @@ _update=()=> {
};
componentDidMount(){
this.props.getAllEvents("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ"
);
this.props.getAllEvents(this.props.internalToken);
}
@ -151,7 +135,7 @@ const styles = StyleSheet.create({
margin: 20,
marginBottom:0,
backgroundColor: '#fff',
height: SCREEN_WIDTH * (1 /2),
height: SCREEN_WIDTH * 0.62,
borderRadius: 5,
//borderWidth: 2,
},

View File

@ -14,9 +14,11 @@ import {
NetInfo,
AppState,
TextInput,
Keyboard
Keyboard,
Switch,
Alert
} from "react-native";
import ToggleSwitch from 'toggle-switch-react-native'
import Modal from "react-native-modal";
import QRCodeScanner from 'react-native-qrcode-scanner';
import { Shadow } from "react-native-shadow";
@ -67,7 +69,9 @@ class Home extends Component {
user: { Name: "" },
userDetails: {},
appState: AppState.currentState,
addUser:false
addUser:false,
switch:false,
team:""
};
}
handleConnectivityChange = () => {
@ -80,7 +84,7 @@ class Home extends Component {
this.props.getUserInfo(this.props.token);
console.log(this.props.internalToken)
this.props.getUserTeam(this.props.user, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ" );
this.props.getUserTeam(this.props.user, this.props.internalToken );
this.props.getEvents(this.props.user);
}
componentWillUnmount() {}
@ -98,21 +102,49 @@ class Home extends Component {
_update = () => {
this.props.getUserInfo(this.props.token);
this.props.getEvents(this.props.user);
this.props.getUserTeam(this.props.user,"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ" )
this.props.getUserTeam(this.props.user, this.props.internalToken )
};
onSuccess=e=>{
//fecha o scanner
this.props.addUserTeam({id:this.props.team.id, newQr:e.data}, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ" )
this.props.addUserTeam({id:this.props.team.id, newQr:e.data},this.props.internalToken)
this.setState({addUser:!this.state.addUser})
}
_rm=(qr)=>{
this.props.removeUserTeam({TeamId: this.props.team.id, UserQR: this.props.team.cap.qRcode, UserToRemoveQR: qr},"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ"
)
this.props.removeUserTeam({TeamId: this.props.team.id, UserQR: this.props.team.cap.qRcode, UserToRemoveQR: qr}, this.props.internalToken)
}
_toggle=()=>{
this.setState({addUser:!this.state.addUser})
}
_delTeam=()=>{
Alert.alert(
'Apagar equipa',
'Tens a certeza que queres apagar a tua equipa?\n\nAo apagares a equipa, todos os dados serão perdidos... \n\nThere is no coming back..\n\n',
[
{text: 'No, bring my mommy', onPress: () => alert('pussy!!!!')},
{text: 'YES', onPress: () => this.props.deleteTeam({TeamId: this.props.team.id, UserQr: this.props.user.Code},this.props.internalToken)},
],
{cancelable: false},
);
}
_creatTeam=()=>{
var tipo
if(this.state.switch)
tipo=1
else{
tipo=3
}
var o={
EventId:tipo,
Nome:this.state.team,
capQR:this.props.user.Code
}
this.props.createTeam(o, this.props.internalToken)
}
render() {
const { navigate } = this.props.navigation;
@ -234,7 +266,76 @@ _toggle=()=>{
</View>
</View>
</View>
{ this.props.team=='none' &&
<View style={{backgroundColor:'white', margin:10}}>
<View style={{backgroundColor:'#CC1A17'}}>
<Text style={{ fontSize: 18,
color: "white",
margin: 10,
fontWeight: "bold",
marginBottom: 10}}>Equipas Rally / Caching</Text>
</View>
<View style={{margin:10}}>
<Text style={{fontSize:12, textAlign:'center'}}>Para participares no ENEI caching ou no Rally Tascas deves formar uma equipa (4 a 6) elementos.</Text>
<Text style={{fontSize:12, textAlign:'center', margin:5}}>Ao criares a equipa, ficas como capitão. Podes adicionar e remover outros elementos.</Text>
<TextInput
style={{
borderColor: "#bfbdbd",
borderWidth: 1,
margin:30,
width: SCREEN_WIDTH * 0.8,
backgroundColor: "white",
borderRadius: 3,
height: SCREEN_HEIGHT * 0.08,
borderColor: "#bfbdbd",
borderWidth: 1,
paddingLeft: SCREEN_WIDTH * 0.05}}
onFocus={this._print}
maxLength={50}
blurOnSubmit={true}
onChangeText={t => this.setState({ team:t})}
clearButtonMode="always"
value={this.state.team}
clearTextOnFocus={true}
onSubmitEditing={Keyboard.dismiss}
placeholder="Nome da Equipa"
/>
<View style={{flex:1 ,flexDirection:'row', margin:20, marginBottom:40, alignSelf:'center'}}>
<View style={{width:'33%',alignSelf:'center'}}>
<Text style={{fontWeight:'bold', fontSize:17, textAlign:'center'}}>ENEI Caching</Text>
</View>
<ToggleSwitch
isOn={this.state.switch}
onColor='#CC1A17'
offColor='#eeeeee'
labelStyle={{color: 'black', fontWeight: '900'}}
size='large'
onToggle={ (isOn) => this.setState({switch:!this.state.switch}) }
/><View style={{width:'33%',alignSelf:'center'}}>
<Text style={{fontWeight:'bold', fontSize:17, textAlign:'center'}}>Rally Tascas</Text>
</View>
</View><Text style={{fontSize:12, textAlign:'center', margin:5}}>A incrição no Rally tem custo de 5 por elemento. A equipa apenas fica ativa quando efectuar o pagamento na banca no ENEI</Text>
<Button
onPress={this._creatTeam}
disabled={this.state.team==""}
title={"Criar Equipa"}
color={"#CC1A17"}
>
</Button>
</View>
</View>
}
{
this.props.team!='none' &&
<View>
<View
style={{
@ -251,7 +352,7 @@ _toggle=()=>{
flexDirection: "row"
}}
>
<View style={{ width: "79%" }}>
<View style={{ width: "60%" }}>
<Text
style={{
fontSize: 25,
@ -273,20 +374,41 @@ _toggle=()=>{
{this.props.team.nMembros}/6 elementos
</Text>
</View>
<TouchableOpacity onPress={this._toggle}>
{this.props.team.cap.qRcode == this.props.user.Code && <TouchableOpacity onPress={this._delTeam}>
<View
style={{
alignItems: "center",
alignContent: "center",
alignSelf: "center",
marginTop:7
margin:10
}}
>{this.props.team.nMembros<6 &&
<IconFA name="plus" color={"white"} size={30} />
}{this.props.team.nMembros<6 &&
<Text style={{ color: "white" }}>Adicionar</Text>}
>
<IconFA name="trash-alt" color={"white"} size={30} />
<View>
<Text style={{ color: "white" }}>rm Team </Text>
</View>
</View>
</TouchableOpacity>
</TouchableOpacity>}
{this.props.team.nMembros<6 && <TouchableOpacity onPress={this._toggle}>
<View
style={{
alignItems: "center",
alignContent: "center",
alignSelf: "center",
margin:10
}}
>
<IconFA name="plus" color={"white"} size={30} />
<View>
<Text style={{ color: "white" }}> Add</Text>
</View>
</View>
</TouchableOpacity>}
</View>
<View>
@ -320,6 +442,7 @@ _toggle=()=>{
</View>
</View>
</View>
}
</View>
</ScrollView>
</PTRView>

View File

@ -6,7 +6,8 @@ import {
ImageBackground,
Dimensions,
Button,
TouchableOpacity
TouchableOpacity,
FlatList
} from 'react-native';
import ProgressBarAnimated from 'react-native-progress-bar-animated';
import Modal from "react-native-modal";
@ -21,7 +22,13 @@ const SCREEN_HEIGHT = Dimensions.get("window").height;
const SCREEN_WIDTH = Dimensions.get("window").width;
import FitImage from 'react-native-fit-image';
export default class Jogo extends React.Component {
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import * as Actions from "../store/actions"; //Import your actionss
class Jogo extends React.Component {
state = {
progress: 20,
progressWithOnComplete: 0,
@ -39,6 +46,9 @@ state = {
console.log("assd")
}
componentDidMount(){
this.props.getCromos(this.props.user, this.props.internalToken);
}
render() {
const { navigate } = this.props.navigation;
@ -54,6 +64,7 @@ state = {
return (
@ -175,428 +186,36 @@ onPress={this._toggleModal}
<ScrollView>
<View style={styles.cromosContainer}>
<FlatList
data={this.props.cromos}
renderItem={({item}) => <TouchableOpacity onPress={this._toggleModal}>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/critical.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>0</Text>
</ImageBackground>
</View>
</TouchableOpacity>}
numColumns={3} // Número de colunas
/>
<TouchableOpacity onPress={this._toggleModal}>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/critical.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>0</Text>
</ImageBackground>
</View>
</TouchableOpacity>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/novabase.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>1</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>2</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>3</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>4</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>5</Text>
</ImageBackground>
</View>
</View>
<View style={styles.cromosContainer}>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>6</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/ubiwhere.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>7</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>8</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>9</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>10</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>11</Text>
</ImageBackground>
</View>
</View>
<View style={styles.cromosContainer}>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>12</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>13</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>14</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>15</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>16</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>17</Text>
</ImageBackground>
</View>
</View>
<View style={styles.cromosContainer}>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>18</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>19</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>20</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>21</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>22</Text>
</ImageBackground>
</View>
<View style={styles.cromo}>
<ImageBackground
source={require('../assets/img/jogo/enei_black_2.png')}
style={styles.imageBg}
>
<View style={[styles.triangle, this.props.style]} />
<Text style={styles.points}>15</Text>
<View style={[styles.triangleNumber, this.props.style]} />
<Text style={styles.number}>23</Text>
</ImageBackground>
</View>
</View>
@ -719,4 +338,24 @@ const styles = StyleSheet.create({
marginLeft:103,
textAlign: 'center'
}
});
});
function mapStateToProps(state, props) {
return {
token: state.apiReducer.token,
user: state.apiReducer.user,
internalToken: state.apiReducer.internalToken,
cromos:state.apiReducer.cromos
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(Actions, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(Jogo);

View File

@ -114,98 +114,54 @@ class eventDetail extends React.Component {
<Text style={{ color: "#CC1A17", fontSize: 15 }}>
{info.hora}
</Text>
<Text>{info.horas}</Text>
</View>
</View>
<View>
<View >
<Text
style={{
margin: 10,
marginBottom: 0,
marginTop: 0,
marginBottom:10,
fontSize: 20,
color: "#CC1A17"
}}
>
{info.nome}
</Text>
</View>
<View style={{ margin: 10 }}>
</View>
<View>
<View
style={{
flex: 1,
flexDirection: "row",
marginTop: 10
}}
>
<View style={{ width: 100, height: 100, padding: 5 }}>
<FitImage
source={{
uri:
"https://tickets.enei.pt/adminpoint/Content/Images/Uploads/Speakers/ffb043cb-3073-421c-a070-5d273b50fc23.jpeg"
}}
style={{ padding: 5 }}
/>
</View>
<View>
<Text
style={{
fontWeight: "bold",
fontSize: 20,
margin: 10
}}
>
{info.nome}
</Text>
<Text style={{ marginLeft: 10 }}>
{info.nome}
</Text>
<TouchableOpacity>
<Text
style={{ color: "#CC1A17", marginLeft: 10 }}
>
{info.nome}
</Text>
</TouchableOpacity>
</View>
</View>
<View>
<Text
style={{
fontWeight: "bold",
color: "#CC1A17",
margin: 10,
marginBottom: 0,
fontSize: 15
}}
>
Descrição do orador:
</Text>
<Text style={{ margin: 10 }}>{info.desc}</Text>
</View>
</View>
</View>
<View style={styles.block}>
<Text
<View style={{margin:10}}>
<Text
style={{ fontSize: 15, color: "#CC1A17", fontWeight: "bold" }}
>
Descrição da palestra/workshop
Descrição:
</Text>
<Divider style={{ backgroundColor: "#000" }} />
<View style={{ marginTop: 10 }}>
<Text>{info.desc}</Text>
</View>
<Text
style={{ fontSize: 15, color: "#CC1A17", fontWeight: "bold" ,marginTop:10}}
>
Como posso participar?
</Text>
<Divider style={{ backgroundColor: "#000" }} />
<View style={{ marginTop: 10 }}>
<Text>{info.notas}</Text>
</View>
<Text
style={{ fontSize: 15, color: "#CC1A17", fontWeight: "bold" ,marginTop:10}}
>
Qual é o custo de participação?
</Text>
<Divider style={{ backgroundColor: "#000" }} />
<View style={{ marginTop: 10 }}>
<Text>{info.custo}</Text>
</View>
</View>
</View>
</View>
</View>
</View>
@ -216,10 +172,7 @@ class eventDetail extends React.Component {
Localização
</Text>
<Divider style={{ backgroundColor: "#000", marginBottom: 10 }} />
<Image
source={require("../assets/img/campus.png")}
style={{ width: SCREEN_WIDTH * 0.9 }}
/>
<Text>{info.localizacao}</Text>
</View>
</ScrollView>
<Divider style={{ backgroundColor: "black" }} />

View File

@ -2,8 +2,9 @@
export const GET_TEAM='GET_TEAM'
export const GET_INTERNAL_EVENTS ='GET_INTERNAL_EVENTS'
export const CREATE_TEAM='CREATE_TEAM'
export const DELETE_TEAM='DELETE_TEAM'
export const GET_CROMOS='GET_CROMOS'

View File

@ -25,7 +25,10 @@ import {
UPDATE_USER,
SESSION_DETAIL,
GET_TEAM,
GET_INTERNAL_EVENTS
GET_INTERNAL_EVENTS,
CREATE_TEAM,
DELETE_TEAM,
GET_CROMOS
} from "./actionTypes"; //Import the actions types constant we defined in our actions
import moment from "moment";
@ -38,17 +41,105 @@ import { colors } from "react-native-elements";
const axios = require("axios");
axios.defaults.baseURL = "https://tickets.enei.pt/internal/api";
axios.defaults.baseURL = "https://api.enei.pt/internal/api";
const map = require("lodash/fp/map").convert({ cap: false });
export function getCromos(user,tokenInternal){
axios.defaults.headers.common = {
Authorization: `bearer ${tokenInternal}`
};
axios.defaults.baseURL = "https://api.enei.pt/api";
return dispatch => {
axios
.get(`/Cromos/${user.Code}`)
.then(a => {
console.log("sucesso!");
console.log(a);
dispatch({
type: GET_CROMOS,
cromos: a.data
});
})
.catch(p => {
console.log(p);
Alert.alert("ERRO!", "erro a obter os eventos")
});
dispatch({
type: OPEN_MODAL
});
};
}
export function deleteTeam(data,tokenInternal){
axios.defaults.baseURL = "https://api.enei.pt";
axios.defaults.headers.common = {
Authorization: `bearer ${tokenInternal}`
};
console.log(data)
return dispatch=>{
axios
.post("/api/Teams/delete",data)
.then(a => {
console.log(a.data)
Alert.alert("SUCESSO!", "A equipa foi removida com sucesso")
dispatch({
type: DELETE_TEAM,
});
}).catch(err=>{
console.log(err)
Alert.alert("ERRO!", "Existiu um erro na remoção da equipa")
})
}
}
export function createTeam(team, tokenInternal){
axios.defaults.baseURL = "https://api.enei.pt";
axios.defaults.headers.common = {
Authorization: `bearer ${tokenInternal}`
};
return dispatch=>{
axios
.post("/api/Teams/add",team)
.then(a => {
console.log(a.data)
Alert.alert("SUCESSO!", "A equipa foi criada com sucesso")
dispatch({
type: CREATE_TEAM,
});
}).catch(err=>{
console.log(err)
Alert.alert("ERRO!", "Existiu um erro na criação da equipa")
})
}
}
export function getAllEvents(tokenInternal){
axios.defaults.headers.common = {
Authorization: `bearer ${tokenInternal}`
};
axios.defaults.baseURL = "http://127.0.0.1:5000/api";
axios.defaults.baseURL = "https://api.enei.pt/api";
return dispatch => {
axios
.get('/Events')
@ -83,7 +174,7 @@ export function removeUserTeam(data, tokenInternal){
Authorization: `bearer ${tokenInternal}`
};
axios.defaults.baseURL = "http://127.0.0.1:5000";
axios.defaults.baseURL = "https://api.enei.pt";
return dispatch => {
axios
.post("/api/Teams/remove/member",data)
@ -111,7 +202,7 @@ export function addUserTeam(data, tokenInternal){
axios.defaults.headers.common = {
Authorization: `bearer ${tokenInternal}`
};
axios.defaults.baseURL = "http://127.0.0.1:5000";
axios.defaults.baseURL = "https://api.enei.pt";
return dispatch => {
axios
.post("/api/Teams/add/member",data)
@ -140,7 +231,7 @@ export function getUserTeam(user, tokenInternal) {
axios.defaults.headers.common = {
Authorization: `bearer ${tokenInternal}`
};
axios.defaults.baseURL = "http://127.0.0.1:5000";
axios.defaults.baseURL = "https://api.enei.pt";
return dispatch => {
axios
.get(`/api/Teams/u/${user.Code}`)
@ -154,6 +245,10 @@ export function getUserTeam(user, tokenInternal) {
})
.catch(p => {
console.log(p);
dispatch({
type: GET_TEAM,
team:'none'
});
});
dispatch({

View File

@ -24,7 +24,10 @@ export {checkUser,
getUserTeam,
addUserTeam,
removeUserTeam,
getAllEvents
getAllEvents,
createTeam,
deleteTeam,
getCromos
} from "./api"

View File

@ -20,7 +20,9 @@ import {
UPDATE_USER,
SESSION_DETAIL,
GET_TEAM,
GET_INTERNAL_EVENTS
GET_INTERNAL_EVENTS,
CREATE_TEAM,
GET_CROMOS
} from "../actions/actionTypes"; //Import the actions types constant we defined in our actions
import { REHYDRATE } from "redux-persist";
@ -59,8 +61,9 @@ let apiState = {
alojamento: [],
sessionDetail:{},
team:{},
internalToken: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODM4NTk5LCJleHAiOjE1NTI5MjQ5OTksImlhdCI6MTU1MjgzODU5OX0.KmzDoneEdlzyaTS3N4pSuRYHkdrpTVjPFXVIB4tMKPh1BK4KtIOfqHJ_H3FsrUEkXKb_tnf38swO5SKQ1wt0cg",
eventsInternal:[]
internalToken:"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyOTI4NTgyLCJleHAiOjE1NTMwMTQ5ODIsImlhdCI6MTU1MjkyODU4Mn0.Kwc-vu9lTGFDTKOAt7LKvBb0pnEnF6v30kF-4RjjU8swAwTJLF_oymF-MKOYtpY0a9IRaBK9yrED5b5Wkc2aoQ",
eventsInternal:[],
cromos:[]
};
const apiReducer = (state = apiState, action) => {
@ -109,10 +112,16 @@ const apiReducer = (state = apiState, action) => {
eventsInternal: action.payload.apiReducer.eventsInternal,
alimentacao: action.payload.apiReducer.alimentacao,
acesso: action.payload.apiReducer.acesso,
alojamento: action.payload.apiReducer.alojamento
alojamento: action.payload.apiReducer.alojamento,
internalToken:"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODcwODcwLCJleHAiOjE1NTU0NTkyNzAsImlhdCI6MTU1Mjg3MDg3MH0.wkBk-CUDMCaU-K9jI0pTRJ794IGCl-C9md39dMfHqa5zTf-gNpD76xEYea3PhIbW2dnUVgo0m1fxR1sW7k9LMg"
};
}
case GET_CROMOS:
return Object.assign({}, state, {
cromos: action.cromos
});
case "CHANGE_CONNECTION_STATUS":
return Object.assign({}, state, {

16
App/package-lock.json generated
View File

@ -8170,6 +8170,14 @@
"prop-types": "^15.5.10"
}
},
"react-native-switch": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/react-native-switch/-/react-native-switch-1.5.0.tgz",
"integrity": "sha1-pcjnL4fe9knRyd4CfFrifiA36kA=",
"requires": {
"prop-types": "^15.6.0"
}
},
"react-native-tab-view": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/react-native-tab-view/-/react-native-tab-view-1.3.1.tgz",
@ -9825,6 +9833,14 @@
}
}
},
"toggle-switch-react-native": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/toggle-switch-react-native/-/toggle-switch-react-native-2.0.2.tgz",
"integrity": "sha512-Q7bGEkcPgFsLIa9Io/ZSXA4LIvIxBqothaiUU6b9ay8XXQoKqsgvoPehLVYBvfpnQOmyfZ5NHOdOKiV8ewI6fQ==",
"requires": {
"prop-types": "^15.5.7"
}
},
"tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",

View File

@ -44,6 +44,7 @@
"react-native-qrcode-scanner": "^1.1.2",
"react-native-shadow": "^1.2.2",
"react-native-swiper": "^1.5.14",
"react-native-switch": "^1.5.0",
"react-native-timeline-feed": "^1.0.1",
"react-native-timeline-listview": "^0.2.3",
"react-native-ui-kitten": "^3.1.2",
@ -54,7 +55,8 @@
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0"
"redux-thunk": "^2.3.0",
"toggle-switch-react-native": "^2.0.2"
},
"devDependencies": {
"babel-jest": "23.6.0",

View File

@ -144,7 +144,7 @@ namespace api.Controllers
{
Subject = new ClaimsIdentity(claims),
//data de expiração (atual + 24 horas)
Expires = DateTime.Now.AddDays(1),
Expires = DateTime.Now.AddDays(30),
//passa as signing credentials definidas em cima
SigningCredentials = creds

View File

@ -42,10 +42,10 @@ namespace api.Controllers
allCromos.ForEach(delegate(Cromos c){
for(int i=0;i<usrCromos.Length;i++){
if(Int32.Parse(usrCromos[i])==c.Id){
Cromos toAdd = new Cromos{Id = c.Id,Nome=c.Nome,DescMostrar=c.DescUnlocked,QRCode=c.QRCode,img=c.img};
Cromos toAdd = new Cromos{Id = c.Id,Nome=c.Nome,DescMostrar=c.DescUnlocked,QRCode=c.QRCode,img=c.img, unlocked=true, websiteCromo=c.websiteCromo,pontos=c.pontos};
rList.Add(toAdd);
}else{ //user NAO tem o cromo
Cromos toAdd = new Cromos{Id = c.Id,Nome=c.Nome,DescMostrar=c.DescLocked,QRCode=c.QRCode,img=c.img};
Cromos toAdd = new Cromos{Id = c.Id,Nome=c.Nome,DescMostrar=c.DescLocked,QRCode=c.QRCode,img=c.img , unlocked=false, websiteCromo=c.websiteCromo,pontos=c.pontos};
rList.Add(toAdd);
}
}

View File

@ -0,0 +1,494 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using api.Data;
namespace api.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20190317202540_updatev6")]
partial class updatev6
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<int>("RoleId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<int>("UserId");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("api.Models.Cromos", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DescLocked");
b.Property<string>("DescMostrar");
b.Property<string>("DescUnlocked");
b.Property<string>("Nome");
b.Property<string>("QRCode");
b.Property<int?>("imgId");
b.HasKey("Id");
b.HasIndex("imgId");
b.ToTable("Cromos");
});
modelBuilder.Entity("api.Models.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<string>("Nome");
b.Property<bool>("aDecorrer");
b.Property<string>("custo");
b.Property<string>("horas");
b.Property<string>("imagem");
b.Property<string>("localizacao");
b.Property<string>("notas");
b.HasKey("Id");
b.ToTable("Events");
});
modelBuilder.Entity("api.Models.EventLoc", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<int>("EventId");
b.Property<int?>("ImgId");
b.Property<float>("Lat");
b.Property<float>("Long");
b.Property<string>("Nome");
b.HasKey("Id");
b.HasIndex("ImgId");
b.ToTable("EventLocs");
});
modelBuilder.Entity("api.Models.EventLocVisited", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("LocationId");
b.Property<int?>("TeamId");
b.Property<DateTime>("timestamp");
b.HasKey("Id");
b.HasIndex("LocationId");
b.HasIndex("TeamId");
b.ToTable("EventLocsVisited");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("UserId");
b.Property<int?>("UserId1");
b.Property<int>("amount");
b.Property<int>("available");
b.Property<string>("logType");
b.Property<int?>("productId");
b.Property<string>("transactionId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("UserId1");
b.HasIndex("productId");
b.ToTable("Logs");
});
modelBuilder.Entity("api.Models.Photo", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateAdded");
b.Property<string>("Description");
b.Property<bool>("IsMain");
b.Property<string>("Url");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Photos");
});
modelBuilder.Entity("api.Models.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("basePrice");
b.Property<string>("name");
b.Property<float>("revenue");
b.Property<int>("sold");
b.HasKey("Id");
b.ToTable("Products");
});
modelBuilder.Entity("api.Models.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("api.Models.Team", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("CapQR");
b.Property<int>("EventId");
b.Property<int>("NMembros");
b.Property<string>("Nome");
b.Property<int>("Pontos");
b.Property<bool>("pagamento");
b.Property<string>("pagamentoVerifyCode");
b.HasKey("Id");
b.ToTable("Teams");
});
modelBuilder.Entity("api.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("QRcode");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("cromos");
b.Property<int>("drinks");
b.Property<int>("food");
b.Property<string>("fullName");
b.Property<int?>("teamID");
b.Property<string>("university");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.HasIndex("teamID");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("api.Models.UserRole", b =>
{
b.Property<int>("UserId");
b.Property<int>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("api.Models.Value", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.HasKey("id");
b.ToTable("Values");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("api.Models.Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("api.Models.Cromos", b =>
{
b.HasOne("api.Models.Photo", "img")
.WithMany()
.HasForeignKey("imgId");
});
modelBuilder.Entity("api.Models.EventLoc", b =>
{
b.HasOne("api.Models.Photo", "Img")
.WithMany()
.HasForeignKey("ImgId");
});
modelBuilder.Entity("api.Models.EventLocVisited", b =>
{
b.HasOne("api.Models.EventLoc", "Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("api.Models.Team", "Team")
.WithMany()
.HasForeignKey("TeamId");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.HasOne("api.Models.User")
.WithMany("logsFebrada")
.HasForeignKey("UserId");
b.HasOne("api.Models.User")
.WithMany("logsFestarola")
.HasForeignKey("UserId1");
b.HasOne("api.Models.Product", "product")
.WithMany()
.HasForeignKey("productId");
});
modelBuilder.Entity("api.Models.Photo", b =>
{
b.HasOne("api.Models.User", "User")
.WithMany("Photos")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("api.Models.User", b =>
{
b.HasOne("api.Models.Team", "team")
.WithMany()
.HasForeignKey("teamID");
});
modelBuilder.Entity("api.Models.UserRole", b =>
{
b.HasOne("api.Models.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("api.Models.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class updatev6 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "custo",
table: "Events",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "custo",
table: "Events");
}
}
}

View File

@ -0,0 +1,496 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using api.Data;
namespace api.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20190318021249_cromos")]
partial class cromos
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<int>("RoleId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<int>("UserId");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("api.Models.Cromos", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DescLocked");
b.Property<string>("DescMostrar");
b.Property<string>("DescUnlocked");
b.Property<string>("Nome");
b.Property<string>("QRCode");
b.Property<int?>("imgId");
b.Property<bool>("unlocked");
b.HasKey("Id");
b.HasIndex("imgId");
b.ToTable("Cromos");
});
modelBuilder.Entity("api.Models.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<string>("Nome");
b.Property<bool>("aDecorrer");
b.Property<string>("custo");
b.Property<string>("horas");
b.Property<string>("imagem");
b.Property<string>("localizacao");
b.Property<string>("notas");
b.HasKey("Id");
b.ToTable("Events");
});
modelBuilder.Entity("api.Models.EventLoc", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<int>("EventId");
b.Property<int?>("ImgId");
b.Property<float>("Lat");
b.Property<float>("Long");
b.Property<string>("Nome");
b.HasKey("Id");
b.HasIndex("ImgId");
b.ToTable("EventLocs");
});
modelBuilder.Entity("api.Models.EventLocVisited", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("LocationId");
b.Property<int?>("TeamId");
b.Property<DateTime>("timestamp");
b.HasKey("Id");
b.HasIndex("LocationId");
b.HasIndex("TeamId");
b.ToTable("EventLocsVisited");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("UserId");
b.Property<int?>("UserId1");
b.Property<int>("amount");
b.Property<int>("available");
b.Property<string>("logType");
b.Property<int?>("productId");
b.Property<string>("transactionId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("UserId1");
b.HasIndex("productId");
b.ToTable("Logs");
});
modelBuilder.Entity("api.Models.Photo", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateAdded");
b.Property<string>("Description");
b.Property<bool>("IsMain");
b.Property<string>("Url");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Photos");
});
modelBuilder.Entity("api.Models.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("basePrice");
b.Property<string>("name");
b.Property<float>("revenue");
b.Property<int>("sold");
b.HasKey("Id");
b.ToTable("Products");
});
modelBuilder.Entity("api.Models.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("api.Models.Team", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("CapQR");
b.Property<int>("EventId");
b.Property<int>("NMembros");
b.Property<string>("Nome");
b.Property<int>("Pontos");
b.Property<bool>("pagamento");
b.Property<string>("pagamentoVerifyCode");
b.HasKey("Id");
b.ToTable("Teams");
});
modelBuilder.Entity("api.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("QRcode");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("cromos");
b.Property<int>("drinks");
b.Property<int>("food");
b.Property<string>("fullName");
b.Property<int?>("teamID");
b.Property<string>("university");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.HasIndex("teamID");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("api.Models.UserRole", b =>
{
b.Property<int>("UserId");
b.Property<int>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("api.Models.Value", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.HasKey("id");
b.ToTable("Values");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("api.Models.Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("api.Models.Cromos", b =>
{
b.HasOne("api.Models.Photo", "img")
.WithMany()
.HasForeignKey("imgId");
});
modelBuilder.Entity("api.Models.EventLoc", b =>
{
b.HasOne("api.Models.Photo", "Img")
.WithMany()
.HasForeignKey("ImgId");
});
modelBuilder.Entity("api.Models.EventLocVisited", b =>
{
b.HasOne("api.Models.EventLoc", "Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("api.Models.Team", "Team")
.WithMany()
.HasForeignKey("TeamId");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.HasOne("api.Models.User")
.WithMany("logsFebrada")
.HasForeignKey("UserId");
b.HasOne("api.Models.User")
.WithMany("logsFestarola")
.HasForeignKey("UserId1");
b.HasOne("api.Models.Product", "product")
.WithMany()
.HasForeignKey("productId");
});
modelBuilder.Entity("api.Models.Photo", b =>
{
b.HasOne("api.Models.User", "User")
.WithMany("Photos")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("api.Models.User", b =>
{
b.HasOne("api.Models.Team", "team")
.WithMany()
.HasForeignKey("teamID");
});
modelBuilder.Entity("api.Models.UserRole", b =>
{
b.HasOne("api.Models.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("api.Models.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class cromos : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "unlocked",
table: "Cromos",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "unlocked",
table: "Cromos");
}
}
}

View File

@ -0,0 +1,500 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using api.Data;
namespace api.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20190318021814_cromosV2")]
partial class cromosV2
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<int>("RoleId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<int>("UserId");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("api.Models.Cromos", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DescLocked");
b.Property<string>("DescMostrar");
b.Property<string>("DescUnlocked");
b.Property<string>("Nome");
b.Property<string>("QRCode");
b.Property<int?>("imgId");
b.Property<int>("pontos");
b.Property<bool>("unlocked");
b.Property<string>("websiteCromo");
b.HasKey("Id");
b.HasIndex("imgId");
b.ToTable("Cromos");
});
modelBuilder.Entity("api.Models.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<string>("Nome");
b.Property<bool>("aDecorrer");
b.Property<string>("custo");
b.Property<string>("horas");
b.Property<string>("imagem");
b.Property<string>("localizacao");
b.Property<string>("notas");
b.HasKey("Id");
b.ToTable("Events");
});
modelBuilder.Entity("api.Models.EventLoc", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<int>("EventId");
b.Property<int?>("ImgId");
b.Property<float>("Lat");
b.Property<float>("Long");
b.Property<string>("Nome");
b.HasKey("Id");
b.HasIndex("ImgId");
b.ToTable("EventLocs");
});
modelBuilder.Entity("api.Models.EventLocVisited", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("LocationId");
b.Property<int?>("TeamId");
b.Property<DateTime>("timestamp");
b.HasKey("Id");
b.HasIndex("LocationId");
b.HasIndex("TeamId");
b.ToTable("EventLocsVisited");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("UserId");
b.Property<int?>("UserId1");
b.Property<int>("amount");
b.Property<int>("available");
b.Property<string>("logType");
b.Property<int?>("productId");
b.Property<string>("transactionId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("UserId1");
b.HasIndex("productId");
b.ToTable("Logs");
});
modelBuilder.Entity("api.Models.Photo", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateAdded");
b.Property<string>("Description");
b.Property<bool>("IsMain");
b.Property<string>("Url");
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Photos");
});
modelBuilder.Entity("api.Models.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("basePrice");
b.Property<string>("name");
b.Property<float>("revenue");
b.Property<int>("sold");
b.HasKey("Id");
b.ToTable("Products");
});
modelBuilder.Entity("api.Models.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("api.Models.Team", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("CapQR");
b.Property<int>("EventId");
b.Property<int>("NMembros");
b.Property<string>("Nome");
b.Property<int>("Pontos");
b.Property<bool>("pagamento");
b.Property<string>("pagamentoVerifyCode");
b.HasKey("Id");
b.ToTable("Teams");
});
modelBuilder.Entity("api.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("QRcode");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("cromos");
b.Property<int>("drinks");
b.Property<int>("food");
b.Property<string>("fullName");
b.Property<int?>("teamID");
b.Property<string>("university");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.HasIndex("teamID");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("api.Models.UserRole", b =>
{
b.Property<int>("UserId");
b.Property<int>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("api.Models.Value", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.HasKey("id");
b.ToTable("Values");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("api.Models.Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("api.Models.User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("api.Models.Cromos", b =>
{
b.HasOne("api.Models.Photo", "img")
.WithMany()
.HasForeignKey("imgId");
});
modelBuilder.Entity("api.Models.EventLoc", b =>
{
b.HasOne("api.Models.Photo", "Img")
.WithMany()
.HasForeignKey("ImgId");
});
modelBuilder.Entity("api.Models.EventLocVisited", b =>
{
b.HasOne("api.Models.EventLoc", "Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("api.Models.Team", "Team")
.WithMany()
.HasForeignKey("TeamId");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.HasOne("api.Models.User")
.WithMany("logsFebrada")
.HasForeignKey("UserId");
b.HasOne("api.Models.User")
.WithMany("logsFestarola")
.HasForeignKey("UserId1");
b.HasOne("api.Models.Product", "product")
.WithMany()
.HasForeignKey("productId");
});
modelBuilder.Entity("api.Models.Photo", b =>
{
b.HasOne("api.Models.User", "User")
.WithMany("Photos")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("api.Models.User", b =>
{
b.HasOne("api.Models.Team", "team")
.WithMany()
.HasForeignKey("teamID");
});
modelBuilder.Entity("api.Models.UserRole", b =>
{
b.HasOne("api.Models.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("api.Models.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class cromosV2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "pontos",
table: "Cromos",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "websiteCromo",
table: "Cromos",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "pontos",
table: "Cromos");
migrationBuilder.DropColumn(
name: "websiteCromo",
table: "Cromos");
}
}
}

View File

@ -102,6 +102,12 @@ namespace api.Migrations
b.Property<int?>("imgId");
b.Property<int>("pontos");
b.Property<bool>("unlocked");
b.Property<string>("websiteCromo");
b.HasKey("Id");
b.HasIndex("imgId");
@ -120,6 +126,8 @@ namespace api.Migrations
b.Property<bool>("aDecorrer");
b.Property<string>("custo");
b.Property<string>("horas");
b.Property<string>("imagem");

View File

@ -14,5 +14,10 @@ namespace api.Models
public String DescMostrar{get;set;} //descrição a mostrar
public Photo img {get;set;} //imagem
public string websiteCromo{get;set;}
public Boolean unlocked{get;set;} // se está desbloqueado ou não
public int pontos{get;set;} //pontos que este cromo concede
}
}

View File

@ -18,6 +18,8 @@ namespace api.Models
public string localizacao{get;set;}
public string notas{get;set;}
public string custo{get;set;}
}
}

View File

@ -15,5 +15,7 @@ namespace api.Models
public int Pontos {get;set;} //Postos da equipa
public Boolean pagamento{get;set;}
public string pagamentoVerifyCode{get;set;}
}
}