commit
d6c7dfeb3e
Binary file not shown.
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,49 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
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;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
|
namespace api.Controllers
|
||||||
|
{
|
||||||
|
[Authorize]
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
|
||||||
|
public class TeamsController : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly ITeamsRepository _repo;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
private readonly UserManager<User> _userManager;
|
||||||
|
private readonly DataContext _context;
|
||||||
|
|
||||||
|
public TeamsController(DataContext context, ITeamsRepository repo, IMapper mapper,UserManager<User> userManager)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_userManager = userManager;
|
||||||
|
_repo = repo;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> GetTeams()
|
||||||
|
{
|
||||||
|
var result = await _repo.GetTeams();
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ namespace api.Data
|
||||||
|
|
||||||
public DbSet<Photo> Photos {get;set;}
|
public DbSet<Photo> Photos {get;set;}
|
||||||
|
|
||||||
|
public DbSet<Team> Teams {get;set;}
|
||||||
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder builder)
|
protected override void OnModelCreating(ModelBuilder builder)
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using api.Models;
|
||||||
|
|
||||||
|
namespace api.Data
|
||||||
|
{
|
||||||
|
|
||||||
|
public interface ITeamsRepository
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Team>> GetTeams();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using api.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace api.Data
|
||||||
|
{
|
||||||
|
public class TeamsRepository : ITeamsRepository
|
||||||
|
{
|
||||||
|
private readonly DataContext _context;
|
||||||
|
|
||||||
|
public TeamsRepository(DataContext context)
|
||||||
|
{
|
||||||
|
this._context = context;
|
||||||
|
}
|
||||||
|
public async Task<IEnumerable<Team>> GetTeams()
|
||||||
|
{
|
||||||
|
var teams = await _context.Teams.ToListAsync();
|
||||||
|
|
||||||
|
return teams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,365 @@
|
||||||
|
// <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("20190214165735_teams")]
|
||||||
|
partial class teams
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.EventQR", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("Event");
|
||||||
|
|
||||||
|
b.Property<int>("EventLocId");
|
||||||
|
|
||||||
|
b.Property<int>("Pontos");
|
||||||
|
|
||||||
|
b.Property<string>("QRData");
|
||||||
|
|
||||||
|
b.Property<int>("TeamId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("TimeGen");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TeamId");
|
||||||
|
|
||||||
|
b.ToTable("EventQR");
|
||||||
|
});
|
||||||
|
|
||||||
|
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>("Event");
|
||||||
|
|
||||||
|
b.Property<string>("Nome");
|
||||||
|
|
||||||
|
b.Property<int>("NumMemb");
|
||||||
|
|
||||||
|
b.Property<int>("Pontos");
|
||||||
|
|
||||||
|
b.Property<int>("VisitedNum");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Teams");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("About");
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount");
|
||||||
|
|
||||||
|
b.Property<string>("Adress");
|
||||||
|
|
||||||
|
b.Property<int>("Age");
|
||||||
|
|
||||||
|
b.Property<string>("City");
|
||||||
|
|
||||||
|
b.Property<string>("Company");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken();
|
||||||
|
|
||||||
|
b.Property<string>("Country");
|
||||||
|
|
||||||
|
b.Property<string>("Degree");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed");
|
||||||
|
|
||||||
|
b.Property<string>("FullName");
|
||||||
|
|
||||||
|
b.Property<string>("Gender");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastLogin");
|
||||||
|
|
||||||
|
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<int>("Phone");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed");
|
||||||
|
|
||||||
|
b.Property<string>("Position");
|
||||||
|
|
||||||
|
b.Property<string>("ProfileIcon");
|
||||||
|
|
||||||
|
b.Property<string>("QRcode");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Registed");
|
||||||
|
|
||||||
|
b.Property<string>("Role");
|
||||||
|
|
||||||
|
b.Property<int>("SchoolYear");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp");
|
||||||
|
|
||||||
|
b.Property<int?>("TeamId");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled");
|
||||||
|
|
||||||
|
b.Property<string>("University");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<string>("linkedIn");
|
||||||
|
|
||||||
|
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.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.EventQR", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("api.Models.Team")
|
||||||
|
.WithMany("QRs")
|
||||||
|
.HasForeignKey("TeamId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.Photo", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("api.Models.User", "User")
|
||||||
|
.WithMany("Photos")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("api.Models.Team")
|
||||||
|
.WithMany("Users")
|
||||||
|
.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);
|
||||||
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace api.Migrations
|
||||||
|
{
|
||||||
|
public partial class teams : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "TeamId",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Teams",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Nome = table.Column<string>(nullable: true),
|
||||||
|
Event = table.Column<int>(nullable: false),
|
||||||
|
NumMemb = table.Column<int>(nullable: false),
|
||||||
|
VisitedNum = table.Column<int>(nullable: false),
|
||||||
|
Pontos = table.Column<int>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Teams", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "EventQR",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Event = table.Column<int>(nullable: false),
|
||||||
|
TeamId = table.Column<int>(nullable: false),
|
||||||
|
EventLocId = table.Column<int>(nullable: false),
|
||||||
|
Pontos = table.Column<int>(nullable: false),
|
||||||
|
TimeGen = table.Column<DateTime>(nullable: false),
|
||||||
|
QRData = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_EventQR", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_EventQR_Teams_TeamId",
|
||||||
|
column: x => x.TeamId,
|
||||||
|
principalTable: "Teams",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUsers_TeamId",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
column: "TeamId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_EventQR_TeamId",
|
||||||
|
table: "EventQR",
|
||||||
|
column: "TeamId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AspNetUsers_Teams_TeamId",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
column: "TeamId",
|
||||||
|
principalTable: "Teams",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_AspNetUsers_Teams_TeamId",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "EventQR");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Teams");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_AspNetUsers_TeamId",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "TeamId",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,31 @@ namespace api.Migrations
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846");
|
.HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.EventQR", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("Event");
|
||||||
|
|
||||||
|
b.Property<int>("EventLocId");
|
||||||
|
|
||||||
|
b.Property<int>("Pontos");
|
||||||
|
|
||||||
|
b.Property<string>("QRData");
|
||||||
|
|
||||||
|
b.Property<int>("TeamId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("TimeGen");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TeamId");
|
||||||
|
|
||||||
|
b.ToTable("EventQR");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("api.Models.Photo", b =>
|
modelBuilder.Entity("api.Models.Photo", b =>
|
||||||
{
|
{
|
||||||
|
@ -61,6 +85,26 @@ namespace api.Migrations
|
||||||
b.ToTable("AspNetRoles");
|
b.ToTable("AspNetRoles");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.Team", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("Event");
|
||||||
|
|
||||||
|
b.Property<string>("Nome");
|
||||||
|
|
||||||
|
b.Property<int>("NumMemb");
|
||||||
|
|
||||||
|
b.Property<int>("Pontos");
|
||||||
|
|
||||||
|
b.Property<int>("VisitedNum");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Teams");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("api.Models.User", b =>
|
modelBuilder.Entity("api.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
@ -128,6 +172,8 @@ namespace api.Migrations
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp");
|
b.Property<string>("SecurityStamp");
|
||||||
|
|
||||||
|
b.Property<int?>("TeamId");
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled");
|
b.Property<bool>("TwoFactorEnabled");
|
||||||
|
|
||||||
b.Property<string>("University");
|
b.Property<string>("University");
|
||||||
|
@ -146,6 +192,8 @@ namespace api.Migrations
|
||||||
.IsUnique()
|
.IsUnique()
|
||||||
.HasName("UserNameIndex");
|
.HasName("UserNameIndex");
|
||||||
|
|
||||||
|
b.HasIndex("TeamId");
|
||||||
|
|
||||||
b.ToTable("AspNetUsers");
|
b.ToTable("AspNetUsers");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -242,6 +290,14 @@ namespace api.Migrations
|
||||||
b.ToTable("AspNetUserTokens");
|
b.ToTable("AspNetUserTokens");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.EventQR", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("api.Models.Team")
|
||||||
|
.WithMany("QRs")
|
||||||
|
.HasForeignKey("TeamId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("api.Models.Photo", b =>
|
modelBuilder.Entity("api.Models.Photo", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("api.Models.User", "User")
|
b.HasOne("api.Models.User", "User")
|
||||||
|
@ -250,6 +306,13 @@ namespace api.Migrations
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("api.Models.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("api.Models.Team")
|
||||||
|
.WithMany("Users")
|
||||||
|
.HasForeignKey("TeamId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("api.Models.UserRole", b =>
|
modelBuilder.Entity("api.Models.UserRole", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("api.Models.Role", "Role")
|
b.HasOne("api.Models.Role", "Role")
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace api.Models
|
namespace api.Models
|
||||||
|
|
||||||
|
@ -8,5 +9,7 @@ namespace api.Models
|
||||||
public int Id{get;set;}
|
public int Id{get;set;}
|
||||||
public string Nome{get;set;}
|
public string Nome{get;set;}
|
||||||
public string Desc{get;set;}
|
public string Desc{get;set;}
|
||||||
|
public ICollection<EventLoc> Locations{get;set;}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ namespace api.Models
|
||||||
public int Id{get;set;}
|
public int Id{get;set;}
|
||||||
public int Event{get;set;}
|
public int Event{get;set;}
|
||||||
public int TeamId{get;set;}
|
public int TeamId{get;set;}
|
||||||
public int UserId{get;set;}
|
public String UserQR{get;set;}
|
||||||
public int QRId{get;set;}
|
public int QRId{get;set;}
|
||||||
|
|
||||||
public DateTime Time{get;set;}
|
public DateTime Time{get;set;}
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace api.Models
|
||||||
public string Nome{get;set;}
|
public string Nome{get;set;}
|
||||||
public int Event{get;set;}
|
public int Event{get;set;}
|
||||||
|
|
||||||
public ICollection<int> Users{get;set;}
|
public ICollection<User> Users{get;set;}
|
||||||
public int NumMemb{get;set;}
|
public int NumMemb{get;set;}
|
||||||
|
|
||||||
public int VisitedNum{get;set;}
|
public int VisitedNum{get;set;}
|
||||||
|
|
|
@ -24,6 +24,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
using Pomelo.EntityFrameworkCore.MySql;
|
||||||
|
|
||||||
namespace api
|
namespace api
|
||||||
{
|
{
|
||||||
|
@ -46,7 +47,7 @@ namespace api
|
||||||
services.AddScoped<IUsersRepository, UsersRepository>();
|
services.AddScoped<IUsersRepository, UsersRepository>();
|
||||||
|
|
||||||
//define a connection string indicada em appsettings.json
|
//define a connection string indicada em appsettings.json
|
||||||
services.AddDbContext<DataContext>(x=>x.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
|
services.AddDbContext<DataContext>(x=>x.UseMySql(Configuration.GetConnectionString("DefaultConnection")));
|
||||||
|
|
||||||
IdentityBuilder builder = services.AddIdentityCore<User>(Options=>
|
IdentityBuilder builder = services.AddIdentityCore<User>(Options=>
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="wwwroot\"/>
|
<Folder Include="wwwroot\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0"/>
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.1"/>
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.1" />
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="5.0.1"/>
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="5.0.1" />
|
||||||
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -5,7 +5,7 @@
|
||||||
},
|
},
|
||||||
"ConnectionStrings":
|
"ConnectionStrings":
|
||||||
{
|
{
|
||||||
"DefaultConnection":"Data Source= api.db"
|
"DefaultConnection":"server=enei.zmiguel.me;port=3306;database=enei;uid=enei;password=ENEIMegaPassword!"
|
||||||
|
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"ProjectFilePath": "c:\\Users\\ZMiguel\\Desktop\\ENEI2019\\api\\api.csproj",
|
||||||
|
"TargetFramework": "netcoreapp2.1",
|
||||||
|
"TagHelpers": [],
|
||||||
|
"Configuration": {
|
||||||
|
"ConfigurationName": "MVC-2.1",
|
||||||
|
"LanguageVersion": "2.1",
|
||||||
|
"Extensions": [
|
||||||
|
{
|
||||||
|
"ExtensionName": "MVC-2.1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue