resolver api

B_march
henrydays 2019-02-21 00:09:38 +00:00
parent 30ed051c9f
commit 11ed571d02
63 changed files with 568 additions and 4834 deletions

View File

@ -1,57 +1,48 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "logo-20@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "logo-20@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "logo-29@2x-1.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "logo-29@3x-1.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "logo-40@2x.png",
"size" : "40x40",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "logo-40@3x.png",
"size" : "40x40",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "logo-60@2x.png",
"size" : "60x60",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "logo-60@3x.png",
"size" : "60x60",
"scale" : "3x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "logo-1024.png",
"size" : "1024x1024",
"scale" : "1x"
}
],

View File

@ -1,49 +0,0 @@
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);
}
}
}

View File

@ -1,38 +0,0 @@
using System.Threading.Tasks;
using api.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using api.Dtos;
using Microsoft.AspNetCore.Identity;
using api.Models;
using Microsoft.AspNetCore.Diagnostics;
namespace api.Controllers
{
public class errorController : Controller
{
[Route("Error/{statusCode}")]
public IActionResult HandleErrorCode(int statusCode)
{
var statusCodeData = HttpContext.Features.Get<IStatusCodeReExecuteFeature>();
switch (statusCode)
{
case 404:
ViewBag.ErrorMessage = "Sorry the page you requested could not be found";
ViewBag.RouteOfException = statusCodeData.OriginalPath;
break;
case 500:
ViewBag.ErrorMessage = "Sorry something went wrong on the server";
ViewBag.RouteOfException = statusCodeData.OriginalPath;
break;
}
return View();
}
}
}

View File

@ -31,9 +31,6 @@ namespace api.Controllers
return View("Views/Landing/index.cshtml");
}

View File

@ -14,7 +14,6 @@ namespace api.Data
public DbSet<Photo> Photos {get;set;}
public DbSet<Team> Teams {get;set;}
protected override void OnModelCreating(ModelBuilder builder)

View File

@ -9,6 +9,7 @@ namespace api.Data
Task<User> Register(User user, string Password);
Task<User> Login(string username, string password);
}
}

View File

@ -1,13 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using api.Models;
namespace api.Data
{
public interface ITeamsRepository
{
Task<IEnumerable<Team>> GetTeams();
}
}

View File

@ -1,23 +0,0 @@
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;
}
}
}

View File

@ -20,7 +20,7 @@ namespace api.Data
public void Delete<T>(T entity) where T : class
{
_context.Remove(entity);
}

View File

@ -0,0 +1,285 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class update : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
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: "AspNetUsers",
columns: table => new
{
AccessFailedCount = table.Column<int>(nullable: false),
EmailConfirmed = table.Column<bool>(nullable: false),
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
TwoFactorEnabled = table.Column<bool>(nullable: false),
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),
PasswordHash = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
FullName = table.Column<string>(nullable: true),
Gender = table.Column<string>(nullable: true),
Age = table.Column<int>(nullable: false),
Phone = table.Column<int>(nullable: false),
University = table.Column<string>(nullable: true),
Adress = table.Column<string>(nullable: true),
Country = table.Column<string>(nullable: true),
City = table.Column<string>(nullable: true),
linkedIn = table.Column<string>(nullable: true),
LastLogin = table.Column<DateTime>(nullable: false),
Registed = table.Column<DateTime>(nullable: false),
QRcode = table.Column<string>(nullable: true),
Role = table.Column<string>(nullable: true),
Degree = table.Column<string>(nullable: true),
SchoolYear = table.Column<int>(nullable: false),
ProfileIcon = table.Column<string>(nullable: true),
Company = table.Column<string>(nullable: true),
Position = table.Column<string>(nullable: true),
About = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Values",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
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("Sqlite:Autoincrement", true),
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: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
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);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
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 });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
RoleId = table.Column<int>(nullable: false),
UserId = 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);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
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 });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Photos",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
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);
table.ForeignKey(
name: "FK_Photos_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
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_Photos_UserId",
table: "Photos",
column: "UserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "Photos");
migrationBuilder.DropTable(
name: "Values");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "AspNetUsers");
}
}
}

View File

@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class nova : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -9,8 +9,8 @@ using api.Data;
namespace api.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20190214193256_uo")]
partial class uo
[Migration("20190221000457_a")]
partial class a
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -87,30 +87,6 @@ namespace api.Migrations
b.ToTable("AspNetUserTokens");
});
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")
@ -156,41 +132,41 @@ namespace api.Migrations
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");
@ -203,21 +179,35 @@ namespace api.Migrations
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")
@ -227,8 +217,6 @@ namespace api.Migrations
.IsUnique()
.HasName("UserNameIndex");
b.HasIndex("TeamId");
b.ToTable("AspNetUsers");
});
@ -289,14 +277,6 @@ namespace api.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
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")
@ -305,13 +285,6 @@ namespace api.Migrations
.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")

View File

