commit
e645cee192
|
@ -84,4 +84,5 @@ typings/
|
|||
bin/
|
||||
obj/
|
||||
|
||||
.vscode/
|
||||
.vscode/
|
||||
*.cache
|
||||
|
|
|
@ -28,7 +28,6 @@ namespace api.Controllers
|
|||
public UserManager<User> _userManager { get; }
|
||||
public SignInManager<User> _signInManager { get; }
|
||||
public IUsersRepository _repo { get; }
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
private readonly RoleManager<Role> _roleManager;
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using api.Data;
|
||||
using api.Dtos;
|
||||
using api.Models;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace api.Controllers
|
||||
{
|
||||
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class EventLocsController : ControllerBase
|
||||
{
|
||||
private readonly DataContext context;
|
||||
private readonly IEventLocsRepository _repo;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly RoleManager<Role> _roleManager;
|
||||
private readonly UserManager<User> _userManager;
|
||||
public EventLocsController(DataContext context,IEventLocsRepository repo, IMapper mapper,RoleManager<Role> roleManager,UserManager<User> UserManager)
|
||||
{
|
||||
this.context = context;
|
||||
_mapper = mapper;
|
||||
_roleManager = roleManager;
|
||||
_userManager = UserManager;
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
// GET api/EventLocs
|
||||
// GET all EventLocs
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetEventLocs()
|
||||
{
|
||||
var Teams = await _repo.GetEventLocs();
|
||||
return Ok(Teams);
|
||||
}
|
||||
|
||||
// GET api/EventLocs/[id]
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> GetEventLoc(int id)
|
||||
{
|
||||
var Teams = await _repo.GetEventLoc(id);
|
||||
return Ok(Teams);
|
||||
}
|
||||
|
||||
// GET api/EventLocs/[id]
|
||||
[HttpGet("e/{id}")]
|
||||
public async Task<IActionResult> GetEventLocEvent(int id)
|
||||
{
|
||||
var Teams = await _repo.GetEventLocEvent(id);
|
||||
return Ok(Teams);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using api.Data;
|
||||
using api.Dtos;
|
||||
using api.Models;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace api.Controllers
|
||||
{
|
||||
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class EventLocsVisitedController : ControllerBase
|
||||
{
|
||||
private readonly DataContext context;
|
||||
private readonly IEventLocsVisitedRepository _repo;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly RoleManager<Role> _roleManager;
|
||||
private readonly UserManager<User> _userManager;
|
||||
public EventLocsVisitedController(DataContext context,IEventLocsVisitedRepository repo, IMapper mapper,RoleManager<Role> roleManager,UserManager<User> UserManager)
|
||||
{
|
||||
this.context = context;
|
||||
_mapper = mapper;
|
||||
_roleManager = roleManager;
|
||||
_userManager = UserManager;
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
// GET api/EventLocsVisited
|
||||
// GET all EventLocsVisited
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetEventLocsVisited()
|
||||
{
|
||||
var Locs = await _repo.GetEventLocsVisited();
|
||||
return Ok(Locs);
|
||||
}
|
||||
|
||||
// GET api/EventLocsVisited/t/[id]
|
||||
//All locs visited by team id
|
||||
[HttpGet("t/{id}")]
|
||||
public async Task<IActionResult> GetEventLocsVisitedTeam(int id)
|
||||
{
|
||||
var Locs = await _repo.GetEventLocsVisitedTeam(id);
|
||||
return Ok(Locs);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using api.Data;
|
||||
using api.Dtos;
|
||||
using api.Models;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace api.Controllers
|
||||
{
|
||||
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class EventsController : ControllerBase
|
||||
{
|
||||
private readonly DataContext context;
|
||||
private readonly IEventsRepository _repo;
|
||||
private readonly IMapper _mapper;
|
||||
public EventsController(DataContext context,IEventsRepository repo, IMapper mapper)
|
||||
{
|
||||
this.context = context;
|
||||
_mapper = mapper;
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
// GET api/events
|
||||
// GET all events
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetEvents()
|
||||
{
|
||||
var Events = await _repo.GetEvents();
|
||||
return Ok(Events);
|
||||
}
|
||||
|
||||
// GET api/events/[id]
|
||||
// GET events id x
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> GetEvent(int id)
|
||||
{
|
||||
var Event = await _repo.GetEvent(id);
|
||||
return Ok(Event);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using api.Data;
|
||||
using api.Dtos;
|
||||
using api.Models;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace api.Controllers
|
||||
{
|
||||
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class TeamsController : ControllerBase
|
||||
{
|
||||
private readonly DataContext context;
|
||||
private readonly ITeamsRepository _repo;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly RoleManager<Role> _roleManager;
|
||||
private readonly UserManager<User> _userManager;
|
||||
public TeamsController(DataContext context,ITeamsRepository repo, IMapper mapper,RoleManager<Role> roleManager,UserManager<User> UserManager)
|
||||
{
|
||||
this.context = context;
|
||||
_mapper = mapper;
|
||||
_roleManager = roleManager;
|
||||
_userManager = UserManager;
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
// GET api/teams
|
||||
// GET all teams
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetTeams()
|
||||
{
|
||||
var Teams = await _repo.GetTeams();
|
||||
return Ok(Teams);
|
||||
}
|
||||
|
||||
// GET api/teams/e/[id]
|
||||
// GET all teams for event id
|
||||
[HttpGet("e/{id}")]
|
||||
public async Task<IActionResult> GetTeamsEvent(int id)
|
||||
{
|
||||
var Teams = await _repo.GetEventTeam(id);
|
||||
return Ok(Teams);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore;
|
|||
|
||||
namespace api.Data
|
||||
{
|
||||
public class DataContext : IdentityDbContext<User,Role,int,IdentityUserClaim<int>,
|
||||
UserRole,IdentityUserLogin<int>,IdentityRoleClaim<int>,IdentityUserToken<int>>
|
||||
public class DataContext : IdentityDbContext<User,Role,int,IdentityUserClaim<int>,UserRole,IdentityUserLogin<int>,
|
||||
IdentityRoleClaim<int>,IdentityUserToken<int>>
|
||||
{
|
||||
public DataContext(DbContextOptions<DataContext> options):base(options) { }
|
||||
|
||||
|
@ -24,31 +24,31 @@ namespace api.Data
|
|||
|
||||
public DbSet<Log>Logs{get;set;}
|
||||
|
||||
public DbSet<Product>Products{get;set;}
|
||||
public DbSet<Product>Products{get;set;}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
|
||||
//para o ef saber as relações
|
||||
builder.Entity<UserRole>(userRole =>
|
||||
{
|
||||
userRole.HasKey(ur=> new {ur.UserId, ur.RoleId});
|
||||
//para o ef saber as relações
|
||||
builder.Entity<UserRole>(userRole =>
|
||||
{
|
||||
userRole.HasKey(ur=> new {ur.UserId, ur.RoleId});
|
||||
|
||||
userRole.HasOne( ur=>ur.Role)
|
||||
.WithMany(r=>r.UserRoles)
|
||||
.HasForeignKey(ur=> ur.RoleId)
|
||||
.IsRequired();
|
||||
userRole.HasOne( ur=>ur.Role)
|
||||
.WithMany(r=>r.UserRoles)
|
||||
.HasForeignKey(ur=> ur.RoleId)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
userRole.HasOne( ur=>ur.User)
|
||||
.WithMany(r=>r.UserRoles)
|
||||
.HasForeignKey(ur=> ur.UserId)
|
||||
.IsRequired();
|
||||
|
||||
});
|
||||
}
|
||||
userRole.HasOne( ur=>ur.User)
|
||||
.WithMany(r=>r.UserRoles)
|
||||
.HasForeignKey(ur=> ur.UserId)
|
||||
.IsRequired();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
using api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public class EventLocsRepository : IEventLocsRepository
|
||||
{
|
||||
public EventLocsRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public DataContext _context { get; }
|
||||
|
||||
public async Task<EventLoc> GetEventLoc(int id)
|
||||
{
|
||||
var rEventLocs = await _context.EventLocs.FirstOrDefaultAsync(e=>e.Id == id);
|
||||
|
||||
return rEventLocs;
|
||||
}
|
||||
|
||||
public async Task<EventLoc> GetEventLocEvent(int id)
|
||||
{
|
||||
var rEventLocs = await _context.EventLocs.FirstOrDefaultAsync(e=>e.EventId == id);
|
||||
|
||||
return rEventLocs;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventLoc>> GetEventLocs()
|
||||
{
|
||||
var rEventLocs = await _context.EventLocs.ToListAsync();
|
||||
|
||||
return rEventLocs;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
using api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public class EventLocsVisitedRepository : IEventLocsVisitedRepository
|
||||
{
|
||||
public EventLocsVisitedRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public DataContext _context { get; }
|
||||
|
||||
public async Task<IEnumerable<EventLocVisited>> GetEventLocsVisited()
|
||||
{
|
||||
var rEventLocsVisitedList = await _context.EventLocsVisited.ToListAsync();
|
||||
|
||||
return rEventLocsVisitedList;
|
||||
}
|
||||
|
||||
public Task<IEnumerable<EventLocVisited>> GetEventLocsVisitedTeam(int id)
|
||||
{
|
||||
List<EventLocVisited> allLocs = _context.EventLocsVisited.ToList();
|
||||
allLocs.ForEach(i=>Console.Write("{0}\t", i));
|
||||
Console.WriteLine("teste");
|
||||
List<EventLocVisited> rList = new List<EventLocVisited>();
|
||||
for(var i=0;i<allLocs.Count;i++){
|
||||
if(allLocs[i].Team.Id == id){
|
||||
rList.Add(allLocs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return rList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
using api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public class EventsRepository : IEventsRepository
|
||||
{
|
||||
public EventsRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public DataContext _context { get; }
|
||||
|
||||
public async Task<Event> GetEvent(int id)
|
||||
{
|
||||
var Event = await _context.Events.FirstOrDefaultAsync(e=>e.Id == id);
|
||||
|
||||
return Event;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Event>> GetEvents()
|
||||
{
|
||||
var Events = await _context.Events.ToListAsync();
|
||||
|
||||
return Events;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public interface IEventLocsRepository
|
||||
{
|
||||
|
||||
Task<IEnumerable<EventLoc>> GetEventLocs();
|
||||
Task<EventLoc> GetEventLoc(int id);
|
||||
Task<EventLoc> GetEventLocEvent(int id);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public interface IEventLocsVisitedRepository
|
||||
{
|
||||
|
||||
Task<IEnumerable<EventLocVisited>> GetEventLocsVisited();
|
||||
Task<IEnumerable<EventLocVisited>> GetEventLocsVisitedTeam(int id);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public interface IEventsRepository
|
||||
{
|
||||
|
||||
Task<IEnumerable<Event>> GetEvents();
|
||||
Task<Event> GetEvent(int id);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public interface ITeamsRepository
|
||||
{
|
||||
|
||||
Task<IEnumerable<Team>> GetTeams();
|
||||
Task<Team> GetEventTeam(int id);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using api.Models;
|
||||
using api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace api.Data
|
||||
{
|
||||
public class TeamsRepository : ITeamsRepository
|
||||
{
|
||||
public TeamsRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public DataContext _context { get; }
|
||||
|
||||
public async Task<Team> GetEventTeam(int id)
|
||||
{
|
||||
var rTeam = await _context.Teams.FirstOrDefaultAsync(e=>e.EventId == id);
|
||||
|
||||
return rTeam;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Team>> GetTeams()
|
||||
{
|
||||
var rTeams = await _context.Teams.ToListAsync();
|
||||
|
||||
return rTeams;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,385 @@
|
|||
// <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("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<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.Event", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Desc");
|
||||
|
||||
b.Property<string>("Nome");
|
||||
|
||||
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.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.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<int?>("CapId");
|
||||
|
||||
b.Property<int>("EventId");
|
||||
|
||||
b.Property<int>("NMembros");
|
||||
|
||||
b.Property<string>("Nome");
|
||||
|
||||
b.Property<int>("Pontos");
|
||||
|
||||
b.Property<string>("QRcode");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CapId");
|
||||
|
||||
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<int?>("TeamId");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled");
|
||||
|
||||
b.Property<string>("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<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.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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,417 @@
|
|||
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<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Events",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Nome = table.Column<string>(nullable: true),
|
||||
Desc = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Events", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Values",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Values", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoleClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleId = table.Column<int>(nullable: false),
|
||||
ClaimType = table.Column<string>(nullable: true),
|
||||
ClaimValue = table.Column<string>(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<int>(nullable: false),
|
||||
RoleId = table.Column<int>(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<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UserId = table.Column<int>(nullable: false),
|
||||
ClaimType = table.Column<string>(nullable: true),
|
||||
ClaimValue = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserLogins",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(nullable: false),
|
||||
ProviderKey = table.Column<string>(nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(nullable: true),
|
||||
UserId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserTokens",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<int>(nullable: false),
|
||||
LoginProvider = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: false),
|
||||
Value = table.Column<string>(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<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Url = table.Column<string>(nullable: true),
|
||||
Description = table.Column<string>(nullable: true),
|
||||
DateAdded = table.Column<DateTime>(nullable: false),
|
||||
IsMain = table.Column<bool>(nullable: false),
|
||||
UserId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Photos", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EventLocs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
EventId = table.Column<int>(nullable: false),
|
||||
Lat = table.Column<float>(nullable: false),
|
||||
Long = table.Column<float>(nullable: false),
|
||||
Nome = table.Column<string>(nullable: true),
|
||||
Desc = table.Column<string>(nullable: true),
|
||||
ImgId = table.Column<int>(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<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
QRcode = table.Column<string>(nullable: true),
|
||||
EventId = table.Column<int>(nullable: false),
|
||||
Nome = table.Column<string>(nullable: true),
|
||||
CapId = table.Column<int>(nullable: true),
|
||||
NMembros = table.Column<int>(nullable: false),
|
||||
Pontos = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Teams", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUsers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UserName = table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
|
||||
Email = table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(nullable: false),
|
||||
PasswordHash = table.Column<string>(nullable: true),
|
||||
SecurityStamp = table.Column<string>(nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(nullable: true),
|
||||
PhoneNumber = table.Column<string>(nullable: true),
|
||||
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(nullable: false),
|
||||
AccessFailedCount = table.Column<int>(nullable: false),
|
||||
QRcode = table.Column<string>(nullable: true),
|
||||
TeamId = table.Column<int>(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<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
TeamId = table.Column<int>(nullable: true),
|
||||
LocationId = table.Column<int>(nullable: true),
|
||||
timestamp = table.Column<DateTime>(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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ namespace api.Models
|
|||
public class EventLocVisited
|
||||
{
|
||||
public int Id{get;set;} //id
|
||||
public Team Team{get;set;} //teamQRID
|
||||
public Team Team{get;set;} //team
|
||||
public EventLoc Location{get;set;} //location
|
||||
public DateTime timestamp{get;set;} //time
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace api.Models
|
|||
public class Team
|
||||
{
|
||||
public int Id{get;set;} //id
|
||||
public string QRcode{get;set;} //QR ID code
|
||||
public int EventId{get;set;} //equipa para o evento ID
|
||||
public string Nome{get;set;} //Nome da equipa
|
||||
public User Cap{get;set;} //Capitao da equipa
|
||||
|
|
|
@ -45,6 +45,10 @@ namespace api
|
|||
|
||||
services.AddAutoMapper();
|
||||
services.AddScoped<IUsersRepository, UsersRepository>();
|
||||
services.AddScoped<IEventsRepository, EventsRepository>();
|
||||
services.AddScoped<ITeamsRepository, TeamsRepository>();
|
||||
services.AddScoped<IEventLocsRepository, EventLocsRepository>();
|
||||
services.AddScoped<IEventLocsVisitedRepository, EventLocsVisitedRepository>();
|
||||
|
||||
//define a connection string indicada em appsettings.json
|
||||
services.AddDbContext<DataContext>(x=>x.UseMySql(Configuration.GetConnectionString("DefaultConnection")));
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"ProjectFilePath": "/Users/henrique/ENEI2019/api/api.csproj",
|
||||
"ProjectFilePath": "c:\\Users\\ZMiguel\\Desktop\\ENEI2019\\api\\api.csproj",
|
||||
"TargetFramework": "netcoreapp2.1",
|
||||
"TagHelpers": [],
|
||||
"Configuration": {
|
||||
|
|
Loading…
Reference in New Issue