henrydays 3 years ago
parent
commit
71e37564f4
  1. 12
      api/Controllers/UsersController.cs
  2. 3
      api/Data/IUsersRepository.cs
  3. 41
      api/Data/UsersRepository.cs
  4. 0
      api/Dtos/cromosToReturn.cs
  5. 0
      api/Dtos/loginQR.cs
  6. 9
      api/Dtos/profileImage.cs
  7. 502
      api/Migrations/20190318183120_completev1.Designer.cs
  8. 17
      api/Migrations/20190318183120_completev1.cs
  9. 493
      api/Migrations/20190319003112_image.Designer.cs
  10. 52
      api/Migrations/20190319003112_image.cs
  11. 495
      api/Migrations/20190319005102_imagelogo.Designer.cs
  12. 22
      api/Migrations/20190319005102_imagelogo.cs
  13. 499
      api/Migrations/20190322005225_locs.Designer.cs
  14. 31
      api/Migrations/20190322005225_locs.cs
  15. 503
      api/Migrations/20190322014157_eventloc.Designer.cs
  16. 32
      api/Migrations/20190322014157_eventloc.cs
  17. 505
      api/Migrations/20190322014229_eventlocpos.Designer.cs
  18. 22
      api/Migrations/20190322014229_eventlocpos.cs
  19. 37
      api/Migrations/20190322021203_a.cs
  20. 6
      api/Migrations/20190323222043_uo.Designer.cs
  21. 508
      api/Migrations/20190323222043_uo.cs
  22. 2
      api/Migrations/DataContextModelSnapshot.cs
  23. 2
      api/Models/User.cs
  24. 0
      api/Views/Landing/android-chrome-256x256.png
  25. 0
      api/Views/Landing/career-path.html
  26. 0
      api/Views/Landing/ctf.html
  27. 0
      api/Views/Landing/faqs.html
  28. 0
      api/Views/Landing/imgs/blip-sponsor.png
  29. 0
      api/Views/Landing/imgs/blip-sponsor.svg
  30. 0
      api/Views/Landing/imgs/critical-sponsor.png
  31. 0
      api/Views/Landing/imgs/critical-sponsor.svg
  32. 0
      api/Views/Landing/imgs/email.svg
  33. 0
      api/Views/Landing/imgs/facebook.svg
  34. 0
      api/Views/Landing/imgs/image.png
  35. 0
      api/Views/Landing/imgs/instagram.svg
  36. 0
      api/Views/Landing/imgs/linkedin.svg
  37. 0
      api/Views/Landing/imgs/logo-enei.ai
  38. 0
      api/Views/Landing/imgs/logo-enei.svg
  39. 0
      api/Views/Landing/imgs/novaBase-sponsor.jpg
  40. 0
      api/Views/android-chrome-256x256.png
  41. 0
      api/Views/career-path.html
  42. 0
      api/Views/ctf.html
  43. 0
      api/Views/faqs.html
  44. 0
      api/Views/imgs/blip-sponsor.png
  45. 0
      api/Views/imgs/blip-sponsor.svg
  46. 0
      api/Views/imgs/critical-sponsor.png
  47. 0
      api/Views/imgs/critical-sponsor.svg
  48. 0
      api/Views/imgs/email.svg
  49. 0
      api/Views/imgs/facebook.svg
  50. 0
      api/Views/imgs/image.png
  51. 0
      api/Views/imgs/instagram.svg
  52. 0
      api/Views/imgs/linkedin.svg
  53. 0
      api/Views/imgs/logo-enei.ai
  54. 0
      api/Views/imgs/logo-enei.svg
  55. 0
      api/Views/imgs/novaBase-sponsor.jpg
  56. 2
      api/appsettings.Production.json
  57. 2
      api/appsettings.json
  58. 0
      api/wwwroot/Landing/android-chrome-256x256.png
  59. 0
      api/wwwroot/Landing/career-path.html
  60. 0
      api/wwwroot/Landing/ctf.html
  61. 0
      api/wwwroot/Landing/faqs.html
  62. 0
      api/wwwroot/Landing/imgs/blip-sponsor.png
  63. 0
      api/wwwroot/Landing/imgs/blip-sponsor.svg
  64. 0
      api/wwwroot/Landing/imgs/critical-sponsor.png
  65. 0
      api/wwwroot/Landing/imgs/critical-sponsor.svg
  66. 0
      api/wwwroot/Landing/imgs/email.svg
  67. 0
      api/wwwroot/Landing/imgs/facebook.svg
  68. 0
      api/wwwroot/Landing/imgs/image.png
  69. 0
      api/wwwroot/Landing/imgs/instagram.svg
  70. 0
      api/wwwroot/Landing/imgs/linkedin.svg
  71. 0
      api/wwwroot/Landing/imgs/logo-enei.ai
  72. 0
      api/wwwroot/Landing/imgs/logo-enei.svg
  73. 0
      api/wwwroot/Landing/imgs/novaBase-sponsor.jpg
  74. 0
      api/wwwroot/android-chrome-256x256.png
  75. 0
      api/wwwroot/career-path.html
  76. 0
      api/wwwroot/ctf.html
  77. 0
      api/wwwroot/faqs.html
  78. 0
      api/wwwroot/imgs/blip-sponsor.png
  79. 0
      api/wwwroot/imgs/blip-sponsor.svg
  80. 0
      api/wwwroot/imgs/critical-sponsor.png
  81. 0
      api/wwwroot/imgs/critical-sponsor.svg
  82. 0
      api/wwwroot/imgs/email.svg
  83. 0
      api/wwwroot/imgs/facebook.svg
  84. 0
      api/wwwroot/imgs/image.png
  85. 0
      api/wwwroot/imgs/instagram.svg
  86. 0
      api/wwwroot/imgs/linkedin.svg
  87. 0
      api/wwwroot/imgs/logo-enei.ai
  88. 0
      api/wwwroot/imgs/logo-enei.svg
  89. 0
      api/wwwroot/imgs/novaBase-sponsor.jpg

