diff --git a/App/app/Router.js b/App/app/Router.js
index 7e32d92d..74783cfe 100755
--- a/App/app/Router.js
+++ b/App/app/Router.js
@@ -23,8 +23,7 @@ import Scan from './screens/Scan'
import Calendar from './screens/Calendar'
import Home from './screens/Home'
-import febrada from './screens/febrada'
-import compras from './screens/compras'
+
/*Icons*/
@@ -184,12 +183,6 @@ const Stack = createStackNavigator({
},
calendarDetail:{
screen:calendarDetail
- },
- febrada:{
- screen:febrada
- },
- compras:{
- screen: compras
}
diff --git a/App/app/screens/Home.js b/App/app/screens/Home.js
index 7c1d6c64..ff426610 100755
--- a/App/app/screens/Home.js
+++ b/App/app/screens/Home.js
@@ -162,8 +162,7 @@ _update=()=>{
-
- this.props.navigation.navigate('compras')}>
+
O meu saldo:
@@ -182,7 +181,7 @@ _update=()=>{
-
+
diff --git a/App/app/screens/compras.js b/App/app/screens/compras.js
deleted file mode 100644
index bca054e3..00000000
--- a/App/app/screens/compras.js
+++ /dev/null
@@ -1,102 +0,0 @@
-import * as React from 'react';
-import {View, StyleSheet, Dimensions, Image, ScrollView, Text, Button, TouchableOpacity, Animated} from 'react-native';
-import {TabView, TabBar, SceneMap} from 'react-native-tab-view';
-import {
- RkButton, RkCard, RkText,
- RkTheme
-} from 'react-native-ui-kitten';
-import Timeline from 'react-native-timeline-feed'
-
-import * as Progress from 'react-native-progress';
-
-
-import {connect} from 'react-redux';
-
-import {bindActionCreators} from 'redux';
-
-import * as Actions from '../store/actions'; //Import your actionss
-
-
-import { Slider } from 'react-native-elements';
-function round(value, decimals) {
- return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
- }
-const SCREEN_HEIGHT = Dimensions.get("window").height;
-const SCREEN_WIDTH = Dimensions.get("window").width;
-class compras extends React.Component {
-
- state = {
- index: 0,
- value:0
- };
-
- componentDidMount() {
-
- this.props.getEvents(this.props.user);
- console.log('didMount');
- console.log(this.props.events);
- }
-
-
-
-
-
-
- constructor() {
-
- super()
-
-
- }
-
- render() {
-
-
- return (
-
-
- this.setState({ value })}
- />
- Finos: {Math.round(this.state.value)}
-
-Preço Unitário : { round(0.598 + 0.63 * Math.pow(Math.E ,(-0.221* this.state.value)),2)}€
-Preço total: {round((0.598 + 0.63 * Math.pow(Math.E ,(-0.221* this.state.value)))* this.state.value,2)}
-
- );
- }
-}
-
-const styles = StyleSheet.create({
-
-});
-
-
-
-function mapStateToProps(state, props) {
-
- return {
-
- token: state.apiReducer.token,
- user: state.apiReducer.user,
- logged: state.apiReducer.logged,
- events: state.apiReducer.events,
- userDetails: state.apiReducer.userDetails,
-
- }
-}
-
-function mapDispatchToProps(dispatch) {
-
- return bindActionCreators(Actions, dispatch);
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(compras);
\ No newline at end of file
diff --git a/App/app/screens/febrada.js b/App/app/screens/febrada.js
deleted file mode 100644
index 7b79709a..00000000
--- a/App/app/screens/febrada.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import * as React from 'react';
-import {View, StyleSheet, Dimensions, Image, ScrollView, Text, Button, TouchableOpacity, Animated} from 'react-native';
-import {TabView, TabBar, SceneMap} from 'react-native-tab-view';
-import {
- RkButton, RkCard, RkText,
- RkTheme
-} from 'react-native-ui-kitten';
-import Timeline from 'react-native-timeline-feed'
-
-import * as Progress from 'react-native-progress';
-
-
-import {connect} from 'react-redux';
-
-import {bindActionCreators} from 'redux';
-
-import * as Actions from '../store/actions'; //Import your actionss
-
-
-import { Slider } from 'react-native-elements';
-
-const SCREEN_HEIGHT = Dimensions.get("window").height;
-const SCREEN_WIDTH = Dimensions.get("window").width;
-class febrada extends React.Component {
-
- state = {
- index: 0,
-
- };
-
- componentDidMount() {
-
- this.props.getEvents(this.props.user);
- console.log('didMount');
- console.log(this.props.events);
- }
-
-
-
-
-
-
- constructor() {
-
- super()
-
-
- }
-
- render() {
-
-
- return (
-
-
- this.setState({ value })}
- />
- Value: {Math.round(this.state.value)}
-
- );
- }
-}
-
-const styles = StyleSheet.create({
-
-});
-
-
-
-function mapStateToProps(state, props) {
-
- return {
-
- token: state.apiReducer.token,
- user: state.apiReducer.user,
- logged: state.apiReducer.logged,
- events: state.apiReducer.events,
- userDetails: state.apiReducer.userDetails,
-
- }
-}
-
-function mapDispatchToProps(dispatch) {
-
- return bindActionCreators(Actions, dispatch);
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(febrada);
\ No newline at end of file
diff --git a/App/app/store/actions/actionTypes.js b/App/app/store/actions/actionTypes.js
index f1d3992b..e2e128e8 100644
--- a/App/app/store/actions/actionTypes.js
+++ b/App/app/store/actions/actionTypes.js
@@ -17,8 +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 SESSION_BLOCKS='SESSION_BLOCKS'
-export const TIMERWAIT_CHANGE='TIMERWAIT_CHANGE'
+
//UI
diff --git a/App/app/store/actions/api.js b/App/app/store/actions/api.js
index 6abd9bc1..b7e833b0 100644
--- a/App/app/store/actions/api.js
+++ b/App/app/store/actions/api.js
@@ -444,10 +444,11 @@ var i=0
const result = flow(
groupBy("day")
+
)(events);
-
+
var cenas=[];
for (let key in result) {
cenas.push(result[key]);
@@ -471,6 +472,9 @@ var i=0
day: cenas[0][key].day
});
}
+
+
+
for (let key in cenas[1]) {
b.push({
time:cenas[1][key].time ,
@@ -508,6 +512,10 @@ var i=0
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; });
dispatch({
type: GET_EVENTS,
diff --git a/App/ios/app.xcodeproj/project.pbxproj b/App/ios/app.xcodeproj/project.pbxproj
index 70265e13..45d672e3 100644
--- a/App/ios/app.xcodeproj/project.pbxproj
+++ b/App/ios/app.xcodeproj/project.pbxproj
@@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {
-
/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -36,7 +35,6 @@
2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
2DCD954D1E0B4F2C00145EB5 /* appTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* appTests.m */; };
2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
- 4EBB88037B054A508BF35245 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F42241E0235464C91B24049 /* libRNDeviceInfo.a */; };
514DB1DF2E3B452F9EF272E3 /* libRNVectorIcons-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 95B0A42B6CD8441E904E6EB9 /* libRNVectorIcons-tvOS.a */; };
69E1B84AE0DF486CB1B1D226 /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C00CE8A4E3B747F9816B91CF /* libBVLinearGradient.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
@@ -60,6 +58,7 @@
BE5EAB86221B7D5400E92E5B /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BE5EAB77221B7D5400E92E5B /* Zocial.ttf */; };
BE5EAC3A221B83CF00E92E5B /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BE302B75221B7C3B005626CF /* Ionicons.ttf */; };
BE5EAC41221B889900E92E5B /* libReactNativePermissions.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE5EAC40221B888C00E92E5B /* libReactNativePermissions.a */; };
+ 4EBB88037B054A508BF35245 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F42241E0235464C91B24049 /* libRNDeviceInfo.a */; };
E677346A94D54E90817979B0 /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C4D43A092A4408B91B32E76 /* libRNDeviceInfo-tvOS.a */; };
/* End PBXBuildFile section */
@@ -337,20 +336,6 @@
remoteGlobalIDString = 358F4ED71D1E81A9004DF814;
remoteInfo = RCTBlob;
};
- BE05D7E2222EFEA100EC8AFD /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 5BA133418E6F4967BC5BC234 /* RNDeviceInfo.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = DA5891D81BA9A9FC002B4DB2;
- remoteInfo = RNDeviceInfo;
- };
- BE05D7E4222EFEA100EC8AFD /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 5BA133418E6F4967BC5BC234 /* RNDeviceInfo.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = E72EC1401F7ABB5A0001BC90;
- remoteInfo = "RNDeviceInfo-tvOS";
- };
BE302B6B221B7860005626CF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE302B67221B7860005626CF /* RNCamera.xcodeproj */;
@@ -412,7 +397,6 @@
00E356EE1AD99517003FC87E /* appTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = appTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
00E356F21AD99517003FC87E /* appTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = appTests.m; sourceTree = ""; };
- 0F42241E0235464C91B24049 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = ""; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; };
13B07F961A680F5B00A75B9A /* app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = app.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -427,8 +411,6 @@
2D02E47B1E0B4A5D006451C7 /* app-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "app-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* app-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "app-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
- 3C4D43A092A4408B91B32E76 /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNDeviceInfo-tvOS.a"; sourceTree = ""; };
- 5BA133418E6F4967BC5BC234 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = ""; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; };
664970B9D10A41A18B44727F /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = ""; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; };
@@ -455,6 +437,9 @@
BE5EAC3B221B888C00E92E5B /* ReactNativePermissions.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativePermissions.xcodeproj; path = "../node_modules/react-native-permissions/ios/ReactNativePermissions.xcodeproj"; sourceTree = ""; };
C00CE8A4E3B747F9816B91CF /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = ""; };
EB0A5A258CBE4EEFAD3C358E /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = ""; };
+ 5BA133418E6F4967BC5BC234 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
+ 0F42241E0235464C91B24049 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
+ 3C4D43A092A4408B91B32E76 /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo-tvOS.a"; path = "libRNDeviceInfo-tvOS.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -731,15 +716,6 @@
name = Products;
sourceTree = "";
};
- BE05D7DE222EFEA000EC8AFD /* Products */ = {
- isa = PBXGroup;
- children = (
- BE05D7E3222EFEA100EC8AFD /* libRNDeviceInfo.a */,
- BE05D7E5222EFEA100EC8AFD /* libRNDeviceInfo-tvOS.a */,
- );
- name = Products;
- sourceTree = "";
- };
BE302B68221B7860005626CF /* Products */ = {
isa = PBXGroup;
children = (
@@ -784,8 +760,6 @@
EB0A5A258CBE4EEFAD3C358E /* libRNVectorIcons.a */,
95B0A42B6CD8441E904E6EB9 /* libRNVectorIcons-tvOS.a */,
C00CE8A4E3B747F9816B91CF /* libBVLinearGradient.a */,
- 0F42241E0235464C91B24049 /* libRNDeviceInfo.a */,
- 3C4D43A092A4408B91B32E76 /* libRNDeviceInfo-tvOS.a */,
);
name = "Recovered References";
sourceTree = "";
@@ -902,7 +876,6 @@
TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
- DevelopmentTeam = HLA62A6826;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
@@ -991,10 +964,6 @@
ProductGroup = BE302B68221B7860005626CF /* Products */;
ProjectRef = BE302B67221B7860005626CF /* RNCamera.xcodeproj */;
},
- {
- ProductGroup = BE05D7DE222EFEA000EC8AFD /* Products */;
- ProjectRef = 5BA133418E6F4967BC5BC234 /* RNDeviceInfo.xcodeproj */;
- },
{
ProductGroup = BE302B6F221B7AC7005626CF /* Products */;
ProjectRef = BE302B6E221B7AC7005626CF /* RNGestureHandler.xcodeproj */;
@@ -1274,20 +1243,6 @@
remoteRef = ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- BE05D7E3222EFEA100EC8AFD /* libRNDeviceInfo.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRNDeviceInfo.a;
- remoteRef = BE05D7E2222EFEA100EC8AFD /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- BE05D7E5222EFEA100EC8AFD /* libRNDeviceInfo-tvOS.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = "libRNDeviceInfo-tvOS.a";
- remoteRef = BE05D7E4222EFEA100EC8AFD /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
BE302B6C221B7860005626CF /* libRNCamera.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@@ -1486,7 +1441,6 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
- DEVELOPMENT_TEAM = HLA62A6826;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
@@ -1523,7 +1477,6 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
- DEVELOPMENT_TEAM = HLA62A6826;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
diff --git a/App/package.json b/App/package.json
index 6390570c..77dcf036 100755
--- a/App/package.json
+++ b/App/package.json
@@ -10,7 +10,6 @@
"@redux-offline/redux-offline": "^2.5.1",
"axios": "^0.18.0",
"expo": "^32.0.5",
- "lodash": "^4.17.11",
"material-icons-react": "^1.0.4",
"moment": "^2.24.0",
"prop-types": "^15.6.2",
diff --git a/api/Controllers/EventLocsController.cs b/api/Controllers/EventLocsController.cs
index 57d5052c..fa3345e8 100644
--- a/api/Controllers/EventLocsController.cs
+++ b/api/Controllers/EventLocsController.cs
@@ -57,5 +57,22 @@ namespace api.Controllers
var Teams = await _repo.GetEventLocEvent(id);
return Ok(Teams);
}
+
+ // POST api/eventLocs/add
+ // add new event
+ [HttpPost("add")]
+ public async Task AddEventLoc(EventLocAdd EventLocData)
+ {
+ EventLoc EAdd = new EventLoc{EventId = EventLocData.EventId, Lat = EventLocData.Lat, Long = EventLocData.Long, Nome = EventLocData.Nome, Desc = EventLocData.Desc, Img = EventLocData.Img};
+ await context.EventLocs.AddAsync(EAdd);
+
+ var result = context.SaveChanges();
+
+ if (result == 1)
+ {
+ return StatusCode(201);
+ }
+ return BadRequest();
+ }
}
}
diff --git a/api/Controllers/EventLocsVisitedController.cs b/api/Controllers/EventLocsVisitedController.cs
index 5c20c04a..2f810294 100644
--- a/api/Controllers/EventLocsVisitedController.cs
+++ b/api/Controllers/EventLocsVisitedController.cs
@@ -60,5 +60,37 @@ namespace api.Controllers
return Ok(Locs);
}
+
+ // POST api/eventLocsVisited/add
+ // add new event
+ [HttpPost("add")]
+ public async Task AddEventLoc(EventLocVisitedAdd EventLocVisitedData)
+ {
+ EventLoc Loc = await context.EventLocs.FirstOrDefaultAsync(a=>a.Id == EventLocVisitedData.EventLocID);
+ var userT = await context.Users.FirstOrDefaultAsync(u=>u.QRcode==EventLocVisitedData.USerQR);
+
+ if(userT.team == null){
+ return StatusCode(403);
+ }
+
+ Team TeamToEdit = userT.team;
+
+ TeamToEdit.Pontos += EventLocVisitedData.pontos;
+
+ EventLocVisited toAdd = new EventLocVisited{Team = TeamToEdit,Location = Loc, timestamp = DateTime.Now};
+
+ await context.EventLocsVisited.AddAsync(toAdd);
+
+ context.Teams.Update(TeamToEdit);
+
+ var result = context.SaveChanges();
+
+ if (result >= 1)
+ {
+ return StatusCode(201);
+ }
+ return BadRequest();
+ }
+
}
}
diff --git a/api/Controllers/EventsController.cs b/api/Controllers/EventsController.cs
index 7383d0db..36a8458f 100644
--- a/api/Controllers/EventsController.cs
+++ b/api/Controllers/EventsController.cs
@@ -46,5 +46,22 @@ namespace api.Controllers
var Event = await _repo.GetEvent(id);
return Ok(Event);
}
+
+ // POST api/events/add
+ // add new event
+ [HttpPost("add")]
+ public async Task AddEvent(EventForAdd EventData)
+ {
+ Event EAdd = new Event{Nome = EventData.Nome,Desc = EventData.Desc};
+ await context.Events.AddAsync(EAdd);
+
+ var result = context.SaveChanges();
+
+ if (result == 1)
+ {
+ return StatusCode(201);
+ }
+ return BadRequest();
+ }
}
}
diff --git a/api/Controllers/TeamsController.cs b/api/Controllers/TeamsController.cs
index 2f85886d..a7274ace 100644
--- a/api/Controllers/TeamsController.cs
+++ b/api/Controllers/TeamsController.cs
@@ -67,22 +67,25 @@ namespace api.Controllers
{
User tCap = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == TeamAddDetails.capQR);
-
- List memb = new List();
-
- memb.Add(tCap);
-
- Team tAdd = new Team{EventId = TeamAddDetails.EventId, Nome = TeamAddDetails.Nome, Cap = tCap, Membros = memb, NMembros = 1, Pontos = 0};
-
- await context.Teams.AddAsync(tAdd);
-
- var result = context.SaveChanges();
- if (result == 1)
- {
- return StatusCode(201);
- }
- return BadRequest();
+ if(tCap.team == null){
+ Team tAdd = new Team{EventId = TeamAddDetails.EventId, Nome = TeamAddDetails.Nome, Cap = tCap, NMembros = 1, Pontos = 0};
+
+ tCap.team = tAdd;
+
+ await context.Teams.AddAsync(tAdd);
+ context.Users.Update(tCap);
+
+ var result = context.SaveChanges();
+
+ if (result >= 1)
+ {
+ return StatusCode(201);
+ }
+ return BadRequest();
+ }else{
+ return BadRequest();
+ }
}
@@ -94,17 +97,96 @@ namespace api.Controllers
User newMember = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == MemberToAdd.newQR);
- Team tEdit = await context.Teams.Include(t=>t.Membros).FirstOrDefaultAsync(t=>t.Id == MemberToAdd.id);
+ Team tEdit = await context.Teams.FirstOrDefaultAsync(t=>t.Id == MemberToAdd.id);
- tEdit.NMembros++;
- tEdit.Membros.Add(newMember);
+ if(newMember.team == null){
+ tEdit.NMembros++;
+ newMember.team = tEdit;
- context.Update(tEdit);
+ context.Teams.Update(tEdit);
+ context.Users.Update(newMember);
+
+ var result = context.SaveChanges();
+
+ return StatusCode(201);
+
+ }else{
+ return StatusCode(403);
+ }
+
+ }
+
+ // POST api/teams/ChangeName
+ // create team
+ [HttpPost("changename")]
+ public async Task ChangeName(TeamChangeName NameChange)
+ {
+
+ Team tEdit = await context.Teams.Include(t=>t.Cap).FirstOrDefaultAsync(t=>t.Id == NameChange.TeamID);
+
+ User cap = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == NameChange.UserQR);
+
+ if(cap == tEdit.Cap){
+ tEdit.Nome = NameChange.nome;
+ }
+
+ context.Teams.Update(tEdit);
var result = context.SaveChanges();
return StatusCode(201);
}
+
+ // POST api/teams/delete
+ // create team
+ [HttpPost("delete")]
+ public async Task DeleteTeam(TeamDelete DeleteData)
+ {
+
+ Team tEdit = await context.Teams.Include(t=>t.Cap).FirstOrDefaultAsync(t=>t.Id == DeleteData.TeamID);
+
+ User cap = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == DeleteData.UserQR);
+
+ if(cap == tEdit.Cap){
+ context.Teams.Remove(tEdit);
+ cap.team = null;
+ context.Users.Update(cap);
+ var result = context.SaveChanges();
+ return StatusCode(201);
+ }else{
+ return StatusCode(403);
+ }
+ }
+
+ // POST api/teams/remove/member
+ // remove member
+ [HttpPost("remove/member")]
+ public async Task RemoveTeamMember(TeamRemoveMEmber MemberToRemove)
+ {
+
+ User rmMember = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == MemberToRemove.UserToRemoveQR);
+
+ Team tEdit = await context.Teams.Include(t=>t.Cap).FirstOrDefaultAsync(t=>t.Id == MemberToRemove.TeamID);
+
+ if(rmMember == tEdit.Cap){
+ return StatusCode(403);
+ }
+
+ if(rmMember.team == tEdit){
+ tEdit.NMembros--;
+ rmMember.team = null;
+
+ context.Teams.Update(tEdit);
+ context.Users.Update(rmMember);
+
+ var result = context.SaveChanges();
+
+ return StatusCode(201);
+ }else{
+ return StatusCode(403);
+ }
+
+ }
}
}
diff --git a/api/Data/EventLocsRepository.cs b/api/Data/EventLocsRepository.cs
index 629cc7d3..c4b22884 100644
--- a/api/Data/EventLocsRepository.cs
+++ b/api/Data/EventLocsRepository.cs
@@ -23,9 +23,16 @@ namespace api.Data
return rEventLocs;
}
- public async Task GetEventLocEvent(int id)
+ public async Task> GetEventLocEvent(int id)
{
- var rEventLocs = await _context.EventLocs.FirstOrDefaultAsync(e=>e.EventId == id);
+ List eLocs = await _context.EventLocs.ToListAsync();
+ List rEventLocs = new List();
+
+ eLocs.ForEach(delegate (EventLoc e){
+ if(e.EventId == id){
+ rEventLocs.Add(e);
+ }
+ });
return rEventLocs;
}
diff --git a/api/Data/EventLocsVisitedRepository.cs b/api/Data/EventLocsVisitedRepository.cs
index aa041027..4b326980 100644
--- a/api/Data/EventLocsVisitedRepository.cs
+++ b/api/Data/EventLocsVisitedRepository.cs
@@ -18,24 +18,33 @@ namespace api.Data
public async Task> GetEventLocsVisited()
{
- var rEventLocsVisitedList = await _context.EventLocsVisited.ToListAsync();
+ var rEventLocsVisitedList = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
return rEventLocsVisitedList;
}
- public Task> GetEventLocsVisitedTeam(int id)
+ public async Task> GetEventLocsVisitedTeam(int id)
{
- var allLocs = _context.EventLocsVisited.ToListAsync();
- allLocs.ForEach(i=>Console.Write("{0}\t", i));
- Console.WriteLine("teste");
+ List allLocs = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
List rList = new List();
for(var i=0;i> GetEventLocsVisitedEvent(int id)
+ {
+ List allLocs = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
+ List rList = new List();
+ for(var i=0;i> GetEventLocs();
Task GetEventLoc(int id);
- Task GetEventLocEvent(int id);
+ Task> GetEventLocEvent(int id);
}
diff --git a/api/Data/ITeamsRepository.cs b/api/Data/ITeamsRepository.cs
index 12ba68ec..ac5a220d 100644
--- a/api/Data/ITeamsRepository.cs
+++ b/api/Data/ITeamsRepository.cs
@@ -10,7 +10,7 @@ namespace api.Data
Task> GetTeams();
Task> GetEventTeam(int id);
- Task> GetUserTeam(String QR);
+ Task GetUserTeam(String QR);
}
diff --git a/api/Data/TeamsReposiroty.cs b/api/Data/TeamsReposiroty.cs
index 5ed69b06..0a0e3544 100644
--- a/api/Data/TeamsReposiroty.cs
+++ b/api/Data/TeamsReposiroty.cs
@@ -18,7 +18,7 @@ namespace api.Data
public async Task> GetEventTeam(int id)
{
- List allTeams = await _context.Teams.Include(a=>a.Cap).Include(a=>a.Membros).ToListAsync();
+ List allTeams = await _context.Teams.Include(a=>a.Cap).ToListAsync();
List rTeam = new List();
allTeams.ForEach(delegate(Team t){
if(t.EventId == id){
@@ -29,24 +29,16 @@ namespace api.Data
return rTeam;
}
- public async Task> GetUserTeam(String QR)
+ public async Task GetUserTeam(String QR)
{
- List allTeams = await _context.Teams.Include(a=>a.Cap).Include(a=>a.Membros).ToListAsync();
- List rTeam = new List();
- allTeams.ForEach(delegate(Team t){
- foreach (User u in t.Membros){
- if(u.QRcode == QR){
- rTeam.Add(t);
- }
- }
- });
+ var rTeam = (await _context.Users.FirstAsync(u=>u.QRcode == QR)).team;
return rTeam;
}
public async Task> GetTeams()
{
- var rTeams = await _context.Teams.Include(a=>a.Cap).Include(a=>a.Membros).ToListAsync();
+ var rTeams = await _context.Teams.Include(a=>a.Cap).ToListAsync();
return rTeams;
}
diff --git a/api/Dtos/EventForAdd.cs b/api/Dtos/EventForAdd.cs
new file mode 100644
index 00000000..8c23d5f9
--- /dev/null
+++ b/api/Dtos/EventForAdd.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class EventForAdd
+ {
+ [Required]
+ public string Nome{get;set;} //equipa id
+
+ [Required]
+ public string Desc{get;set;} //novo membro
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/EventLocAdd.cs b/api/Dtos/EventLocAdd.cs
new file mode 100644
index 00000000..1a1b1163
--- /dev/null
+++ b/api/Dtos/EventLocAdd.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class EventLocAdd
+ {
+ [Required]
+ public int EventId{get;set;} //Event ID
+
+ [Required]
+ public float Lat{get;set;} //latitude
+
+ [Required]
+ public float Long{get;set;} //longitude
+
+ [Required]
+ public String Nome{get;set;} //Nome da localização
+
+ [Required]
+ public String Desc{get;set;} //Descrição
+
+
+ public Photo Img{get;set;} //Foto da localização
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/EventLocVisitedAdd.cs b/api/Dtos/EventLocVisitedAdd.cs
new file mode 100644
index 00000000..87edbdc9
--- /dev/null
+++ b/api/Dtos/EventLocVisitedAdd.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class EventLocVisitedAdd
+ {
+ [Required]
+ public String USerQR{get;set;} //User ID
+
+ [Required]
+ public int EventLocID{get;set;} //Loc id
+
+ [Required]
+ public int pontos{get;set;} //Pontos a adicionar
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamChangeName.cs b/api/Dtos/TeamChangeName.cs
new file mode 100644
index 00000000..33f5174a
--- /dev/null
+++ b/api/Dtos/TeamChangeName.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class TeamChangeName
+ {
+ [Required]
+ public int TeamID{get;set;} //teamid
+
+ [Required]
+ public string nome{get;set;} //novo nome
+
+
+ [Required]
+ public string UserQR{get;set;} //user qr
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamDelete.cs b/api/Dtos/TeamDelete.cs
new file mode 100644
index 00000000..578d665d
--- /dev/null
+++ b/api/Dtos/TeamDelete.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class TeamDelete
+ {
+ [Required]
+ public int TeamID{get;set;} //teamid
+
+ [Required]
+ public string UserQR{get;set;} //user qr
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamRemoveMember.cs b/api/Dtos/TeamRemoveMember.cs
new file mode 100644
index 00000000..dca243db
--- /dev/null
+++ b/api/Dtos/TeamRemoveMember.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using api.Models;
+
+namespace api.Dtos
+{
+ public class TeamRemoveMEmber
+ {
+ [Required]
+ public int TeamID{get;set;} //teamid
+
+ [Required]
+ public string UserQR{get;set;} //user qr
+
+ [Required]
+ public string UserToRemoveQR{get;set;} //user qr
+
+ }
+}
\ No newline at end of file
diff --git a/api/Migrations/20190223232738_TeamsEvents.Designer.cs b/api/Migrations/20190223232738_TeamsEvents.Designer.cs
deleted file mode 100644
index ac20d2b6..00000000
--- a/api/Migrations/20190223232738_TeamsEvents.Designer.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-//
-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("20190223232738_TeamsEvents")]
- partial class TeamsEvents
- {
- 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", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("ClaimType");
-
- b.Property("ClaimValue");
-
- b.Property("RoleId");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("ClaimType");
-
- b.Property("ClaimValue");
-
- b.Property("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
- {
- b.Property("LoginProvider");
-
- b.Property("ProviderKey");
-
- b.Property("ProviderDisplayName");
-
- b.Property("UserId");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
- {
- b.Property("UserId");
-
- b.Property("LoginProvider");
-
- b.Property("Name");
-
- b.Property("Value");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("api.Models.Event", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("Desc");
-
- b.Property("Nome");
-
- b.HasKey("Id");
-
- b.ToTable("Events");
- });
-
- modelBuilder.Entity("api.Models.EventLoc", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("Desc");
-
- b.Property("EventId");
-
- b.Property("ImgId");
-
- b.Property("Lat");
-
- b.Property("Long");
-
- b.Property("Nome");
-
- b.HasKey("Id");
-
- b.HasIndex("ImgId");
-
- b.ToTable("EventLocs");
- });
-
- modelBuilder.Entity("api.Models.EventLocVisited", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("LocationId");
-
- b.Property("TeamId");
-
- b.Property("timestamp");
-
- b.HasKey("Id");
-
- b.HasIndex("LocationId");
-
- b.HasIndex("TeamId");
-
- b.ToTable("EventLocsVisited");
- });
-
- modelBuilder.Entity("api.Models.Photo", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("DateAdded");
-
- b.Property("Description");
-
- b.Property("IsMain");
-
- b.Property("Url");
-
- b.Property("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("Photos");
- });
-
- modelBuilder.Entity("api.Models.Role", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("ConcurrencyStamp")
- .IsConcurrencyToken();
-
- b.Property("Name")
- .HasMaxLength(256);
-
- b.Property("NormalizedName")
- .HasMaxLength(256);
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedName")
- .IsUnique()
- .HasName("RoleNameIndex");
-
- b.ToTable("AspNetRoles");
- });
-
- modelBuilder.Entity("api.Models.Team", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("CapId");
-
- b.Property("EventId");
-
- b.Property("NMembros");
-
- b.Property("Nome");
-
- b.Property("Pontos");
-
- b.Property("QRcode");
-
- b.HasKey("Id");
-
- b.HasIndex("CapId");
-
- b.ToTable("Teams");
- });
-
- modelBuilder.Entity("api.Models.User", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("AccessFailedCount");
-
- b.Property("ConcurrencyStamp")
- .IsConcurrencyToken();
-
- b.Property("Email")
- .HasMaxLength(256);
-
- b.Property("EmailConfirmed");
-
- b.Property("LockoutEnabled");
-
- b.Property("LockoutEnd");
-
- b.Property("NormalizedEmail")
- .HasMaxLength(256);
-
- b.Property("NormalizedUserName")
- .HasMaxLength(256);
-
- b.Property("PasswordHash");
-
- b.Property("PhoneNumber");
-
- b.Property("PhoneNumberConfirmed");
-
- b.Property("QRcode");
-
- b.Property("SecurityStamp");
-
- b.Property("TeamId");
-
- b.Property("TwoFactorEnabled");
-
- b.Property("UserName")
- .HasMaxLength(256);
-
- 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("UserId");
-
- b.Property("RoleId");
-
- b.HasKey("UserId", "RoleId");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetUserRoles");
- });
-
- modelBuilder.Entity("api.Models.Value", b =>
- {
- b.Property("id")
- .ValueGeneratedOnAdd();
-
- b.Property("Name");
-
- b.HasKey("id");
-
- b.ToTable("Values");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
- {
- b.HasOne("api.Models.Role")
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
- {
- b.HasOne("api.Models.User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
- {
- b.HasOne("api.Models.User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
- {
- b.HasOne("api.Models.User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- 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.Photo", b =>
- {
- b.HasOne("api.Models.User", "User")
- .WithMany("Photos")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("api.Models.Team", b =>
- {
- b.HasOne("api.Models.User", "Cap")
- .WithMany()
- .HasForeignKey("CapId");
- });
-
- modelBuilder.Entity("api.Models.User", b =>
- {
- b.HasOne("api.Models.Team")
- .WithMany("Membros")
- .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
- }
- }
-}
diff --git a/api/Migrations/20190223232738_TeamsEvents.cs b/api/Migrations/20190223232738_TeamsEvents.cs
deleted file mode 100644
index 23f1b84e..00000000
--- a/api/Migrations/20190223232738_TeamsEvents.cs
+++ /dev/null
@@ -1,417 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace api.Migrations
-{
- public partial class TeamsEvents : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "AspNetRoles",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- Name = table.Column(maxLength: 256, nullable: true),
- NormalizedName = table.Column(maxLength: 256, nullable: true),
- ConcurrencyStamp = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoles", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Events",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- Nome = table.Column(nullable: true),
- Desc = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Events", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Values",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- Name = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Values", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetRoleClaims",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- RoleId = table.Column(nullable: false),
- ClaimType = table.Column(nullable: true),
- ClaimValue = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserRoles",
- columns: table => new
- {
- UserId = table.Column(nullable: false),
- RoleId = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserClaims",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- UserId = table.Column(nullable: false),
- ClaimType = table.Column(nullable: true),
- ClaimValue = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserLogins",
- columns: table => new
- {
- LoginProvider = table.Column(nullable: false),
- ProviderKey = table.Column(nullable: false),
- ProviderDisplayName = table.Column(nullable: true),
- UserId = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserTokens",
- columns: table => new
- {
- UserId = table.Column(nullable: false),
- LoginProvider = table.Column(nullable: false),
- Name = table.Column(nullable: false),
- Value = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
- });
-
- migrationBuilder.CreateTable(
- name: "Photos",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- Url = table.Column(nullable: true),
- Description = table.Column(nullable: true),
- DateAdded = table.Column(nullable: false),
- IsMain = table.Column(nullable: false),
- UserId = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Photos", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "EventLocs",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- EventId = table.Column(nullable: false),
- Lat = table.Column(nullable: false),
- Long = table.Column(nullable: false),
- Nome = table.Column(nullable: true),
- Desc = table.Column(nullable: true),
- ImgId = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_EventLocs", x => x.Id);
- table.ForeignKey(
- name: "FK_EventLocs_Photos_ImgId",
- column: x => x.ImgId,
- principalTable: "Photos",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "Teams",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- QRcode = table.Column(nullable: true),
- EventId = table.Column(nullable: false),
- Nome = table.Column(nullable: true),
- CapId = table.Column(nullable: true),
- NMembros = table.Column(nullable: false),
- Pontos = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Teams", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUsers",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- UserName = table.Column(maxLength: 256, nullable: true),
- NormalizedUserName = table.Column(maxLength: 256, nullable: true),
- Email = table.Column(maxLength: 256, nullable: true),
- NormalizedEmail = table.Column(maxLength: 256, nullable: true),
- EmailConfirmed = table.Column(nullable: false),
- PasswordHash = table.Column(nullable: true),
- SecurityStamp = table.Column(nullable: true),
- ConcurrencyStamp = table.Column(nullable: true),
- PhoneNumber = table.Column(nullable: true),
- PhoneNumberConfirmed = table.Column(nullable: false),
- TwoFactorEnabled = table.Column(nullable: false),
- LockoutEnd = table.Column(nullable: true),
- LockoutEnabled = table.Column(nullable: false),
- AccessFailedCount = table.Column(nullable: false),
- QRcode = table.Column(nullable: true),
- TeamId = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUsers", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetUsers_Teams_TeamId",
- column: x => x.TeamId,
- principalTable: "Teams",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "EventLocsVisited",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- TeamId = table.Column(nullable: true),
- LocationId = table.Column(nullable: true),
- timestamp = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_EventLocsVisited", x => x.Id);
- table.ForeignKey(
- name: "FK_EventLocsVisited_EventLocs_LocationId",
- column: x => x.LocationId,
- principalTable: "EventLocs",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- table.ForeignKey(
- name: "FK_EventLocsVisited_Teams_TeamId",
- column: x => x.TeamId,
- principalTable: "Teams",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetRoleClaims_RoleId",
- table: "AspNetRoleClaims",
- column: "RoleId");
-
- migrationBuilder.CreateIndex(
- name: "RoleNameIndex",
- table: "AspNetRoles",
- column: "NormalizedName",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserClaims_UserId",
- table: "AspNetUserClaims",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserLogins_UserId",
- table: "AspNetUserLogins",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserRoles_RoleId",
- table: "AspNetUserRoles",
- column: "RoleId");
-
- migrationBuilder.CreateIndex(
- name: "EmailIndex",
- table: "AspNetUsers",
- column: "NormalizedEmail");
-
- migrationBuilder.CreateIndex(
- name: "UserNameIndex",
- table: "AspNetUsers",
- column: "NormalizedUserName",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUsers_TeamId",
- table: "AspNetUsers",
- column: "TeamId");
-
- migrationBuilder.CreateIndex(
- name: "IX_EventLocs_ImgId",
- table: "EventLocs",
- column: "ImgId");
-
- migrationBuilder.CreateIndex(
- name: "IX_EventLocsVisited_LocationId",
- table: "EventLocsVisited",
- column: "LocationId");
-
- migrationBuilder.CreateIndex(
- name: "IX_EventLocsVisited_TeamId",
- table: "EventLocsVisited",
- column: "TeamId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Photos_UserId",
- table: "Photos",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Teams_CapId",
- table: "Teams",
- column: "CapId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_AspNetUserRoles_AspNetUsers_UserId",
- table: "AspNetUserRoles",
- column: "UserId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_AspNetUserClaims_AspNetUsers_UserId",
- table: "AspNetUserClaims",
- column: "UserId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_AspNetUserLogins_AspNetUsers_UserId",
- table: "AspNetUserLogins",
- column: "UserId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_AspNetUserTokens_AspNetUsers_UserId",
- table: "AspNetUserTokens",
- column: "UserId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Photos_AspNetUsers_UserId",
- table: "Photos",
- column: "UserId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Teams_AspNetUsers_CapId",
- table: "Teams",
- column: "CapId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_Teams_AspNetUsers_CapId",
- table: "Teams");
-
- migrationBuilder.DropTable(
- name: "AspNetRoleClaims");
-
- migrationBuilder.DropTable(
- name: "AspNetUserClaims");
-
- migrationBuilder.DropTable(
- name: "AspNetUserLogins");
-
- migrationBuilder.DropTable(
- name: "AspNetUserRoles");
-
- migrationBuilder.DropTable(
- name: "AspNetUserTokens");
-
- migrationBuilder.DropTable(
- name: "EventLocsVisited");
-
- migrationBuilder.DropTable(
- name: "Events");
-
- migrationBuilder.DropTable(
- name: "Values");
-
- migrationBuilder.DropTable(
- name: "AspNetRoles");
-
- migrationBuilder.DropTable(
- name: "EventLocs");
-
- migrationBuilder.DropTable(
- name: "Photos");
-
- migrationBuilder.DropTable(
- name: "AspNetUsers");
-
- migrationBuilder.DropTable(
- name: "Teams");
- }
- }
-}
diff --git a/api/Migrations/20190224020609_finos.Designer.cs b/api/Migrations/20190224020609_finos.Designer.cs
deleted file mode 100644
index ff88151c..00000000
--- a/api/Migrations/20190224020609_finos.Designer.cs
+++ /dev/null
@@ -1,452 +0,0 @@
-//
-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("20190224020609_finos")]
- partial class finos
- {
- 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", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("ClaimType");
-
- b.Property("ClaimValue");
-
- b.Property("RoleId");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("ClaimType");
-
- b.Property("ClaimValue");
-
- b.Property("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
- {
- b.Property("LoginProvider");
-
- b.Property("ProviderKey");
-
- b.Property("ProviderDisplayName");
-
- b.Property("UserId");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
- {
- b.Property("UserId");
-
- b.Property("LoginProvider");
-
- b.Property("Name");
-
- b.Property("Value");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("api.Models.Event", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("Desc");
-
- b.Property("Nome");
-
- b.HasKey("Id");
-
- b.ToTable("Events");
- });
-
- modelBuilder.Entity("api.Models.EventLoc", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("Desc");
-
- b.Property("EventId");
-
- b.Property("ImgId");
-
- b.Property("Lat");
-
- b.Property("Long");
-
- b.Property("Nome");
-
- b.HasKey("Id");
-
- b.HasIndex("ImgId");
-
- b.ToTable("EventLocs");
- });
-
- modelBuilder.Entity("api.Models.EventLocVisited", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("LocationId");
-
- b.Property("TeamId");
-
- b.Property("timestamp");
-
- b.HasKey("Id");
-
- b.HasIndex("LocationId");
-
- b.HasIndex("TeamId");
-
- b.ToTable("EventLocsVisited");
- });
-
- modelBuilder.Entity("api.Models.Log", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("UserId");
-
- b.Property("UserId1");
-
- b.Property("amount");
-
- b.Property("available");
-
- b.Property("logType");
-
- b.Property("productId");
-
- b.Property("transactionId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("UserId1");
-
- b.HasIndex("productId");
-
- b.ToTable("Logs");
- });
-
- modelBuilder.Entity("api.Models.Photo", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("DateAdded");
-
- b.Property("Description");
-
- b.Property("IsMain");
-
- b.Property("Url");
-
- b.Property("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("Photos");
- });
-
- modelBuilder.Entity("api.Models.Product", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property