diff --git a/App/app/Router.js b/App/app/Router.js
index 511994d6..4fa334cd 100755
--- a/App/app/Router.js
+++ b/App/app/Router.js
@@ -104,10 +104,7 @@ const AppStack = createBottomTabNavigator(
},
{
- //initialRouteName: 'Home',
- initialRouteName: 'Eventos',
-
- //initialRouteName: 'Calendário',
+ initialRouteName: 'Home',
tabBarOptions: {
showLabel: true, // hide labels
@@ -125,7 +122,8 @@ const Stack = createStackNavigator({
screen: AppStack,
navigationOptions: ({navigation}) => {
const index = navigation.state.index;
-
+
+
if (navigation.state.routes[index].routeName == 'Home') {
return {
headerTitle: `${navigation.state.routes[index].routeName}`,
diff --git a/App/app/screens/Calendar.js b/App/app/screens/Calendar.js
index b68a44a0..25d9720d 100644
--- a/App/app/screens/Calendar.js
+++ b/App/app/screens/Calendar.js
@@ -19,7 +19,7 @@ import * as Progress from "react-native-progress";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
-
+import PTRView from 'react-native-pull-to-refresh';
import * as Actions from "../store/actions"; //Import your actionss
const formatObj = obj => {
@@ -140,6 +140,10 @@ class Calendar extends React.Component {
constructor() {
super();
}
+ _refresh=()=>{
+ this.props.getEvents(this.props.user);
+ this.props.getSessions(this.props.userDetails.token);
+ }
render() {
const ThirdRoute = () => (
@@ -275,7 +279,9 @@ class Calendar extends React.Component {
);
return (
+
+
{this.props.careerPath != undefined && (
)}
+
+
+
+
);
}
}
diff --git a/App/app/screens/Home.js b/App/app/screens/Home.js
index ff426610..8feea804 100755
--- a/App/app/screens/Home.js
+++ b/App/app/screens/Home.js
@@ -155,10 +155,11 @@ _update=()=>{
+ {this.props.user!=undefined &&
{this.props.user.Name}
-
+ }
{this.props.user.Company}
-
+
diff --git a/App/app/screens/calendarDetail.js b/App/app/screens/calendarDetail.js
index 0e52228c..52b2c270 100644
--- a/App/app/screens/calendarDetail.js
+++ b/App/app/screens/calendarDetail.js
@@ -50,11 +50,12 @@ const formatObj = (obj) => {
class calendarDetail extends React.Component {
+
static navigationOptions = ({navigation}) => ({
header: (
),
});
@@ -67,6 +68,11 @@ class calendarDetail extends React.Component {
this.props.getEvents(this.props.user);
console.log('didMount');
console.log(this.props.events);
+ const {navigation} = this.props;
+ const info = navigation.getParam('info', 'error');
+ console.log("putas")
+ console.log(info)
+
}
@@ -103,29 +109,35 @@ class calendarDetail extends React.Component {
renderDescription = (info) => {
return (
-
+
- Onde está o ramo? xD
+
{info.time === info.timeEnd ? info.time : `${info.time} - ${info.timeEnd}`}
-
-
- Attendee Name
+ {info.name}
+
+
+
- {info.Enrolled} / {info.MaxAttendees}
+ {info.Enrolled} / {info.MaxAttendees}
+
+
+
+ Descrição
+
-
+
Descrição
-
+
{info.description}
@@ -197,7 +209,7 @@ class calendarDetail extends React.Component {
render() {
const {navigation} = this.props;
const info = navigation.getParam('info', 'error');
- console.log(info);
+
return (
@@ -209,15 +221,15 @@ class calendarDetail extends React.Component {
{this.renderDescription(info)}
-
+
Localização
-
+
- {this.renderAttendee()}
+
)
@@ -227,6 +239,12 @@ class calendarDetail extends React.Component {
const styles = StyleSheet.create({
+ block:{
+ marginTop:15,
+
+ backgroundColor:'white',
+ padding:20
+ },
AttendeeContainer: {
flexDirection: 'row',
height: 55,
@@ -286,8 +304,8 @@ const styles = StyleSheet.create({
ramoText: {
alignSelf: 'flex-start',
marginBottom: 5,
- color: '#000',
- fontSize: 20,
+ color: 'white',
+ fontSize: 17,
fontWeight: '400',
},
@@ -310,10 +328,17 @@ const styles = StyleSheet.create({
//marginBottom: 55,
},
+ header:{
+ flex: 1,
+ padding: 10,
+ backgroundColor: 'white',
+ borderRadius: 0,
+
+ },
cardContainer: {
flex: 1,
padding: 10,
- margin: 20,
+ // margin: 20,
backgroundColor: 'white',
borderRadius: 5,
},
@@ -412,7 +437,8 @@ function mapStateToProps(state, props) {
token: state.apiReducer.token,
user: state.apiReducer.user,
logged: state.apiReducer.logged,
- events: state.apiReducer.events
+ events: state.apiReducer.events,
+ careerPath: state.apiReducer.careerPath,
}
}
diff --git a/App/app/screens/choosePath.js b/App/app/screens/choosePath.js
index b9994a66..a32f079a 100644
--- a/App/app/screens/choosePath.js
+++ b/App/app/screens/choosePath.js
@@ -324,7 +324,14 @@ class choosePath extends React.Component {
{this._verifySession(item[index].Id) && (
{}}
+ onPress={() => {
+
+ this.props.removeSession(
+ this.props.user,
+ this.props.userDetails.token,
+ item[index].Id
+ );
+ }}
style={{ flex: 1, alignSelf: "center" }}
>
@@ -339,11 +346,14 @@ class choosePath extends React.Component {
{!this._verifySession(item[index].Id) && (
{
- this.props.waitChangeGuest()
+
+ //this.props.waitChangeGuest()
this.props.signSession(
+ this.props.user,
this.props.userDetails.token,
item[index].Id
);
+
}}
style={{ flex: 1, alignSelf: "center" }}
>
@@ -395,11 +405,12 @@ class choosePath extends React.Component {
{(this.props.changingGuest || this.props.Blocks == true) && (
+
+ style={{ alignContent: "center" , alignSelf:'center', marginTop:SCREEN_HEIGHT*0.2}}
+ />
)}
diff --git a/App/app/store/actions/actionTypes.js b/App/app/store/actions/actionTypes.js
index 3fbac2f8..7c87f7ae 100644
--- a/App/app/store/actions/actionTypes.js
+++ b/App/app/store/actions/actionTypes.js
@@ -17,6 +17,7 @@ export const CHANGE_GUEST = 'CHANGE_GUEST'
export const GET_SESSIONS= 'GET_SESSIONS'
export const SIGN_SESSION= 'SIGN_SESSION'
export const WAIT_CHANGE='WAIT_CHANGE'
+export const REMOVE_SESSION = 'REMOVE_SESSION'
//UI
diff --git a/App/app/store/actions/api.js b/App/app/store/actions/api.js
index b5466f1b..e2eb66d4 100644
--- a/App/app/store/actions/api.js
+++ b/App/app/store/actions/api.js
@@ -1,6 +1,6 @@
import { AsyncStorage } from "react-native";
-import { NetInfo , Alert} from "react-native";
+import { NetInfo, Alert } from "react-native";
var _ = require("lodash");
@@ -20,7 +20,8 @@ import {
WAIT_CHANGE,
SIGN_SESSION,
OPEN_MODAL,
- LOADINGLOGIN
+ LOADINGLOGIN,
+ REMOVE_SESSION
} from "./actionTypes"; //Import the actions types constant we defined in our actions
import moment from "moment";
@@ -39,43 +40,36 @@ axios.defaults.baseURL = "http://enei2019.uingress.com/internal/api";
const map = require("lodash/fp/map").convert({ cap: false });
-
-export function waitLogin(){
- return dispatch=>{
- dispatch({
- type: LOADINGLOGIN,
-
- });
- }
-}
-
-
-//faz autenticação com API interna
-export function loginInternal(userDetails){
- axios.defaults.baseURL = "http://127.0.0.1:5000";
+export function waitLogin() {
return dispatch => {
-
- axios.post('/api/login',{
- "username": "cena",
- "password": "password"
-
- }).then(a=>{
- console.log("sucesso!")
- console.log(a)
- }).catch(p=>{
- console.log(p)
- })
-
dispatch({
- type: OPEN_MODAL,
-
+ type: LOADINGLOGIN
});
};
-
-
}
+//faz autenticação com API interna
+export function loginInternal(userDetails) {
+ axios.defaults.baseURL = "http://127.0.0.1:5000";
+ return dispatch => {
+ axios
+ .post("/api/login", {
+ username: "cena",
+ password: "password"
+ })
+ .then(a => {
+ console.log("sucesso!");
+ console.log(a);
+ })
+ .catch(p => {
+ console.log(p);
+ });
+ dispatch({
+ type: OPEN_MODAL
+ });
+ };
+}
export function openModal(info, t) {
return dispatch => {
@@ -124,27 +118,27 @@ function getCareerPath(sessions) {
for (let key in sessions) {
if (sessions[key].Name == "IA") {
careerPath = "Artificial Inteligence";
- careerColor='#CC1A17'
+ careerColor = "#CC1A17";
}
if (sessions[key].Name == "IOT") {
careerPath = "Internet of Things";
- careerColor= "green"
+ careerColor = "green";
}
if (sessions[key].Name == "WEB") {
careerPath = "Web Development";
- careerColor="purple"
+ careerColor = "purple";
}
if (sessions[key].Name == "NET") {
careerPath = "Networking and Security";
- careerColor="blue"
+ careerColor = "blue";
}
if (sessions[key].Name == "MOB") {
careerPath = "Mobile Development";
- careerColor="orange"
+ careerColor = "orange";
}
- if(sessions[key].Name=="DS"){
- careerPath="Data Science"
- careerColor="yellow"
+ if (sessions[key].Name == "DS") {
+ careerPath = "Data Science";
+ careerColor = "yellow";
}
}
return { name: careerPath, color: careerColor };
@@ -169,8 +163,84 @@ export const connectionState = status => {
return { type: "CHANGE_CONNECTION_STATUS", isConnected: status };
};
+export function removeSession(user,token, idSession) {
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
+
+ var obj = {
+ IdSession: idSession,
+ Direction: 0
+ };
+
+ return dispatch => {
+ //adiciona participante a uma palestra
+ axios
+ .post("/Session/RemoveAttendee", obj)
+ //se não existir erro na chamada...
+ .then(a => {
+ console.log(a)
+ if (a.data.Success) {
+ axios
+ .get("/Attendee/AvailableSessions")
+
+ .then(function(response) {
+ console.log(response);
+
+ var sessions = response.data;
+ var careerPath = getCareerPath(sessions);
+ var cenas = [];
+
+ const result = flow(groupBy("SessionStart"))(response.data);
+
+ for (let key in result) {
+ result[key].option = 0;
+ cenas.push(result[key]);
+ }
+
+ Alert.alert("Sucesso","A inscrição na sessão foi removida com sucesso!");
+
+ //obter informações pessoais:
+ axios
+ .get("/Attendee/Detail")
+
+ .catch(error => {
+ alert(error);
+ })
+ .then(sucess => {
+ dispatch({
+ type: REMOVE_SESSION,
+ sessions: response.data,
+ Blocks: cenas,
+ changeGuestList: false,
+ careerPath: careerPath,
+ user: sucess.data
+ });
+ getEvents(user);
+ });
+ })
+ .catch(function(error) {
+ alert("Erro a obter sessões disponíveis!!");
+
+ console.log(error);
+ });
+ } else {
+
+ alert("Erro a inscrever na palestra");
+ dispatch({
+ type: REMOVE_SESSION,
+ waitChangeGuest: false
+ });
+ }
+ })
+ .catch(b => {
+ alert("Erro a inscrever na palestra");
+ });
+ };
+}
+
//inscrição em palestra através de ID
-export function signSession(token, idSession) {
+export function signSession(user,token, idSession) {
axios.defaults.headers.common = {
Authorization: `bearer ${token.access_token}`
};
@@ -204,8 +274,8 @@ export function signSession(token, idSession) {
cenas.push(result[key]);
}
- alert("Inscrição efectuada com sucesso");
-
+ Alert.alert("Sucesso","Inscrição na sessão efectuada com sucesso");
+
//obter informações pessoais:
axios
.get("/Attendee/Detail")
@@ -222,15 +292,16 @@ export function signSession(token, idSession) {
careerPath: careerPath,
user: sucess.data
});
+ getEvents(user);
});
})
.catch(function(error) {
- alert("Erro a obter sessões disponíveis!!");
-
+
console.log(error);
});
} else {
- alert("Erro a inscrever na palestra");
+
+ Alert.alert("ERRO!!",a.data.Error);
dispatch({
type: SIGN_SESSION,
waitChangeGuest: false
@@ -238,7 +309,8 @@ export function signSession(token, idSession) {
}
})
.catch(b => {
- alert("Erro a inscrever na palestra");
+ // alert("Erro a inscrever na palestra");
+
});
};
}
@@ -327,7 +399,6 @@ export function getAvailableGuestlists(token) {
*/
export function changeGuestList(token, guestID) {
-
//http://enei2019.uingress.com/internal/api/Attendee/ChangeGuestlist/
axios.defaults.headers.common = {
@@ -340,7 +411,7 @@ export function changeGuestList(token, guestID) {
axios
.get(full)
.then(function(response) {
- console.log(response)
+ console.log(response);
axios.defaults.baseURL = "http://enei2019.uingress.com/internal/api";
axios.defaults.headers.common = {
@@ -355,7 +426,7 @@ export function changeGuestList(token, guestID) {
//console.log(response);
var cenas = [];
- c= getCareerPath(response.data);
+ c = getCareerPath(response.data);
const result = flow(
groupBy("SessionStart")
// map((Id) => ({Id})),
@@ -463,10 +534,10 @@ export function getEvents(user) {
return dispatch => {
let events = [];
console.log("chegou aqui");
-var i=0
+ var i = 0;
for (let key in user.Sessions) {
events.push({
- key:i++,
+ key: i++,
time: moment(user.Sessions[key].SessionStart).format("HH:mm"),
timeEnd: moment(user.Sessions[key].SessionEnd).format("HH:mm"),
//lineColor:'#009688',
@@ -479,48 +550,43 @@ var i=0
day: moment(user.Sessions[key].SessionStart).format("DD")
});
}
-
- const result = flow(
- groupBy("day")
-
-
- )(events);
+ const result = flow(groupBy("day"))(events);
-
- var cenas=[];
+ var cenas = [];
for (let key in result) {
cenas.push(result[key]);
console.log();
}
- console.log(".--------")
+ console.log(".--------");
console.log(cenas);
- console.log(".--------")
-
- var a=[], b=[],c=[],d=[]
-
+ console.log(".--------");
+
+ var a = [],
+ b = [],
+ c = [],
+ d = [];
+
for (let key in cenas[0]) {
a.push({
- time:cenas[0][key].time ,
+ time: cenas[0][key].time,
timeEnd: cenas[0][key].timeEnd,
- imageUrl:cenas[0][key].imageUrl,
+ imageUrl: cenas[0][key].imageUrl,
description: cenas[0][key].description,
- name:cenas[0][key].name,
+ name: cenas[0][key].name,
Enrolled: cenas[0][key].Enrolled,
MaxAttendees: cenas[0][key].MaxAttendees,
day: cenas[0][key].day
});
}
-
-
-
+
for (let key in cenas[1]) {
b.push({
- time:cenas[1][key].time ,
+ time: cenas[1][key].time,
timeEnd: cenas[1][key].timeEnd,
- imageUrl:cenas[1][key].imageUrl,
+ imageUrl: cenas[1][key].imageUrl,
description: cenas[1][key].description,
- name:cenas[1][key].name,
+ name: cenas[1][key].name,
Enrolled: cenas[1][key].Enrolled,
MaxAttendees: cenas[1][key].MaxAttendees,
day: cenas[1][key].day
@@ -528,11 +594,11 @@ var i=0
}
for (let key in cenas[2]) {
c.push({
- time:cenas[2][key].time ,
+ time: cenas[2][key].time,
timeEnd: cenas[2][key].timeEnd,
- imageUrl:cenas[2][key].imageUrl,
+ imageUrl: cenas[2][key].imageUrl,
description: cenas[2][key].description,
- name:cenas[2][key].name,
+ name: cenas[2][key].name,
Enrolled: cenas[2][key].Enrolled,
MaxAttendees: cenas[2][key].MaxAttendees,
day: cenas[2][key].day
@@ -541,29 +607,35 @@ var i=0
for (let key in cenas[3]) {
d.push({
- time:cenas[3][key].time ,
+ time: cenas[3][key].time,
timeEnd: cenas[3][key].timeEnd,
- imageUrl:cenas[3][key].imageUrl,
+ imageUrl: cenas[3][key].imageUrl,
description: cenas[3][key].description,
- name:cenas[3][key].name,
+ name: cenas[3][key].name,
Enrolled: cenas[3][key].Enrolled,
MaxAttendees: cenas[3][key].MaxAttendees,
day: cenas[3][key].day
});
}
- a=_.sortBy(a, function(o) { return o.time; });
- b=_.sortBy(b, function(o) { return o.time; });
- c=_.sortBy(c, function(o) { return o.time; });
- d=_.sortBy(d, function(o) { return o.time; });
+ a = _.sortBy(a, function(o) {
+ return o.time;
+ });
+ b = _.sortBy(b, function(o) {
+ return o.time;
+ });
+ c = _.sortBy(c, function(o) {
+ return o.time;
+ });
+ d = _.sortBy(d, function(o) {
+ return o.time;
+ });
dispatch({
-
type: GET_EVENTS,
- events:a,
- day1:a,
- day2:b,
- day3:c,
- day4:d
-
+ events: a,
+ day1: a,
+ day2: b,
+ day3: c,
+ day4: d
});
};
}
@@ -653,54 +725,56 @@ export function login(user, pass) {
logged: false,
failedAttempt: true,
tokenData: "error",
- user: { Name: "" },
+ user: { Name: "" }
});
})
- .catch(err=>{
- console.log("error")
+ .catch(err => {
+ console.log("error");
})
.then(res => res.json())
.then(parsed => {
- console.log(parsed)
+ console.log(parsed);
if (
parsed.error_description ==
"Provided username and password is incorrect"
) {
- Alert.alert("Dados Inválidos","Podes sempre fazer reset da password para o email.")
-
+ Alert.alert(
+ "Dados Inválidos",
+ "Podes sempre fazer reset da password para o email."
+ );
+
dispatch({
type: API_LOGIN,
logged: false,
failedAttempt: true,
token: obj,
user: { Name: "Henrique" },
- userDetails:{},
- waitLogin:false,
- onHold:false
-
+ userDetails: {},
+ waitLogin: false,
+ onHold: false
});
return;
- }
- else{
- var obj = {
- access_token: parsed.access_token,
- expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
- refreshToken: parsed.refresh_token,
- valid: true
- };
+ } else {
+ var obj = {
+ access_token: parsed.access_token,
+ expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
+ refreshToken: parsed.refresh_token,
+ valid: true
+ };
- var details = {
- username: user,
- password: pass
- };
- dispatch({
- type: API_LOGIN,
- logged: true,
- failedAttempt: false,
- token: obj,
- user: { Name: "Henrique" },
- userDetails: details
- });}
+ var details = {
+ username: user,
+ password: pass
+ };
+ dispatch({
+ type: API_LOGIN,
+ logged: true,
+ failedAttempt: false,
+ token: obj,
+ user: { Name: "Henrique" },
+ userDetails: details
+ });
+ }
});
};
}
diff --git a/App/app/store/actions/index.js b/App/app/store/actions/index.js
index 9c16481c..d8467420 100644
--- a/App/app/store/actions/index.js
+++ b/App/app/store/actions/index.js
@@ -16,7 +16,9 @@ export {checkUser,
openModal,
closeModal,
loginInternal,
- waitLogin
+ waitLogin,
+ removeSession
+
} from "./api"
export {
diff --git a/App/app/store/reducers/api.js b/App/app/store/reducers/api.js
index bca3c594..ae7a5d55 100644
--- a/App/app/store/reducers/api.js
+++ b/App/app/store/reducers/api.js
@@ -15,8 +15,8 @@ import {
SIGN_SESSION,
OPEN_MODAL,
CLOSE_MODAL,
- LOADINGLOGIN
-
+ LOADINGLOGIN,
+ REMOVE_SESSION
} from "../actions/actionTypes"; //Import the actions types constant we defined in our actions
import { REHYDRATE } from "redux-persist";
@@ -42,13 +42,12 @@ let apiState = {
sessions: {},
Blocks: {},
onHoldBlocks: true,
- careerPath:{name:'Sem Career Path', color:'#eeeeee'},
- a:{},
- b:{},
- c:{},
- d:{},
- loadingLogin:false,
-
+ careerPath: { name: "Sem Career Path", color: "#eeeeee" },
+ a: {},
+ b: {},
+ c: {},
+ d: {},
+ loadingLogin: false
};
const apiReducer = (state = apiState, action) => {
@@ -101,7 +100,7 @@ const apiReducer = (state = apiState, action) => {
});
case LOADINGLOGIN:
- state= Object.assign({}, state, {loadingLogin:true});
+ state = Object.assign({}, state, { loadingLogin: true });
case HOLD:
state = Object.assign({}, state, { onHold: true });
@@ -118,7 +117,7 @@ const apiReducer = (state = apiState, action) => {
username: action.userDetails.username,
password: action.userDetails.password
},
- loadingLogin:false,
+ loadingLogin: false,
onHold: action.onHold
});
@@ -137,7 +136,11 @@ const apiReducer = (state = apiState, action) => {
return state;
case LOGOUT_USER:
- state = Object.assign({}, state, { user:{}, userDetails:{}, logged:false});
+ state = Object.assign({}, state, {
+ user: {},
+ userDetails: {},
+ logged: false
+ });
return state;
@@ -151,12 +154,28 @@ const apiReducer = (state = apiState, action) => {
return state;
case GET_EVENTS:
- state = Object.assign({}, state, { events: action.events , a:action.day1, b:action.day2, c:action.day3, d:action.day4});
+ state = Object.assign({}, state, {
+ events: action.events,
+ a: action.day1,
+ b: action.day2,
+ c: action.day3,
+ d: action.day4
+ });
return state;
+ case REMOVE_SESSION:
+ state = Object.assign({}, state, {
+ sessions: action.sessions,
+ Blocks: action.Blocks,
+ careerPath: action.careerPath,
+ changingGuest: action.changingGuest,
+ user: action.user
+ });
+ return state;
+
case OPEN_MODAL:
- console.log("open modal")
+ console.log("open modal");
state = Object.assign({}, state, {
modalOpen: true,
modalInfo: action.modalInfo,
@@ -173,13 +192,25 @@ const apiReducer = (state = apiState, action) => {
return state;
case SIGN_SESSION:
- state = Object.assign({}, state, {
+
+ if(action.sessions==undefined || action.Blocks==undefined || action.user==undefined){
+ state = Object.assign({}, state, {
+
+ changingGuest: false,
+
+ });
+ }
+ else{
+ state = Object.assign({}, state, {
sessions: action.sessions,
Blocks: action.Blocks,
careerPath: action.careerPath,
- changingGuest: action.changingGuest,
- user:action.user
+ changingGuest: false,
+ user: action.user
});
+ }
+
+
return state;
case SESSION_BLOCKS:
diff --git a/api/Controllers/AuthController.cs b/api/Controllers/AuthController.cs
index 94f95a04..62c714b0 100755
--- a/api/Controllers/AuthController.cs
+++ b/api/Controllers/AuthController.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
+using System.Net.Http;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
@@ -14,6 +15,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
+using Newtonsoft.Json.Linq;
namespace api.Controllers
{
@@ -30,15 +32,18 @@ namespace api.Controllers
public IUsersRepository _repo { get; }
private readonly IMapper _mapper;
private readonly RoleManager _roleManager;
+ private readonly System.Net.Http.IHttpClientFactory clientFactory;
- public AuthController(IConfiguration config, UserManager UserManager, SignInManager SignInManager, IMapper mapper, RoleManager roleManager, IUsersRepository repo)
+ public AuthController(IConfiguration config, UserManager UserManager, SignInManager SignInManager, IMapper mapper, RoleManager roleManager, IUsersRepository repo, System.Net.Http.IHttpClientFactory clientFactory)
{
_mapper = mapper;
_roleManager = roleManager;
_repo = repo;
+ this.clientFactory = clientFactory;
this.config = config;
_userManager = UserManager;
_signInManager = SignInManager;
+
}
@@ -80,6 +85,40 @@ namespace api.Controllers
}
+ [HttpPost("loginQR")]
+ public async Task loginQr(UserForLoginDto userLoginDTO){
+
+ var token= "_A6q1cVGa12QutCrYCsYETfz9nPspnbcnPqjD-87kDaYPr99ArEfpdRTbkEzA4p-WEJzPFQhsMX7nG5BmUm0E6RTju8vQHnaTjGd80NIqUCr-jXefUtGwyl6I00fGD4sN6psW714JnCFuZRbtZbIXsdIRKmD3b8YUpPo2lvYP8SzjoEgACyabj13T3CLpHF43PI8Dvny6ylW6j0ka5qGNvw5MHVvYFURUPiTA7hlxoyQ35eOqHE8-eIiLNSTUJW7q-o8CxIGqGWSkltKPxbrY-Xo5iYagUucesqmj64VxYs";
+ using (var client = new HttpClient())
+ {
+ try{
+
+ var url = "http://enei2019.uingress.com/internal/api/Attendee/Detail";
+
+ client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
+
+
+ var response = await client.GetStringAsync(url);
+
+ Console.WriteLine(response);
+
+ //var resource = JObject.Parse(response);
+
+ return Ok(response);
+
+ }catch(Exception e){
+
+ Console.WriteLine(e);
+
+ return Unauthorized();
+
+ }
+
+
+ }
+ }
+
+
private async Task GenerateJwtToken(User user)
{
var claims = new List
diff --git a/api/Dtos/tokenDto.cs b/api/Dtos/tokenDto.cs
new file mode 100644
index 00000000..320fb075
--- /dev/null
+++ b/api/Dtos/tokenDto.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class tokenDto
+ {
+
+ public string access_token{get;set;} //teamid
+
+
+ public string token_type{get;set;} //user qr
+
+
+ public int expires_in{get;set;}
+
+ public string refresh_token{get;set;}
+
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/userDetails.cs b/api/Dtos/userDetails.cs
new file mode 100644
index 00000000..2b20ca0e
--- /dev/null
+++ b/api/Dtos/userDetails.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class userDetails
+ {
+
+ public string name{get;set;} //teamid
+
+
+ public string qr{get;set;} //user qr
+
+
+ }
+}
\ No newline at end of file
diff --git a/api/Startup.cs b/api/Startup.cs
index 9098d755..4e8fbf77 100755
--- a/api/Startup.cs
+++ b/api/Startup.cs
@@ -42,7 +42,7 @@ namespace api
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
-
+ services.AddHttpClient();
services.AddAutoMapper();
services.AddScoped();
services.AddScoped();
diff --git a/api/api.csproj b/api/api.csproj
index e635582b..ee701902 100755
--- a/api/api.csproj
+++ b/api/api.csproj
@@ -3,12 +3,13 @@
netcoreapp2.1
-
+
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/api/obj/Debug/netcoreapp2.1/project.razor.json b/api/obj/Debug/netcoreapp2.1/project.razor.json
index 04482418..d0f0bc73 100644
--- a/api/obj/Debug/netcoreapp2.1/project.razor.json
+++ b/api/obj/Debug/netcoreapp2.1/project.razor.json
@@ -1,5 +1,5 @@
{
- "ProjectFilePath": "c:\\Users\\ZMiguel\\Desktop\\ENEI2019\\api\\api.csproj",
+ "ProjectFilePath": "/Users/henrique/ENEI2019/api/api.csproj",
"TargetFramework": "netcoreapp2.1",
"TagHelpers": [],
"Configuration": {