12
api/Controllers/UsersController.cs

@ -31,7 +31,16 @@ namespace api.Controllers
_repo = repo;
}
[HttpPost("changeProfileImage")]
public async Task<IActionResult> changeProfileImage(profileImage i)
{
User a = new User();
var cenas =await _repo.changeProfileImage(i);
return Ok(cenas);
}
//
[HttpGet("{id}")]
public async Task<IActionResult> GetUser(int id)
@ -57,6 +66,7 @@ namespace api.Controllers
}
[Authorize(Policy = "RequireAdminRole")]
[HttpPost("updateAll")]
public async Task<IActionResult> UpdateUsers(updateUsersDTO[] req)
@ -65,7 +75,7 @@ namespace api.Controllers
{
foreach (var user in req)
{
}
return Ok(req);

3
api/Data/IUsersRepository.cs

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using api.Dtos;
using api.Models;
namespace api.Data
@ -12,7 +13,7 @@ namespace api.Data
Task<bool> SaveAll();
Task<IEnumerable<User>> GetUsers();
Task<User> GetUser(int id);
Task<User> changeProfileImage(profileImage a);
}
}

41
api/Data/UsersRepository.cs

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using api.Dtos;
using api.Models;
using Microsoft.EntityFrameworkCore;
@ -14,34 +15,56 @@ namespace api.Data
}
public void Add<T>(T enity) where T : class
{
_context.Add(enity);
_context.Add(enity);
}
public async Task<User> changeProfileImage(profileImage a)
{
var utilizador = await _context.Users.FirstOrDefaultAsync(t => t.QRcode == a.QRcode);
if (utilizador != null)
{
utilizador.profileImage = a.base64;
_context.Users.Update(utilizador);
var result = _context.SaveChanges();
if (result >= 1)
{
return utilizador;
}
return null;
}
return null;
}
public void Delete<T>(T entity) where T : class
{
_context.Remove(entity);
}
public async Task<User> GetUser(int id)
{
var user = await _context.Users.Include(p=>p.Photos).FirstOrDefaultAsync(u=>u.Id==id);
var user = await _context.Users.Include(p => p.Photos).FirstOrDefaultAsync(u => u.Id == id);
return user;
}
public async Task<IEnumerable<User>> GetUsers()
{
var users= await _context.Users.Include(p=>p.Photos).ToListAsync();
var users = await _context.Users.Include(p => p.Photos).ToListAsync();
return users;
}
public async Task<bool> SaveAll()
{
return await _context.SaveChangesAsync()>0;
return await _context.SaveChangesAsync() > 0;
}
}

