From 603ab626bf15f95d385caa61a90dba1d34019a71 Mon Sep 17 00:00:00 2001 From: henrydays Date: Sun, 24 Feb 2019 02:16:08 +0000 Subject: [PATCH] finosv3 --- api/Data/DataContext.cs | 10 + api/Migrations/20180829184152_update.cs | 285 ---------- api/Migrations/20190221000457_a.cs | 286 ---------- api/Migrations/20190221000551_c.Designer.cs | 267 ---------- api/Migrations/20190221000551_c.cs | 181 ------- ...er.cs => 20190224020609_finos.Designer.cs} | 223 ++++++-- api/Migrations/20190224020609_finos.cs | 497 ++++++++++++++++++ api/Migrations/DataContextModelSnapshot.cs | 185 +++++++ api/Models/Event.cs | 14 + api/Models/EventLoc.cs | 18 + api/Models/EventLocVisited.cs | 14 + api/Models/Log.cs | 21 + api/Models/Product.cs | 21 + api/Models/Team.cs | 18 + api/Models/User.cs | 8 +- api/Models/Value.cs | 1 - api/Models/movsFestarola.cs | 13 + api/Properties/launchSettings.json | 30 -- api/Startup.cs | 2 +- api/Views/Landing/index.cshtml | 1 - api/obj/Debug/netcoreapp2.1/api.assets.cache | Bin .../Debug/netcoreapp2.1/project.razor.json | 0 22 files changed, 1005 insertions(+), 1090 deletions(-) delete mode 100755 api/Migrations/20180829184152_update.cs delete mode 100644 api/Migrations/20190221000457_a.cs delete mode 100644 api/Migrations/20190221000551_c.Designer.cs delete mode 100644 api/Migrations/20190221000551_c.cs rename api/Migrations/{20190221000457_a.Designer.cs => 20190224020609_finos.Designer.cs} (61%) create mode 100644 api/Migrations/20190224020609_finos.cs create mode 100755 api/Models/Event.cs create mode 100755 api/Models/EventLoc.cs create mode 100755 api/Models/EventLocVisited.cs create mode 100644 api/Models/Log.cs create mode 100644 api/Models/Product.cs create mode 100755 api/Models/Team.cs create mode 100644 api/Models/movsFestarola.cs delete mode 100755 api/Properties/launchSettings.json delete mode 100755 api/Views/Landing/index.cshtml mode change 100755 => 100644 api/obj/Debug/netcoreapp2.1/api.assets.cache mode change 100755 => 100644 api/obj/Debug/netcoreapp2.1/project.razor.json diff --git a/api/Data/DataContext.cs b/api/Data/DataContext.cs index 43d1c208..2b4d4713 100755 --- a/api/Data/DataContext.cs +++ b/api/Data/DataContext.cs @@ -14,7 +14,17 @@ namespace api.Data public DbSet Photos {get;set;} + public DbSet Teams {get;set;} + public DbSet Events {get;set;} + + public DbSet EventLocs {get;set;} + + public DbSet EventLocsVisited {get;set;} + + public DbSetLogs{get;set;} + +public DbSetProducts{get;set;} protected override void OnModelCreating(ModelBuilder builder) { diff --git a/api/Migrations/20180829184152_update.cs b/api/Migrations/20180829184152_update.cs deleted file mode 100755 index b196307d..00000000 --- a/api/Migrations/20180829184152_update.cs +++ /dev/null @@ -1,285 +0,0 @@ -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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - AccessFailedCount = table.Column(nullable: false), - EmailConfirmed = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - LockoutEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - FullName = table.Column(nullable: true), - Gender = table.Column(nullable: true), - Age = table.Column(nullable: false), - Phone = table.Column(nullable: false), - University = table.Column(nullable: true), - Adress = table.Column(nullable: true), - Country = table.Column(nullable: true), - City = table.Column(nullable: true), - linkedIn = table.Column(nullable: true), - LastLogin = table.Column(nullable: false), - Registed = table.Column(nullable: false), - QRcode = table.Column(nullable: true), - Role = table.Column(nullable: true), - Degree = table.Column(nullable: true), - SchoolYear = table.Column(nullable: false), - ProfileIcon = table.Column(nullable: true), - Company = table.Column(nullable: true), - Position = table.Column(nullable: true), - About = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Values", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Values", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(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(nullable: false), - ProviderKey = table.Column(nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - 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(nullable: false), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - 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(nullable: false), - LoginProvider = table.Column(nullable: false), - Name = table.Column(nullable: false), - Value = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - 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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Url = table.Column(nullable: true), - Description = table.Column(nullable: true), - DateAdded = table.Column(nullable: false), - IsMain = table.Column(nullable: false), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Photos", x => x.Id); - 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"); - } - } -} diff --git a/api/Migrations/20190221000457_a.cs b/api/Migrations/20190221000457_a.cs deleted file mode 100644 index b538d1ef..00000000 --- a/api/Migrations/20190221000457_a.cs +++ /dev/null @@ -1,286 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace api.Migrations -{ - public partial class a : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false), - FullName = table.Column(nullable: true), - Gender = table.Column(nullable: true), - Age = table.Column(nullable: false), - Phone = table.Column(nullable: false), - University = table.Column(nullable: true), - Adress = table.Column(nullable: true), - Country = table.Column(nullable: true), - City = table.Column(nullable: true), - linkedIn = table.Column(nullable: true), - LastLogin = table.Column(nullable: false), - Registed = table.Column(nullable: false), - QRcode = table.Column(nullable: true), - Role = table.Column(nullable: true), - Degree = table.Column(nullable: true), - SchoolYear = table.Column(nullable: false), - ProfileIcon = table.Column(nullable: true), - Company = table.Column(nullable: true), - Position = table.Column(nullable: true), - About = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Values", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Values", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - 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(nullable: false), - ProviderKey = table.Column(nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - 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 - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - 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(nullable: false), - LoginProvider = table.Column(nullable: false), - Name = table.Column(nullable: false), - Value = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - 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(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Url = table.Column(nullable: true), - Description = table.Column(nullable: true), - DateAdded = table.Column(nullable: false), - IsMain = table.Column(nullable: false), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Photos", x => x.Id); - 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"); - } - } -} diff --git a/api/Migrations/20190221000551_c.Designer.cs b/api/Migrations/20190221000551_c.Designer.cs deleted file mode 100644 index 025098af..00000000 --- a/api/Migrations/20190221000551_c.Designer.cs +++ /dev/null @@ -1,267 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using api.Data; - -namespace api.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20190221000551_c")] - partial class c - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ClaimType"); - - b.Property("ClaimValue"); - - b.Property("RoleId"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ClaimType"); - - b.Property("ClaimValue"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider"); - - b.Property("ProviderKey"); - - b.Property("ProviderDisplayName"); - - b.Property("UserId"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId"); - - b.Property("LoginProvider"); - - b.Property("Name"); - - b.Property("Value"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("api.Models.Photo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("DateAdded"); - - b.Property("Description"); - - b.Property("IsMain"); - - b.Property("Url"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Photos"); - }); - - modelBuilder.Entity("api.Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); - - b.Property("Name") - .HasMaxLength(256); - - b.Property("NormalizedName") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("api.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessFailedCount"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); - - b.Property("Email") - .HasMaxLength(256); - - b.Property("EmailConfirmed"); - - b.Property("LockoutEnabled"); - - b.Property("LockoutEnd"); - - b.Property("NormalizedEmail") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .HasMaxLength(256); - - b.Property("PasswordHash"); - - b.Property("PhoneNumber"); - - b.Property("PhoneNumberConfirmed"); - - b.Property("QRcode"); - - b.Property("SecurityStamp"); - - b.Property("TwoFactorEnabled"); - - b.Property("UserName") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("api.Models.UserRole", b => - { - b.Property("UserId"); - - b.Property("RoleId"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("api.Models.Value", b => - { - b.Property("id") - .ValueGeneratedOnAdd(); - - b.Property("Name"); - - b.HasKey("id"); - - b.ToTable("Values"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("api.Models.Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("api.Models.User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("api.Models.User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("api.Models.User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("api.Models.Photo", b => - { - b.HasOne("api.Models.User", "User") - .WithMany("Photos") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("api.Models.UserRole", b => - { - b.HasOne("api.Models.Role", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("api.Models.User", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/api/Migrations/20190221000551_c.cs b/api/Migrations/20190221000551_c.cs deleted file mode 100644 index 250a6706..00000000 --- a/api/Migrations/20190221000551_c.cs +++ /dev/null @@ -1,181 +0,0 @@ -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( - name: "About", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "Adress", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "Age", - table: "AspNetUsers", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "City", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "Company", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "Country", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "Degree", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "FullName", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "Gender", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "LastLogin", - table: "AspNetUsers", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddColumn( - name: "Phone", - table: "AspNetUsers", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "Position", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "ProfileIcon", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "Registed", - table: "AspNetUsers", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddColumn( - name: "Role", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "SchoolYear", - table: "AspNetUsers", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "University", - table: "AspNetUsers", - nullable: true); - - migrationBuilder.AddColumn( - name: "linkedIn", - table: "AspNetUsers", - nullable: true); - } - } -} diff --git a/api/Migrations/20190221000457_a.Designer.cs b/api/Migrations/20190224020609_finos.Designer.cs similarity index 61% rename from api/Migrations/20190221000457_a.Designer.cs rename to api/Migrations/20190224020609_finos.Designer.cs index ec333f00..ff88151c 100644 --- a/api/Migrations/20190221000457_a.Designer.cs +++ b/api/Migrations/20190224020609_finos.Designer.cs @@ -9,8 +9,8 @@ using api.Data; namespace api.Migrations { [DbContext(typeof(DataContext))] - [Migration("20190221000457_a")] - partial class a + [Migration("20190224020609_finos")] + partial class finos { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -87,6 +87,94 @@ namespace api.Migrations b.ToTable("AspNetUserTokens"); }); + modelBuilder.Entity("api.Models.Event", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Desc"); + + b.Property("Nome"); + + b.HasKey("Id"); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("api.Models.EventLoc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Desc"); + + b.Property("EventId"); + + b.Property("ImgId"); + + b.Property("Lat"); + + b.Property("Long"); + + b.Property("Nome"); + + b.HasKey("Id"); + + b.HasIndex("ImgId"); + + b.ToTable("EventLocs"); + }); + + modelBuilder.Entity("api.Models.EventLocVisited", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("LocationId"); + + b.Property("TeamId"); + + b.Property("timestamp"); + + b.HasKey("Id"); + + b.HasIndex("LocationId"); + + b.HasIndex("TeamId"); + + b.ToTable("EventLocsVisited"); + }); + + modelBuilder.Entity("api.Models.Log", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("UserId"); + + b.Property("UserId1"); + + b.Property("amount"); + + b.Property("available"); + + b.Property("logType"); + + b.Property("productId"); + + b.Property("transactionId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId1"); + + b.HasIndex("productId"); + + b.ToTable("Logs"); + }); + modelBuilder.Entity("api.Models.Photo", b => { b.Property("Id") @@ -109,6 +197,24 @@ namespace api.Migrations b.ToTable("Photos"); }); + modelBuilder.Entity("api.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("basePrice"); + + b.Property("name"); + + b.Property("revenue"); + + b.Property("sold"); + + b.HasKey("Id"); + + b.ToTable("Products"); + }); + modelBuilder.Entity("api.Models.Role", b => { b.Property("Id") @@ -132,41 +238,45 @@ namespace api.Migrations b.ToTable("AspNetRoles"); }); + modelBuilder.Entity("api.Models.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CapId"); + + b.Property("EventId"); + + b.Property("NMembros"); + + b.Property("Nome"); + + b.Property("Pontos"); + + b.Property("QRcode"); + + b.HasKey("Id"); + + b.HasIndex("CapId"); + + b.ToTable("Teams"); + }); + modelBuilder.Entity("api.Models.User", b => { b.Property("Id") .ValueGeneratedOnAdd(); - b.Property("About"); - b.Property("AccessFailedCount"); - b.Property("Adress"); - - b.Property("Age"); - - b.Property("City"); - - b.Property("Company"); - b.Property("ConcurrencyStamp") .IsConcurrencyToken(); - b.Property("Country"); - - b.Property("Degree"); - b.Property("Email") .HasMaxLength(256); b.Property("EmailConfirmed"); - b.Property("FullName"); - - b.Property("Gender"); - - b.Property("LastLogin"); - b.Property("LockoutEnabled"); b.Property("LockoutEnd"); @@ -179,34 +289,24 @@ namespace api.Migrations b.Property("PasswordHash"); - b.Property("Phone"); - b.Property("PhoneNumber"); b.Property("PhoneNumberConfirmed"); - b.Property("Position"); - - b.Property("ProfileIcon"); - b.Property("QRcode"); - b.Property("Registed"); - - b.Property("Role"); - - b.Property("SchoolYear"); - b.Property("SecurityStamp"); - b.Property("TwoFactorEnabled"); + b.Property("TeamId"); - b.Property("University"); + b.Property("TwoFactorEnabled"); b.Property("UserName") .HasMaxLength(256); - b.Property("linkedIn"); + b.Property("drinks"); + + b.Property("food"); b.HasKey("Id"); @@ -217,6 +317,8 @@ namespace api.Migrations .IsUnique() .HasName("UserNameIndex"); + b.HasIndex("TeamId"); + b.ToTable("AspNetUsers"); }); @@ -277,6 +379,39 @@ namespace api.Migrations .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") @@ -285,6 +420,20 @@ namespace api.Migrations .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") diff --git a/api/Migrations/20190224020609_finos.cs b/api/Migrations/20190224020609_finos.cs new file mode 100644 index 00000000..493d3c7f --- /dev/null +++ b/api/Migrations/20190224020609_finos.cs @@ -0,0 +1,497 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace api.Migrations +{ + public partial class finos : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(maxLength: 256, nullable: true), + NormalizedName = table.Column(maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Events", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Nome = table.Column(nullable: true), + Desc = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Events", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Products", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + name = table.Column(nullable: true), + basePrice = table.Column(nullable: false), + sold = table.Column(nullable: false), + revenue = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Products", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Values", + columns: table => new + { + id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Values", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RoleId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(nullable: false), + ProviderKey = table.Column(nullable: false), + ProviderDisplayName = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(nullable: false), + Name = table.Column(nullable: false), + Value = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + }); + + migrationBuilder.CreateTable( + name: "Logs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + amount = table.Column(nullable: false), + available = table.Column(nullable: false), + productId = table.Column(nullable: true), + transactionId = table.Column(nullable: true), + logType = table.Column(nullable: true), + UserId = table.Column(nullable: true), + UserId1 = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Logs", x => x.Id); + table.ForeignKey( + name: "FK_Logs_Products_productId", + column: x => x.productId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Photos", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Url = table.Column(nullable: true), + Description = table.Column(nullable: true), + DateAdded = table.Column(nullable: false), + IsMain = table.Column(nullable: false), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Photos", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "EventLocs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EventId = table.Column(nullable: false), + Lat = table.Column(nullable: false), + Long = table.Column(nullable: false), + Nome = table.Column(nullable: true), + Desc = table.Column(nullable: true), + ImgId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_EventLocs", x => x.Id); + table.ForeignKey( + name: "FK_EventLocs_Photos_ImgId", + column: x => x.ImgId, + principalTable: "Photos", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Teams", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + QRcode = table.Column(nullable: true), + EventId = table.Column(nullable: false), + Nome = table.Column(nullable: true), + CapId = table.Column(nullable: true), + NMembros = table.Column(nullable: false), + Pontos = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Teams", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserName = table.Column(maxLength: 256, nullable: true), + NormalizedUserName = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: true), + NormalizedEmail = table.Column(maxLength: 256, nullable: true), + EmailConfirmed = table.Column(nullable: false), + PasswordHash = table.Column(nullable: true), + SecurityStamp = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + PhoneNumber = table.Column(nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false), + TwoFactorEnabled = table.Column(nullable: false), + LockoutEnd = table.Column(nullable: true), + LockoutEnabled = table.Column(nullable: false), + AccessFailedCount = table.Column(nullable: false), + QRcode = table.Column(nullable: true), + drinks = table.Column(nullable: false), + food = table.Column(nullable: false), + TeamId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUsers_Teams_TeamId", + column: x => x.TeamId, + principalTable: "Teams", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "EventLocsVisited", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TeamId = table.Column(nullable: true), + LocationId = table.Column(nullable: true), + timestamp = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EventLocsVisited", x => x.Id); + table.ForeignKey( + name: "FK_EventLocsVisited_EventLocs_LocationId", + column: x => x.LocationId, + principalTable: "EventLocs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_EventLocsVisited_Teams_TeamId", + column: x => x.TeamId, + principalTable: "Teams", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUsers_TeamId", + table: "AspNetUsers", + column: "TeamId"); + + migrationBuilder.CreateIndex( + name: "IX_EventLocs_ImgId", + table: "EventLocs", + column: "ImgId"); + + migrationBuilder.CreateIndex( + name: "IX_EventLocsVisited_LocationId", + table: "EventLocsVisited", + column: "LocationId"); + + migrationBuilder.CreateIndex( + name: "IX_EventLocsVisited_TeamId", + table: "EventLocsVisited", + column: "TeamId"); + + migrationBuilder.CreateIndex( + name: "IX_Logs_UserId", + table: "Logs", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Logs_UserId1", + table: "Logs", + column: "UserId1"); + + migrationBuilder.CreateIndex( + name: "IX_Logs_productId", + table: "Logs", + column: "productId"); + + 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_Logs_AspNetUsers_UserId", + table: "Logs", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Logs_AspNetUsers_UserId1", + table: "Logs", + column: "UserId1", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + 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: "Logs"); + + migrationBuilder.DropTable( + name: "Values"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "EventLocs"); + + migrationBuilder.DropTable( + name: "Products"); + + migrationBuilder.DropTable( + name: "Photos"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "Teams"); + } + } +} diff --git a/api/Migrations/DataContextModelSnapshot.cs b/api/Migrations/DataContextModelSnapshot.cs index be123977..524187e6 100644 --- a/api/Migrations/DataContextModelSnapshot.cs +++ b/api/Migrations/DataContextModelSnapshot.cs @@ -85,6 +85,94 @@ namespace api.Migrations b.ToTable("AspNetUserTokens"); }); + modelBuilder.Entity("api.Models.Event", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Desc"); + + b.Property("Nome"); + + b.HasKey("Id"); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("api.Models.EventLoc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Desc"); + + b.Property("EventId"); + + b.Property("ImgId"); + + b.Property("Lat"); + + b.Property("Long"); + + b.Property("Nome"); + + b.HasKey("Id"); + + b.HasIndex("ImgId"); + + b.ToTable("EventLocs"); + }); + + modelBuilder.Entity("api.Models.EventLocVisited", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("LocationId"); + + b.Property("TeamId"); + + b.Property("timestamp"); + + b.HasKey("Id"); + + b.HasIndex("LocationId"); + + b.HasIndex("TeamId"); + + b.ToTable("EventLocsVisited"); + }); + + modelBuilder.Entity("api.Models.Log", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("UserId"); + + b.Property("UserId1"); + + b.Property("amount"); + + b.Property("available"); + + b.Property("logType"); + + b.Property("productId"); + + b.Property("transactionId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId1"); + + b.HasIndex("productId"); + + b.ToTable("Logs"); + }); + modelBuilder.Entity("api.Models.Photo", b => { b.Property("Id") @@ -107,6 +195,24 @@ namespace api.Migrations b.ToTable("Photos"); }); + modelBuilder.Entity("api.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("basePrice"); + + b.Property("name"); + + b.Property("revenue"); + + b.Property("sold"); + + b.HasKey("Id"); + + b.ToTable("Products"); + }); + modelBuilder.Entity("api.Models.Role", b => { b.Property("Id") @@ -130,6 +236,30 @@ namespace api.Migrations b.ToTable("AspNetRoles"); }); + modelBuilder.Entity("api.Models.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CapId"); + + b.Property("EventId"); + + b.Property("NMembros"); + + b.Property("Nome"); + + b.Property("Pontos"); + + b.Property("QRcode"); + + b.HasKey("Id"); + + b.HasIndex("CapId"); + + b.ToTable("Teams"); + }); + modelBuilder.Entity("api.Models.User", b => { b.Property("Id") @@ -165,11 +295,17 @@ namespace api.Migrations b.Property("SecurityStamp"); + b.Property("TeamId"); + b.Property("TwoFactorEnabled"); b.Property("UserName") .HasMaxLength(256); + b.Property("drinks"); + + b.Property("food"); + b.HasKey("Id"); b.HasIndex("NormalizedEmail") @@ -179,6 +315,8 @@ namespace api.Migrations .IsUnique() .HasName("UserNameIndex"); + b.HasIndex("TeamId"); + b.ToTable("AspNetUsers"); }); @@ -239,6 +377,39 @@ namespace api.Migrations .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") @@ -247,6 +418,20 @@ namespace api.Migrations .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") diff --git a/api/Models/Event.cs b/api/Models/Event.cs new file mode 100755 index 00000000..5246e9ca --- /dev/null +++ b/api/Models/Event.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace api.Models + +{ + public class Event + { + public int Id{get;set;} //id + public String Nome{get;set;} //nome + public String Desc{get;set;} //descrição + + } +} \ No newline at end of file diff --git a/api/Models/EventLoc.cs b/api/Models/EventLoc.cs new file mode 100755 index 00000000..96ec6a23 --- /dev/null +++ b/api/Models/EventLoc.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace api.Models + +{ + public class EventLoc + { + public int Id{get;set;} //id + public int EventId{get;set;} //Event ID + public float Lat{get;set;} //latitude + public float Long{get;set;} //longitude + public String Nome{get;set;} //Nome da localização + public String Desc{get;set;} //Descrição + public Photo Img{get;set;} //Foto da localização + + } +} \ No newline at end of file diff --git a/api/Models/EventLocVisited.cs b/api/Models/EventLocVisited.cs new file mode 100755 index 00000000..3cb2b045 --- /dev/null +++ b/api/Models/EventLocVisited.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace api.Models + +{ + public class EventLocVisited + { + public int Id{get;set;} //id + public Team Team{get;set;} //teamQRID + public EventLoc Location{get;set;} //location + public DateTime timestamp{get;set;} //time + } +} \ No newline at end of file diff --git a/api/Models/Log.cs b/api/Models/Log.cs new file mode 100644 index 00000000..a7e8bada --- /dev/null +++ b/api/Models/Log.cs @@ -0,0 +1,21 @@ +using System; +using Microsoft.AspNetCore.Identity; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace api.Models + +{ + public class Log + { + [Key()] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id{get;set;} + //public User user{get;set;} + public int amount{get;set;} + public int available{get;set;} + public Product product{get;set;} + public string transactionId{get;set;} + public string logType{get;set;} + + } +} \ No newline at end of file diff --git a/api/Models/Product.cs b/api/Models/Product.cs new file mode 100644 index 00000000..d509548c --- /dev/null +++ b/api/Models/Product.cs @@ -0,0 +1,21 @@ +using System; +using Microsoft.AspNetCore.Identity; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace api.Models + +{ + public class Product + { + [Key()] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id{get;set;} + public string name{get;set;} + public int basePrice{get;set;} + public int sold{get;set;} + public float revenue{get;set;} + + } +} \ No newline at end of file diff --git a/api/Models/Team.cs b/api/Models/Team.cs new file mode 100755 index 00000000..f029e0b9 --- /dev/null +++ b/api/Models/Team.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +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 + public ICollection Membros {get;set;} //Membros da equipa + public int NMembros {get;set;} //Numero de Membros na equipa + public int Pontos {get;set;} //Postos da equipa + } +} \ No newline at end of file diff --git a/api/Models/User.cs b/api/Models/User.cs index 5faa326d..6a90fdff 100755 --- a/api/Models/User.cs +++ b/api/Models/User.cs @@ -7,9 +7,15 @@ namespace api.Models { public class User: IdentityUser { - public string QRcode{get;set;} + + public string QRcode{get;set;} public ICollection UserRoles{get;set;} + public ICollection logsFebrada{get;set;} + public ICollection logsFestarola{get;set;} public ICollection Photos {get;set;} + public int drinks{get;set;} + public int food{get;set;} + } } \ No newline at end of file diff --git a/api/Models/Value.cs b/api/Models/Value.cs index 362f638b..140b15cc 100755 --- a/api/Models/Value.cs +++ b/api/Models/Value.cs @@ -1,4 +1,3 @@ - namespace api.Models { public class Value diff --git a/api/Models/movsFestarola.cs b/api/Models/movsFestarola.cs new file mode 100644 index 00000000..8a290692 --- /dev/null +++ b/api/Models/movsFestarola.cs @@ -0,0 +1,13 @@ +using System; +using Microsoft.AspNetCore.Identity; +using System.Collections.Generic; + +namespace api.Models + +{ + public class movsFestarola + { + + + } +} \ No newline at end of file diff --git a/api/Properties/launchSettings.json b/api/Properties/launchSettings.json deleted file mode 100755 index 8a8940ed..00000000 --- a/api/Properties/launchSettings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:40138", - "sslPort": 44339 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "api/values", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "api": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "api/values", - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Production" - } - } - } -} \ No newline at end of file diff --git a/api/Startup.cs b/api/Startup.cs index 3c17f0c0..62aee96b 100755 --- a/api/Startup.cs +++ b/api/Startup.cs @@ -45,7 +45,7 @@ namespace api services.AddAutoMapper(); services.AddScoped(); - + //define a connection string indicada em appsettings.json services.AddDbContext(x=>x.UseMySql(Configuration.GetConnectionString("DefaultConnection"))); diff --git a/api/Views/Landing/index.cshtml b/api/Views/Landing/index.cshtml deleted file mode 100755 index 544f9ef3..00000000 --- a/api/Views/Landing/index.cshtml +++ /dev/null @@ -1 +0,0 @@ -lols \ No newline at end of file diff --git a/api/obj/Debug/netcoreapp2.1/api.assets.cache b/api/obj/Debug/netcoreapp2.1/api.assets.cache old mode 100755 new mode 100644 diff --git a/api/obj/Debug/netcoreapp2.1/project.razor.json b/api/obj/Debug/netcoreapp2.1/project.razor.json old mode 100755 new mode 100644