@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class uo : Migration
public partial class a : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@ -24,20 +24,48 @@ namespace api.Migrations
});
migrationBuilder.CreateTable(
name: "Teams",
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
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)
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),
FullName = table.Column<string>(nullable: true),
Gender = table.Column<string>(nullable: true),
Age = table.Column<int>(nullable: false),
Phone = table.Column<int>(nullable: false),
University = table.Column<string>(nullable: true),
Adress = table.Column<string>(nullable: true),
Country = table.Column<string>(nullable: true),
City = table.Column<string>(nullable: true),
linkedIn = table.Column<string>(nullable: true),
LastLogin = table.Column<DateTime>(nullable: false),
Registed = table.Column<DateTime>(nullable: false),
QRcode = table.Column<string>(nullable: true),
Role = table.Column<string>(nullable: true),
Degree = table.Column<string>(nullable: true),
SchoolYear = table.Column<int>(nullable: false),
ProfileIcon = table.Column<string>(nullable: true),
Company = table.Column<string>(nullable: true),
Position = table.Column<string>(nullable: true),
About = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Teams", x => x.Id);
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
@ -74,64 +102,6 @@ namespace api.Migrations
onDelete: ReferentialAction.Cascade);
});
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: "EventQR",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
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.CreateTable(
name: "AspNetUserClaims",
columns: table => new
@ -277,16 +247,6 @@ namespace api.Migrations
column: "NormalizedUserName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AspNetUsers_TeamId",
table: "AspNetUsers",
column: "TeamId");
migrationBuilder.CreateIndex(
name: "IX_EventQR_TeamId",
table: "EventQR",
column: "TeamId");
migrationBuilder.CreateIndex(
name: "IX_Photos_UserId",
table: "Photos",
@ -310,9 +270,6 @@ namespace api.Migrations
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "EventQR");
migrationBuilder.DropTable(
name: "Photos");
@ -324,9 +281,6 @@ namespace api.Migrations
migrationBuilder.DropTable(
name: "AspNetUsers");
migrationBuilder.DropTable(
name: "Teams");
}
}
}

View File

@ -9,8 +9,8 @@ using api.Data;
namespace api.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20190214202719_nova")]
partial class nova
[Migration("20190221000551_c")]
partial class c
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -87,30 +87,6 @@ namespace api.Migrations
b.ToTable("AspNetUserTokens");
});
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")
@ -156,26 +132,6 @@ namespace api.Migrations
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")
@ -211,8 +167,6 @@ namespace api.Migrations
b.Property<string>("SecurityStamp");
b.Property<int?>("TeamId");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
@ -227,8 +181,6 @@ namespace api.Migrations
.IsUnique()
.HasName("UserNameIndex");
b.HasIndex("TeamId");
b.ToTable("AspNetUsers");
});
@ -289,14 +241,6 @@ namespace api.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
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")
@ -305,13 +249,6 @@ namespace api.Migrations
.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")

View File

@ -0,0 +1,181 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class c : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "About",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Adress",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Age",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "City",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Company",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Country",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Degree",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "FullName",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Gender",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "LastLogin",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Phone",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Position",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "ProfileIcon",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Registed",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Role",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "SchoolYear",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "University",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "linkedIn",
table: "AspNetUsers");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "About",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Adress",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "Age",
table: "AspNetUsers",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "City",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Company",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Country",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Degree",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "FullName",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Gender",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "LastLogin",
table: "AspNetUsers",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "Phone",
table: "AspNetUsers",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Position",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ProfileIcon",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "Registed",
table: "AspNetUsers",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "Role",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "SchoolYear",
table: "AspNetUsers",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "University",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "linkedIn",
table: "AspNetUsers",
nullable: true);
}
}
}

View File

@ -85,30 +85,6 @@ namespace api.Migrations
b.ToTable("AspNetUserTokens");
});
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")
@ -154,26 +130,6 @@ namespace api.Migrations
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")
@ -209,8 +165,6 @@ namespace api.Migrations
b.Property<string>("SecurityStamp");
b.Property<int?>("TeamId");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
@ -225,8 +179,6 @@ namespace api.Migrations
.IsUnique()
.HasName("UserNameIndex");
b.HasIndex("TeamId");
b.ToTable("AspNetUsers");
});
@ -287,14 +239,6 @@ namespace api.Migrations
.OnDelete(DeleteBehavior.Cascade);
});
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")
@ -303,13 +247,6 @@ namespace api.Migrations
.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")

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace api.Models
{
public class Event
{
public int Id{get;set;}
public string Nome{get;set;}
public string Desc{get;set;}
public ICollection<EventLoc> Locations{get;set;}
}
}

View File

@ -1,17 +0,0 @@
using System;
namespace api.Models
{
public class EventLoc
{
public int Id{get;set;}
public int Event{get;set;}
public string Nome{get;set;}
public double Lat{get;set;}
public double Long{get;set;}
public string Desc{get;set;}
public int PhotoId{get;set;}
}
}

View File

@ -1,16 +0,0 @@
using System;
namespace api.Models
{
public class EventLocVisited
{
public int Id{get;set;}
public int Event{get;set;}
public int TeamId{get;set;}
public String UserQR{get;set;}
public int QRId{get;set;}
public DateTime Time{get;set;}
}
}

View File

@ -1,18 +0,0 @@
using System;
namespace api.Models
{
public class EventQR
{
public int Id{get;set;}
public int Event{get;set;}
public int TeamId{get;set;}
public int EventLocId{get;set;}
public int Pontos{get;set;}
public DateTime TimeGen{get;set;}
public string QRData{get;set;}
}
}

View File

@ -8,6 +8,7 @@ namespace api.Models
public int Id{get;set;}
public string Url {get;set;}
public string Description{get;set;}