0
api/Dtos/cromosToReturn.cs

0
api/Dtos/loginQR.cs

9
api/Dtos/profileImage.cs

@ -0,0 +1,9 @@
namespace api.Dtos
{
public class profileImage
{
public string QRcode{get;set;}
public string base64{get;set;}
}
}

502
api/Migrations/20190318183120_completev1.Designer.cs

@ -1,502 +0,0 @@
// <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("20190318183120_completev1")]
partial class completev1
{
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.Cromos", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DescLocked");
b.Property<string>("DescMostrar");
b.Property<string>("DescUnlocked");
b.Property<string>("Nome");
b.Property<string>("QRCode");
b.Property<int?>("imgId");
b.Property<int>("pontos");
b.Property<bool>("unlocked");
b.Property<string>("websiteCromo");
b.HasKey("Id");
b.HasIndex("imgId");
b.ToTable("Cromos");
});
modelBuilder.Entity("api.Models.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<string>("Nome");
b.Property<bool>("aDecorrer");
b.Property<string>("custo");
b.Property<string>("horas");
b.Property<string>("imagem");
b.Property<string>("localizacao");
b.Property<string>("notas");
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<bool>("complete");
b.Property<DateTime>("timestamp");
b.HasKey("Id");
b.HasIndex("LocationId");
b.HasIndex("TeamId");
b.ToTable("EventLocsVisited");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("UserId");
b.Property<int?>("UserId1");
b.Property<int>("amount");
b.Property<int>("available");
b.Property<string>("logType");
b.Property<int?>("productId");
b.Property<string>("transactionId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("UserId1");
b.HasIndex("productId");
b.ToTable("Logs");
});
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.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("basePrice");
b.Property<string>("name");
b.Property<float>("revenue");
b.Property<int>("sold");
b.HasKey("Id");
b.ToTable("Products");
});
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<string>("CapQR");
b.Property<int>("EventId");
b.Property<int>("NMembros");
b.Property<string>("Nome");
b.Property<int>("Pontos");
b.Property<bool>("pagamento");
b.Property<string>("pagamentoVerifyCode");
b.HasKey("Id");
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<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("cromos");
b.Property<int>("drinks");
b.Property<int>("food");
b.Property<string>("fullName");
b.Property<int?>("teamID");
b.Property<string>("university");
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.Cromos", b =>
{
b.HasOne("api.Models.Photo", "img")
.WithMany()
.HasForeignKey("imgId");
});
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.Log", b =>
{
b.HasOne("api.Models.User")
.WithMany("logsFebrada")
.HasForeignKey("UserId");
b.HasOne("api.Models.User")
.WithMany("logsFestarola")
.HasForeignKey("UserId1");
b.HasOne("api.Models.Product", "product")
.WithMany()
.HasForeignKey("productId");
});
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", "team")
.WithMany()
.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
}
}
}

17
api/Migrations/20190318183120_completev1.cs

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

493
api/Migrations/20190319003112_image.Designer.cs

@ -1,493 +0,0 @@
// <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("20190319003112_image")]
partial class image
{
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.Cromos", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DescLocked");
b.Property<string>("DescMostrar");
b.Property<string>("DescUnlocked");
b.Property<string>("Nome");
b.Property<string>("QRCode");
b.Property<string>("img");
b.Property<int>("pontos");
b.Property<bool>("unlocked");
b.Property<string>("websiteCromo");
b.HasKey("Id");
b.ToTable("Cromos");
});
modelBuilder.Entity("api.Models.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<string>("Nome");
b.Property<bool>("aDecorrer");
b.Property<string>("custo");
b.Property<string>("horas");
b.Property<string>("imagem");
b.Property<string>("localizacao");
b.Property<string>("notas");
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<bool>("complete");
b.Property<DateTime>("timestamp");
b.HasKey("Id");
b.HasIndex("LocationId");
b.HasIndex("TeamId");
b.ToTable("EventLocsVisited");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("UserId");
b.Property<int?>("UserId1");
b.Property<int>("amount");
b.Property<int>("available");
b.Property<string>("logType");
b.Property<int?>("productId");
b.Property<string>("transactionId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("UserId1");
b.HasIndex("productId");
b.ToTable("Logs");
});
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.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("basePrice");
b.Property<string>("name");
b.Property<float>("revenue");
b.Property<int>("sold");
b.HasKey("Id");
b.ToTable("Products");
});
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<string>("CapQR");
b.Property<int>("EventId");
b.Property<int>("NMembros");
b.Property<string>("Nome");
b.Property<int>("Pontos");
b.Property<bool>("pagamento");
b.Property<string>("pagamentoVerifyCode");
b.HasKey("Id");
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<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("cromos");
b.Property<int>("drinks");
b.Property<int>("food");
b.Property<string>("fullName");
b.Property<int?>("teamID");
b.Property<string>("university");
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.Log", b =>
{
b.HasOne("api.Models.User")
.WithMany("logsFebrada")
.HasForeignKey("UserId");
b.HasOne("api.Models.User")
.WithMany("logsFestarola")
.HasForeignKey("UserId1");
b.HasOne("api.Models.Product", "product")
.WithMany()
.HasForeignKey("productId");
});
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", "team")
.WithMany()
.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
}
}
}

52
api/Migrations/20190319003112_image.cs

@ -1,52 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
public partial class image : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Cromos_Photos_imgId",
table: "Cromos");
migrationBuilder.DropIndex(
name: "IX_Cromos_imgId",
table: "Cromos");
migrationBuilder.DropColumn(
name: "imgId",
table: "Cromos");
migrationBuilder.AddColumn<string>(
name: "img",
table: "Cromos",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "img",
table: "Cromos");
migrationBuilder.AddColumn<int>(
name: "imgId",
table: "Cromos",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Cromos_imgId",
table: "Cromos",
column: "imgId");
migrationBuilder.AddForeignKey(
name: "FK_Cromos_Photos_imgId",
table: "Cromos",
column: "imgId",
principalTable: "Photos",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

495
api/Migrations/20190319005102_imagelogo.Designer.cs

@ -1,495 +0,0 @@
// <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("20190319005102_imagelogo")]
partial class imagelogo
{
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.Cromos", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DescLocked");
b.Property<string>("DescMostrar");
b.Property<string>("DescUnlocked");
b.Property<string>("Nome");
b.Property<string>("QRCode");
b.Property<string>("img");
b.Property<string>("logo");
b.Property<int>("pontos");
b.Property<bool>("unlocked");
b.Property<string>("websiteCromo");
b.HasKey("Id");
b.ToTable("Cromos");
});
modelBuilder.Entity("api.Models.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Desc");
b.Property<string>("Nome");
b.Property<bool>("aDecorrer");
b.Property<string>("custo");
b.Property<string>("horas");
b.Property<string>("imagem");
b.Property<string>("localizacao");
b.Property<string>("notas");
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<bool>("complete");
b.Property<DateTime>("timestamp");
b.HasKey("Id");
b.HasIndex("LocationId");
b.HasIndex("TeamId");
b.ToTable("EventLocsVisited");
});
modelBuilder.Entity("api.Models.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("UserId");
b.Property<int?>("UserId1");
b.Property<int>("amount");
b.Property<int>("available");
b.Property<string>("logType");
b.Property<int?>("productId");
b.Property<string>("transactionId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("UserId1");
b.HasIndex("productId");
b.ToTable("Logs");
});
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.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("basePrice");
b.Property<string>("name");
b.Property<float>("revenue");
b.Property<int>("sold");
b.HasKey("Id");
b.ToTable("Products");
});
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<string>("CapQR");
b.Property<int>("EventId");
b.Property<int>("NMembros");
b.Property<string>("Nome");
b.Property<int>("Pontos");
b.Property<bool>("pagamento");
b.Property<string>("pagamentoVerifyCode");
b.HasKey("Id");
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")