From 7dc71e2eab6f8f2f808c679b653ae63f61037ed8 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Mon, 14 Sep 2020 13:36:26 +0200 Subject: [PATCH 001/157] instantiated controller, model, repo and service for handling files. --- API/Controllers/FileController.cs | 55 +++++++++++++++++++ .../DependencyInjectionExtensions.cs | 4 ++ Models/File.cs | 31 +++++++++++ Repositories/FileRepository.cs | 45 +++++++++++++++ Services/Services/FileService.cs | 49 +++++++++++++++++ 5 files changed, 184 insertions(+) create mode 100644 API/Controllers/FileController.cs create mode 100644 Models/File.cs create mode 100644 Repositories/FileRepository.cs create mode 100644 Services/Services/FileService.cs diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs new file mode 100644 index 00000000..bf766cd1 --- /dev/null +++ b/API/Controllers/FileController.cs @@ -0,0 +1,55 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Services.Services; + +namespace API.Controllers +{ + /// + /// File controller for files + /// + [Route("api/[controller]")] + [ApiController] + public class FileController : ControllerBase + { + + private readonly IFileService fileService; + private readonly IMapper mapper; + private readonly IProjectService projectService; + private readonly IUserService userService; + /// + /// Initializes a new instance of the class. + /// + /// The file service. + /// The mapper. + /// The Project service + /// The User service + public FileController(IFileService fileService, IMapper mapper, IProjectService projectService, IUserService userService) + { + this.fileService = fileService; + this.mapper = mapper; + this.projectService = projectService; + this.userService = userService; + } + } +} diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index c11b181c..4197d720 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -15,6 +15,7 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using AngleSharp.Io.Dom; using Data; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; @@ -56,6 +57,9 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddScoped(); diff --git a/Models/File.cs b/Models/File.cs new file mode 100644 index 00000000..110dd95d --- /dev/null +++ b/Models/File.cs @@ -0,0 +1,31 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Models +{ + public class File + { + public int Id { get; set; } + [Required] + public string Path { get; set; } + } +} diff --git a/Repositories/FileRepository.cs b/Repositories/FileRepository.cs new file mode 100644 index 00000000..9186122a --- /dev/null +++ b/Repositories/FileRepository.cs @@ -0,0 +1,45 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Microsoft.EntityFrameworkCore; +using Models; +using Repositories.Base; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Repositories +{ + + public interface IFileRepository : IRepository + { + Task> getFileByFileIDAsync(int fileId); + + } + + public class FileRepository : Repository, IFileRepository + { + + public FileRepository(DbContext dbContext) : base(dbContext) { } + + public Task> getFileByFileIDAsync(int fileId) + { + throw new NotImplementedException(); + } + + } +} diff --git a/Services/Services/FileService.cs b/Services/Services/FileService.cs new file mode 100644 index 00000000..e63b1baf --- /dev/null +++ b/Services/Services/FileService.cs @@ -0,0 +1,49 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Models; +using Repositories; +using Services.Base; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Services.Services +{ + + public interface IFileService : IService + { + + Task> getFileByFileIDAsync(int fileId); + + } + + public class FileService : Service, IFileService + { + public FileService(IFileRepository repository) : base(repository) { } + + protected new IFileRepository Repository => (IFileRepository) base.Repository; + + + // Todo: Make Async + public Task> getFileByFileIDAsync(int fileId) + { + throw new NotImplementedException(); + } + } + +} From 4ba099f6a102f38792132b454bf12d9a6d315b12 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Mon, 14 Sep 2020 13:42:33 +0200 Subject: [PATCH 002/157] initialized repo, service, model and controller for handling files --- Repositories/FileRepository.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Repositories/FileRepository.cs b/Repositories/FileRepository.cs index 9186122a..6e645efe 100644 --- a/Repositories/FileRepository.cs +++ b/Repositories/FileRepository.cs @@ -27,7 +27,8 @@ namespace Repositories public interface IFileRepository : IRepository { - Task> getFileByFileIDAsync(int fileId); + Task> GetFileByFileIDAsync(int fileId); + } @@ -36,10 +37,9 @@ public class FileRepository : Repository, IFileRepository public FileRepository(DbContext dbContext) : base(dbContext) { } - public Task> getFileByFileIDAsync(int fileId) + Task> IFileRepository.GetFileByFileIDAsync(int fileId) { throw new NotImplementedException(); } - } } From feddbe00a091e68da89a0c7fe87d6850aa96bb29 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Wed, 16 Sep 2020 11:56:48 +0200 Subject: [PATCH 003/157] changed file model. Added get all files endpoint and upload single file endpoint. --- .gitignore | 1 + API/1_API.csproj | 6 +- API/Configuration/MappingProfile.cs | 3 + API/Controllers/FileController.cs | 73 +++++ API/Resources/FileResource.cs | 42 +++ API/Resources/FileResourceResult.cs | 52 ++++ Data/4_Data.csproj | 5 + Data/ApplicationDbContext.cs | 9 + .../20200916082905_AddFileModel.Designer.cs | 292 ++++++++++++++++++ .../Migrations/20200916082905_AddFileModel.cs | 33 ++ .../ApplicationDbContextModelSnapshot.cs | 25 ++ Models/File.cs | 13 + Repositories/FileRepository.cs | 18 +- Services/Services/FileService.cs | 33 +- 14 files changed, 597 insertions(+), 8 deletions(-) create mode 100644 API/Resources/FileResource.cs create mode 100644 API/Resources/FileResourceResult.cs create mode 100644 Data/Migrations/20200916082905_AddFileModel.Designer.cs create mode 100644 Data/Migrations/20200916082905_AddFileModel.cs diff --git a/.gitignore b/.gitignore index 551cf78a..69c5bbff 100644 --- a/.gitignore +++ b/.gitignore @@ -333,3 +333,4 @@ profile IdentityServer/tempkey.rsa +/API/FileFolder diff --git a/API/1_API.csproj b/API/1_API.csproj index b7958826..c35cb26c 100644 --- a/API/1_API.csproj +++ b/API/1_API.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -43,5 +43,9 @@ + + + + \ No newline at end of file diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 3cb31569..bcbd0ace 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -54,6 +54,9 @@ public MappingProfile() CreateMap(); CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); CreateMap(); } diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index bf766cd1..786b5df9 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -15,13 +15,27 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.Extensions; +using API.Resources; using AutoMapper; +using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.WebUtilities; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Models; +using RestSharp; using Services.Services; +using System.Collections; +using System.Collections.Specialized; +using System.IO; +using System.Net.Http; +using System.Security.Claims; +using System.Security.Principal; +using File = Models.File; namespace API.Controllers { @@ -51,5 +65,64 @@ public FileController(IFileService fileService, IMapper mapper, IProjectService this.projectService = projectService; this.userService = userService; } + + /// + /// Get all files + /// + /// A response and list of files. + [HttpGet] + public async Task GetFilesAsync() + { + IEnumerable files = await fileService.GetFilesAsync(); + if(!files.Any()) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting files.", + Detail = "The database does not contain any files.", + Instance = "47525791-57C4-4DE2-91B1-90086D893112" + }; + return NotFound(problem); + } + + return Ok(mapper.Map, IEnumerable>(files)); + } + + /// + /// Uploads a single file + /// + /// + /// HTTP Response + [HttpPost] + public async Task UploadSingleFile() + { + IFormFile fileItem = HttpContext.Request.Form.Files["File"]; + string name = HttpContext.Request.Form["Name"]; + + if(fileItem == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed posting file.", + Detail = "File is null.", + Instance = "ACD46F17-A239-4353-92A5-0B81AA0A96E9" + }; + return NotFound(problem); + } + + string path = Path.Combine(Directory.GetCurrentDirectory(), "FileFolder", + name); + await using(Stream stream = new FileStream(path, FileMode.Create)) + { + await fileItem.CopyToAsync(stream); + } + + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + File file = new File(path, DateTime.Now, name, user.Id); + fileService.UploadSingleFile(file); + + return Ok(file); + } + } } diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs new file mode 100644 index 00000000..e2a451b3 --- /dev/null +++ b/API/Resources/FileResource.cs @@ -0,0 +1,42 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + + /// + /// Embedded project resource result + /// + /// + public class FileResource + { + /// + /// IFormFile + /// + public IFormFile File { get; set; } + public string Name { get; set; } + public DateTime UploadDateTime { get; set; } + public int UploaderId { get; set; } + + } +} diff --git a/API/Resources/FileResourceResult.cs b/API/Resources/FileResourceResult.cs new file mode 100644 index 00000000..1b9b96c9 --- /dev/null +++ b/API/Resources/FileResourceResult.cs @@ -0,0 +1,52 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + /// + /// File resource resource result + /// + /// + public class FileResourceResult + { + /// + /// Id of File + /// + public int Id { get; set; } + /// + /// Path of file + /// + public string Path { get; set; } + /// + /// Upload Date and time + /// + public DateTime UploadDateTime { get; set; } + /// + /// File name + /// + public string Name { get; set; } + /// + /// Id of uploader + /// + public int UploaderId { get; set; } + } +} diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index 5a43bd33..e141532c 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -5,6 +5,11 @@ 8 + + + + + diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index ad3ac839..3d50f090 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -75,6 +75,15 @@ public ApplicationDbContext(DbContextOptions options) : ba /// The role. /// public DbSet Role { get; set; } + /// + /// Gets or sets the file. + /// + /// + /// The file. + /// + public DbSet File { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) { diff --git a/Data/Migrations/20200916082905_AddFileModel.Designer.cs b/Data/Migrations/20200916082905_AddFileModel.Designer.cs new file mode 100644 index 00000000..8f692cb9 --- /dev/null +++ b/Data/Migrations/20200916082905_AddFileModel.Designer.cs @@ -0,0 +1,292 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200916082905_AddFileModel")] + partial class AddFileModel + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("File"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200916082905_AddFileModel.cs b/Data/Migrations/20200916082905_AddFileModel.cs new file mode 100644 index 00000000..e538395e --- /dev/null +++ b/Data/Migrations/20200916082905_AddFileModel.cs @@ -0,0 +1,33 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class AddFileModel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "File", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Path = table.Column(nullable: false), + UploadDateTime = table.Column(nullable: false), + Name = table.Column(nullable: true), + UploaderId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_File", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "File"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index ead5f215..853d906e 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -67,6 +67,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("EmbeddedProject"); }); + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("File"); + }); + modelBuilder.Entity("Models.Highlight", b => { b.Property("Id") diff --git a/Models/File.cs b/Models/File.cs index 110dd95d..20ffd2dc 100644 --- a/Models/File.cs +++ b/Models/File.cs @@ -24,8 +24,21 @@ namespace Models { public class File { + + public File(string path, DateTime uploadDateTime, string name, int uploaderId) + { + Path = path; + UploadDateTime = uploadDateTime; + Name = name; + UploaderId = uploaderId; + } + public int Id { get; set; } [Required] public string Path { get; set; } + public DateTime UploadDateTime { get; set; } + public string Name { get; set; } + public int UploaderId { get; set; } + } } diff --git a/Repositories/FileRepository.cs b/Repositories/FileRepository.cs index 6e645efe..c2fd6bce 100644 --- a/Repositories/FileRepository.cs +++ b/Repositories/FileRepository.cs @@ -21,13 +21,16 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace Repositories { public interface IFileRepository : IRepository { - Task> GetFileByFileIDAsync(int fileId); + + Task> GetFilesAsync(); + Task> GetFileByFileIdAsync(int fileId); } @@ -37,9 +40,18 @@ public class FileRepository : Repository, IFileRepository public FileRepository(DbContext dbContext) : base(dbContext) { } - Task> IFileRepository.GetFileByFileIDAsync(int fileId) + public async Task> GetFileByFileIdAsync(int fileId) + { + return await GetDbSet() + .Where(s => s.Id == fileId) + .ToListAsync(); + } + + public async Task> GetFilesAsync() { - throw new NotImplementedException(); + return await GetDbSet() + .ToListAsync(); + } } } diff --git a/Services/Services/FileService.cs b/Services/Services/FileService.cs index e63b1baf..e742dcbb 100644 --- a/Services/Services/FileService.cs +++ b/Services/Services/FileService.cs @@ -28,7 +28,10 @@ namespace Services.Services public interface IFileService : IService { - Task> getFileByFileIDAsync(int fileId); + Task> GetFileByFileIdAsync(int fileId); + Task> GetFilesAsync(); + + void UploadSingleFile(File entity); } @@ -38,12 +41,34 @@ public FileService(IFileRepository repository) : base(repository) { } protected new IFileRepository Repository => (IFileRepository) base.Repository; + public async Task> GetFileByFileIdAsync(int fileId) + { + return await Repository.GetFileByFileIdAsync(fileId).ConfigureAwait(false); + } + + public async Task> GetFilesAsync() + { + return await Repository.GetFilesAsync(); + } - // Todo: Make Async - public Task> getFileByFileIDAsync(int fileId) + public override void Add(File entity) { - throw new NotImplementedException(); + base.Add(entity); } + + public override void Update(File entity) + { + base.Update(entity); + } + + public void UploadSingleFile(File entity) + { + Repository.Add(entity); + Repository.Save(); + } + + + } } From 579111dde8293df104d07e63be83e045e4395b38 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Thu, 17 Sep 2020 10:56:00 +0200 Subject: [PATCH 004/157] Added endpoint for uploading project images. Added FileUploader extension to reduce lines of code --- API/Controllers/FileController.cs | 16 +- API/Controllers/ProjectController.cs | 58 +++- .../DependencyInjectionExtensions.cs | 2 + API/Extensions/FileUploader.cs | 53 +++ API/Resources/FileResource.cs | 11 + APIFileFolderFile | Bin 0 -> 13976 bytes ...AddFileReferenceToProjectTable.Designer.cs | 301 ++++++++++++++++++ ...17082653_AddFileReferenceToProjectTable.cs | 43 +++ .../ApplicationDbContextModelSnapshot.cs | 9 + Models/File.cs | 3 +- Models/Project.cs | 2 + Services/Services/FileService.cs | 1 + 12 files changed, 486 insertions(+), 13 deletions(-) create mode 100644 API/Extensions/FileUploader.cs create mode 100644 APIFileFolderFile create mode 100644 Data/Migrations/20200917082653_AddFileReferenceToProjectTable.Designer.cs create mode 100644 Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 786b5df9..91f3ce8a 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -51,6 +51,7 @@ public class FileController : ControllerBase private readonly IMapper mapper; private readonly IProjectService projectService; private readonly IUserService userService; + private readonly IFileUploader fileUploader; /// /// Initializes a new instance of the class. /// @@ -58,12 +59,14 @@ public class FileController : ControllerBase /// The mapper. /// The Project service /// The User service - public FileController(IFileService fileService, IMapper mapper, IProjectService projectService, IUserService userService) + /// /// The file uploader extension + public FileController(IFileService fileService, IMapper mapper, IProjectService projectService, IFileUploader fileUploader, IUserService userService) { this.fileService = fileService; this.mapper = mapper; this.projectService = projectService; this.userService = userService; + this.fileUploader = fileUploader; } /// @@ -91,13 +94,11 @@ public async Task GetFilesAsync() /// /// Uploads a single file /// - /// /// HTTP Response [HttpPost] public async Task UploadSingleFile() { IFormFile fileItem = HttpContext.Request.Form.Files["File"]; - string name = HttpContext.Request.Form["Name"]; if(fileItem == null) { @@ -110,15 +111,10 @@ public async Task UploadSingleFile() return NotFound(problem); } - string path = Path.Combine(Directory.GetCurrentDirectory(), "FileFolder", - name); - await using(Stream stream = new FileStream(path, FileMode.Create)) - { - await fileItem.CopyToAsync(stream); - } + string path = await fileUploader.UploadSingleFile(fileItem); User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - File file = new File(path, DateTime.Now, name, user.Id); + File file = new File(path, fileItem.Name, user.Id); fileService.UploadSingleFile(file); return Ok(file); diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index f0dec293..56afde63 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -19,6 +19,7 @@ using API.Resources; using AutoMapper; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Models; @@ -41,17 +42,23 @@ public class ProjectController : ControllerBase private readonly IMapper mapper; private readonly IProjectService projectService; private readonly IUserService userService; + private readonly IFileService fileService; + private IFileUploader fileUploader; /// /// Initializes a new instance of the class. /// /// The project service. /// The user service. + /// The fileservice. + /// The fileuploader. /// The mapper. - public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper) + public ProjectController(IProjectService projectService, IUserService userService, IFileService fileService, IFileUploader fileUploader, IMapper mapper) { this.projectService = projectService; this.userService = userService; + this.fileService = fileService; + this.fileUploader = fileUploader; this.mapper = mapper; } @@ -264,5 +271,54 @@ public async Task DeleteProject(int projectId) projectService.Save(); return Ok(); } + + /// + /// Upload Image that belongs to a project + /// + /// Status code 200 + [HttpPost] + [Route("UploadImage")] + public async Task UploadProjectImage() + { + IFormFile fileItem = HttpContext.Request.Form.Files["File"]; + int projectId = int.Parse(HttpContext.Request.Form["ProjectId"]); + + if(fileItem == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed posting file.", + Detail = "File is null.", + Instance = "2F309E3F-EF49-42C2-8A45-7155A1F2B907" + }; + return NotFound(problem); + } + + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + try + { + string path = await fileUploader.UploadSingleFile(fileItem); + File file = new File(path, fileItem.Name, user.Id); + fileService.UploadSingleFile(file); + + Project project = await projectService.FindWithUserAndCollaboratorsAsync(projectId) + .ConfigureAwait(false); + project.ProjectIconFileId = file; + projectService.Update(project); + return Ok(project); + } catch + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed posting file or updating project", + Detail = "Failed posting file or updating project.", + Instance = "AD9E0FF5-BF36-4285-9AD1-18CFF3293F7E" + }; + return NotFound(problem); + } + + + } } } diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 4197d720..6ac61eab 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -60,6 +60,8 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddScoped(); diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs new file mode 100644 index 00000000..dea8033a --- /dev/null +++ b/API/Extensions/FileUploader.cs @@ -0,0 +1,53 @@ +using Microsoft.AspNetCore.Http; +using Serilog; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Extensions +{ + /// + /// Interface for file uploader + /// + public interface IFileUploader + { + /// + /// Method that uploads the file to the file server + /// + /// + /// + Task UploadSingleFile(IFormFile file); + + } + + /// + /// Class which is responsible for uploading files + /// + public class FileUploader : IFileUploader + { + + private static readonly string UploadPath = Directory.GetCurrentDirectory() + "FileFolder"; + + /// + /// Uploads single file + /// + /// + /// path of file location + public async Task UploadSingleFile(IFormFile file) + { + try + { + await using Stream stream = new FileStream(UploadPath + file.Name, FileMode.Create); + await file.CopyToAsync(stream); + return UploadPath + file.Name; + } catch(Exception e) + { + Log.Logger.Error(e, "Unexpected error"); + throw e; + } + } + + } +} diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs index e2a451b3..77f7e43a 100644 --- a/API/Resources/FileResource.cs +++ b/API/Resources/FileResource.cs @@ -16,6 +16,7 @@ */ using Microsoft.AspNetCore.Http; +using Models; using System; using System.Collections.Generic; using System.Linq; @@ -34,8 +35,18 @@ public class FileResource /// IFormFile /// public IFormFile File { get; set; } + /// + /// Name of file + /// public string Name { get; set; } + /// + /// Date and time of uploading + /// public DateTime UploadDateTime { get; set; } + + /// + /// UploaderId of file + /// public int UploaderId { get; set; } } diff --git a/APIFileFolderFile b/APIFileFolderFile new file mode 100644 index 0000000000000000000000000000000000000000..b415191db085ca2688bb06e5d5e49857d8ebe1b4 GIT binary patch literal 13976 zcma*OWk6Kl7d3om=#cJ^7F49AJEWvr8bm}=VnA}}p&OKL0hN;OQoxb!4(X1e>$$)G z`+j-8J$$(g!#U^Pz4uvr?S0pY&{S7^giC`90Kg+b}Rru^fLfZx@0zKiGyEY zTB$0^gIDn9O0GEoykNO2t0`cuU=kBN<9K3s08aQaQdwR`*K2ma^;0srP4?#9C#yzP zC!u~;QX*YJaxG$v#9#E9bA9_<3)jUTa(kPnha0=!`A!JGU5|NPaO#uY z@TvVGV(HWvo!F0HOyFfMju-wkP79Qd2frKF+lly|IVf8?M5?B)?wKsYI54yWYSE+c zkcqhnNd=IPx-Xw>UA?-LV+Cwt?b2B)rH=66yzo(^>L8>YYKA_G-z`jmqG4Vm#*zMF znf|0hdYRaQ_*~zd+ogfOyShJ1`0 z$VAtNwxcid;Quoj-i_tRRsvK$PfkwaGW7`TIbVxN*J>2EW4w0Y_3Gt`9?U&dkhheF zYFd3Rrbc^W9k9iKNrRR>3dtq+lEJQOYityuKk{WZA;OWyu}Cil4tma)hp@shCB8nd zq`gr(W4XA9jRWiVlpw2z=_TsDEX7Ac7zuLMB51O}d2V4e%z1z&D<65<(Ikit4f z__}${(IxWQKod!h?sv8m-hA=r(quqo%F5ChhWmZLeCEP|D|`~J1h9_H&X(aa{kC>K z+(erq3cBH{rcOq~>U-3LiIPRbC>q9TiFtupOtkvm&CPAt?U^z3L4i|oc6OEwd{E1P zF)4z1Y3zgAzD?!2!~A#uL_bK*cXj@>6)7os?-?tXBS3u?mLWYBl)dpQ6K&E$>dAKj z{C{tUNuLQpABs3B^~+6^xzcDO_dCrIeohRL*3FllXyXpEN*|D~td>laP;*~P_N06^ zZkH6={ont4lB`23qgC3Qc{J&nwcq{}pe#Tg#tF9J{IFx*sU*$~kwtn7W7b$kbsB4NxUR@UmlG!^ z^+SjzIvn;0@7!~lw?08iHV3utj`g)^Cv}b|C=m|lWmD#Az#t2{iX6*q$dj64<&r5v z4B|5L3}^UyN0cnWGb1B|Uq+)O8GAyE`rYfXXf&NFDHLWruD3d%@Zq=!iN*cxAq2wLpt(AU6z`M=d~38 z<2cdYYYB@!95FX#%C^^nb52UK~#L_+WZplYqwhEDM zJ@BqkP8#_wlqW!deXVaAjj`835nR-9UUI&I!3+UXxy@tqIan&A-g2Qkv9a=AURM>2 zJIuWP@Xwp%=G<)ZivdSAPRB0}+?~pm_i9PQ?62j=!=Ft)C3NUk*M7tIemIx=cN_y4 zjL@PXTxrkk?+_EEmM_>Lt3)OeKB+r#b&0dn`+t$j)2+Cj35}=IS6$q!T=EL^yd-|3 zWHlfE5!c?W&A4h%ToQ>X+eO$I`P{4y<__V&?b2(d`A<}A$wLy=b*^U4oop9j$u(}a zW=!wv=l?`VJy45f`=#HSF?1d2J#rl90Nn@1sN(o|U;TC_=Mkjt^oU$Ri(v2zKl_%* zm23_XFedQ4Qfe=%GVW0Jc#hpwBvGurZTYX*KXV7wv!VOM;QIOBQ{1;fgY7pJ_gp4Z zBTkQF1V8f4PKy!i>D|w^i<(ZejhdssdDP9ZI74FfM;~}&Z0y0*voJk`A|&+G%8fW>Nxh)QQ2Cw~gKK zSTkpS8SZ}U$GRbl@c~O!b4giGy|>GE+DKK7r;vsc_ethuGuhQn%0@bJb3f$|-J)eu zi;>>v4#PT4;!Wxce4^pQ~53+pO+F>cEUA}bvbO*!!L!n6SpO5Ksw2fg>h z^+e$GRnBpmKR>aQ#_UEgh*OpD50OX8wo|6&#x&mD#=#C3)qH$zuG%-_9&qt}9=5Mk{m(O?!0;7efZ|4$IfleS*S4~`Q~LWu{PI?=*H#vg zoY5DU9ceOYN`xr1$^A}-n1!b6j}CcC{EqOnbEj=t*Wy4-~B!EBMF>; zG$v57DZ4sAAJP-dU2XKN{r2Tc5P$Fb6-zd|_KDmgMSX=mepL8ijPmUc-!Uc}6EE!)%Nsihj0*FU<4N zVKt{JxO$3#S)ydIn)GE4w7Ko{bbiYG41CzDo6xWjYFGMGvq^%g3j5>aTww!=}xY0bua%s}$SC%vTu=b4iJ9Bq@7AoU`osMCdke z9;p|pG5+i2hN(Lear08Ubev^~gRL3A=JOja5d|@i#B{=X&7XE?xnt(dOb(WWUx1e0c!E&AMkd*B)Vf>8GY4Kn8>-(=xiQb=fhJX3 zwI2WC0CXy{VYO=l629pNj*V&B3g+fGV4h z2O9qJPE+dFtm$E}F@^ewX-;EBbThC9=C*;GB4;c;TSMXA6PeAPWQqzEYb#XL$Mf;%rk9K z$Va>g%q>It{E}}z{{7r+Gy{l7emp09cySes6=bINp6K`hwO*_YdlCFrc>c`-9W)i> z06ywv%oopq1&LiO$Z4e%DhWrqRh%g?l~s5<&Y0i}O{OpZBiNm%zmd393s?`IZnK&I~gEt*cA9))WX6fr*gjbQSY?;2%;4Ar{ zv*&%8r_=%&R?n`)vvHc0uJ$uP_afy3I?waI6jUxOvtTDFPTA2=W1TYR zV)m?ck&WeR502?Lsq)>t3{l`fw1s@N(Qy}^2Q^5xKn=AnE^D8=3Qd1~BCJXLBCIQb4+ z$afv~{+8O*zsC05`)%T`tQ>6(qmi?a%pR@)-RBovMm>b|)o!~& zo?@rWxXe{s%JP4|H2;nu%nhGLh4;1G)1*c%1{0@Q(Mzds#7w+hH1x~6IqB&ykqiGr z7JUBg&e|C|9I@b6tN;5i>R)f^l?(q%+Nq=#@V>A&5j!6e<6gw`!^$Y`4t$g=Oi59E z$e`Q$r9`vZL{wP{2O6f?`(Fo+7wZD&n-`HLdH{ZRUq*2wCE=L+P<`cMLv|#$kFzEH zN@h=sB5~;(yMMdij}Gv=EUre zBl7P6=A^u`4vIF&M#@V5i8wbQj(&zS&NebViIzzQm*m4f1jE;19(e>7T>0=#2(QX1q5dx zC1xOWMU)z=&WWYpPA|$)mgAP)h$X2B^8#6-jDLDac|p3vcMgt-QgzIE5H5Q8s_ z3BaY|Nxv<0JGLN(I%+j|jCYke#N`w_J}-?5aA5=prEXmwi`5SE&iI4>8mMicXm!vM zWNwZiJqr35I=#1%>nyV*tF@ONIw%|w%#UF?v%R!5u&vr$z)MfC zp#oIDe9HMS_V|YEcxHeDEvUk_V!^M%l!sqdv}=Jlw_t-=9iu~!Q(E#divjukWX+zI zZlXqj)Rqx&uFfiWmzVo>gx%#6`t&Xi&@cxPUK}${SFdaO-7YrPi%@IC+b>={{Tb;B zH4BmSxVE8+UTa1OkJ zGKQ{=El%8=?hpgg;}Zp;nxFq*>M4wi5L6xZ91ssbck)j%5rOjGSsp5g(;Ma9^Q#3U0xmJi)jC$ z64TQi=e1ZqtI8lv2-X@U15dyMuDrd`<9IF zjE{?OeblL7zzsa}-?vakT5`Yz#a-t79`Z>IS! zyEVfS=gzBiGp_#{Q6Z8*FPPOxN`-s9`j$K=2 zP@-=?U1u}QTKYkraC3s^Dh5-krO#N{GkRIj7BsqCM%f{QtmZ5K&26EsC6LQnlkti; z!!@nu_=kJ?ARD*Y3d4(0M`TgCM&r3?4X<_4EQe6?eT>sBf3xwMHztn%3J-zm+B+5g z|^JbUo9DkLA-HO6;Ucp|3KZ6M)KPG@n3V7nk)ZSI*3$+*| zL(mYau~~;+_c`VMfhp{*`FcBa(yg)f@Q}Z(*ydyj+C;6D2(gF>s z&2-h1q&@WKXZwBT-wm}^^ZGNnlN%Ge7W;f%%gw$rG#CF{=!QFb^IoMKo{BD2A*H+x z8&3b(y{P$R=ubquZ#D{7XUC*w&Pfr>9;JeRpiD#uA3j_%1GaGIg%(Cp+!oP@#<*N1 z_tZD+8pGSGa#=GC*|$PVea4mf)9g@U1I4lV@j!Re3N&0I0PK5o$Ou(Ls6)$xiW7WQ zoLbul*DI{DME>1k%y4c`%@z(S=kO30@m?PMwtQ7u{!s_>9^GZMHU_%6@rN)z1_l_g z-goGZ=XI}9_pNVTuAi2hr+#`c{cf$eKA<{=7{GTTy@+AndEtT!`Xvtz%Q)sj?~YY&*_;nRc&It7j2XsaN+4LpF@ z&C{!(So=s~Ak71kUmy*?{5!)DjHz5ZavYW8Bl+&W&ysIfGG6o$O!ORj4Yc*_fZOKa zi@)l`ZVur7O(uk!9v<2?p531;(J{BeVv?)Ip3fBul4ylLQfyuqwELGv;@<;Ee}pb` zQRKFneORB-X8fl!Hq0T?`i8C}Pm3aqr- zwt2xN{idkcB5vi{1hbK6dVLcaiUqM$Pdy$L!B<=8h0$x!gaP4LzJ4~6wQHB2G}u42 zo`WXEvKSPtbG+2rtxGYH>wa^eKXX+`15wXA#bzKa4%iQ!eQF4BB1J=@x)}92U#V}5 z81yMiwi;d&luRX>KTdE;np2W*K2-znFS9_H1LWSe(nFK|oHhUGfj6JES{VK?6c z9rlcaru>HVuu09mle$U%J4xtgq;Y`c?z_8o`-DlB@_FqVVfm_1+liTlKh>u3!=xMU zFMl=>Pf0`l90}alTqdloLT0^qL#mD^pKv6TiKf_>)&NqgsxYq0%fTj{9?34yVxm!TL%oqF7G30Xu?PVX%_ zT=Eh-{{1H^g_FUryAuYLgH1cwdg7@HO=?a!A3+*JG?){L#7t9!`=n>!Ra6*$2gryX zO@~`S1Y*{7hWcs~21bup@d7!yZ&u!wvh^tNMM$1?N>5U-R%Zm7L=VLQcknjS9qRT& z2*@#uW|i6>9yc!RcXIONu(xVE;T%t+u!?RpWJ7HlV<6bNz`4~|W>IDXy_lkl6pE3q z@=F%#_SpM!`FGvkC*kWUM3gU|qI?eU++*69(YwBKNOPD0=l`BimE;GRFlf2mozIQ* z#-x2CX{n0yQBxv zAvC_lX8+C1tNWga+%)fO5V)+eQVnEH{!2=8huGdzJId6CiY z-^Q|41)+406)S}V+k*PAVt_%Hs9*ZuibXI? z5GPzzt8VxJIwQEbUg&=jb+h7smuKb{qe}}G@=EPb>(v8z3k}*aNmLQ`^|3OI{_nwQ zgUgub_v7W5fE!4!t=3F>`U&U5cMe@~mik2o>E1-js?k`V>dRP8;dHsd0Cy~#D03LD8oI$dv$ly=d{4==t~?&nsKi= zj6{(Yb*2D&Lihz+B$|QP(sj`=Kt(PX9BIsR~iVAZUlNbhx0zn%R4 zTLoFmLa!iG>Us9d&>bJ}Vh6A)ts!(0*tXXbGrS9Ii_bVM|0*2kx&9FKMJMl8^pbjz z@EP{pPm~P!g7EivuXB({8@Pp)9;P(W^eL2G45)YvQD0_$!JG3sF{#BdHMVSaupQ9> zl5DgxgC(2JT+}zWT_vZBo^s0IObMSlG~rd0x2o2jSs>f%+qN4mHs9xp4T{vl*nTbZ zJF3;hcQ?)b?&9nr!aJd+8t4`)U7^db5<)mWNlCjN69#3=ju^7tW5al__cjv2Kplm6 ziKij6P(9`0_AYu1P04Z4vpFa3E9XpCIeJmLeTv4sX}*uNXgr<=CK~zQTgc!rAp`L)1a^)Rz*2xQ2mygJ zdID_M*zvcEW7wNn#w@pmA$Va84p@^1UrY(7hDq_35wA`C`hP(X>0}X#tW!5p9AKMV zObe3`$D5{{C<499G}8AH21aT3bS;D~;YaDyMlP8MMFzR?WQ`ZWuA&&iars0UdT%h~ zLT;$wM^`|4M#j)Gv((I}hpS$!ST1@j;+K-YhJR~2Vs(UF4c1&lKvvYY7;`#m%AdXH z;M0-{`%3vH{ne!DRe^MblmME?(Q@ur;uUmL#enzv!#`c3k)-gSsWyJQDUKBw9aldi zY*Gf5;Y6@+6^KNc_6z^|p^3ni6LgCJu&HXBq7R*eNN@K*x70{gMf(c5nG=;!cCK?j zKZPP08HchTnEL2}A~!O_DntK*A?(8lH6Nk`?0``tO&RIsRv_8bj>n@%$;xInr;Sqs z!X-OCp1VYQe=)euB3*)E!M)sosr$4Cs(Yz<$SwQ$I@*Y6_1`-!t%#Bmm(xT|Joq=K zqM2F$yx3BMYat?`H()U>Pt0*gJIt<5;7wy7U-+TJ^lho_|CVYf)64!=!kDAvC5~~Z zBz}+1yseVOBCEvNQ`)8C7fk!0O)$M#>K8Xo$_ zHu&Z!IQzE^@j-f^`CvIa~3>~oVO zEv13Rq^@ePa%@ZHiDA~%dzSr%bKy1Eo^8@^=V~pQPT3Om4=P8yxf(*fPSNXUp ztf#mT?cE(SI$0J=6#+I{UBx7m-W3pmOm*+qqK(h1N~pAO9Mt+^K3r7W-|VWf{XtCB z+=ymcRE#VIHNzh`(@y0v?efh3MCa4e=t5~1y(I|%mc;^1pMD)2nAX|$9YrVm@@W3D zy0UDa>`!uUZF{y=6c%Q3!{uu3$21WJLpp*TI*itFypl50N7EwNk0C*H5SK;lvv=UJSYnSOO2W4#dx6NdSzQ>Sf*`M_9 z6B2Aj8rO<)(`ZDi8Jw5`#(&D!BlBaNWvPXEwu+#zLaTUQfKd@phxBHeW&SAd9PJtz zm!TK`JT1pxIM?rg!aFnMiQYPYl+Yjl$^M54ZJCP0MrN)7E_`%&OOT|F6$TjXomj;7 z>FFg*b!%C3H*P&O-?{VP{KSi58kR};bYozcc!RU!xe$XbV~)FWfZj1C%P8T+1%z1| zHcXcpM#|RJP43z?yc!>m_d@Y*!@ei6t5%Oym>YgoPh6-}FHbPcoOZtwYh84qMsvY7 zMsLXqF04(N*Rrr$^p#if56vG;aZEU^pyYG@j*0xJZX~ls_*xEZS2d~E4@irOiAg+1 zcl9SooZL_cf+TUrJ^thWOR@i1<(I|O8|WHXbljY6YC9tSsGx4XVl=6zc>uEvK7ViM zKM12UF4Ifjc2bwft)(Rn$`4BQ78*O5v!-s#H^ifY>1IlBcSIhi{ zVy~z!6H0HYwnt|M5cK<_n6A3Ri)M-LuJhCy#p2H*4F5VtT*0VM;~UXjZZjUQvA`w$ zp|d~gmFumu#FeLZI8KIm8|l6XO(_YHW{6-xg~PaVDdC%-k2C;v*uzKp;yQDSFK@`B z0+yrp!6!GgW!}u8vQhp+cv*7$s64!`gRbEA3;CZ*(s}j3GaE?B#Qg@niGiV&2ce~sb&1GqqSyU zRp{rET_&^;ExL-iG|3A6fOVe{@(Q?(#;DxAdvWqhe>0Nfq{6UzPKqhuDA$B#0YlDL zMr$uDcQAnj4RFO^tO=C?nUNT&s-V_dj?kLx+sQvtB;&th6{uZ*xQj7oyUf+Qq*;aQknd6s zqQW^XZ)7gd9q zsZNSHym;;lW4sD_wR2et&3|8BSD|6Ia7kM&79ezgtQF0IyX(r3p8oBkpJEezQJd6t z;nVEcryuMWp5!W*f{m6KJ}fK(tFL^bvVU0M=4bbek+-J_e>3bEckK%1kt7)}dmUF| zziCTH2X3|kTwmh;cK)2%)9N^$vMeqiJni^$S%alj(W<_|$Ng6d92#@G(*0KIUa5)R z=7^}K%F|0ITMW_%xdFRR8_TB~13z6>disjB4Ih{N$oc;k%Rr^;wap(+I~;0xUms#w7vwz)i{NCE>!ZIRWid^L3_Q}N+!HG|iBr{rWYzxF= zd>}iz2<7R4?p0V+r0_vaKnlI%QyQZwyRqK>mzA|uTfgTg!?nz=_gAqD^r6iW19ngE zJ^QQY>(G*}Zwc?Qr5X3TCM>%nmM-9gNVM-9C)^y>w3C)ut|kF>7B$Asa;^UFKL$4( zVhs19cT|f#2Vk_3TmfYq>)@9xH-Wt`|8rkrpr zXzut#()&--;YBm@kEDXwPAA{=y)B&kPws+Gr+c)kP&Vmkk>HLM&S0K!0~cTJYd!qM zB5l?A&%pWCtCsMajf`Y?%76?P-VB{Smu-&7X7z&9kjFy+#qNA#-xVd#Rl!o?LKDUh zyF?SYGE<(y(||ia8Eylxl=9b7T7q0M0g7-pILqPUl_8v&j_b?Wu5jc2&3U+hZGgp( z=sU=hq{gGb!C3~YYNPKa6yD`k-|?K2ZD!`uqVD}?9$ulVY;p$#Hd)fkPV9ALMcpHo zZksiwbz~anU(%GQTnuqVvk5#BAh+p|mgkF@SXmS~JVEcse+>gf_DtagZpjXgrX!1! ze-(}W4E5zdSH?bO^Fh5I9&32UWevE>V%rsUc*h^0ZSCy1lH(_TD`RDd>d)4f4>@dz zfmCv;I++Xj62Y%dH-n>WznD}9wG@i)ArKvvob{kQ$m%e=Xw^WjM$;1~5)mI$@?E|` zY-QG(>g0y(a)NS3kF%q{ShW4g_=PvBy@txhxJlrj< zPNR*zH#z4^X^$OsU{OIkYub%?VTgduQROa^{-~aX_(sv=EjQ8H_6}R_-7hQ^c+d3; zv|aNZqha}`yUK@%B{z9noo*B?dDK%X$p29Uxs_?E4LvlBQW*H!8@>K_%ed6am#z8nSC>dIU92{G5*8ZbA`(~hZu|dmW zI;v8fCUHZSa;LSq+BG5oHV#zJ%X#U%m(r=p`s|+p< zJMNe*)yaQ`3XrMh(n2(QDNz@2)7P%NECjz z;o(%1?}AK`P@>Wv$*;9{?} zq-UlS!R3BJ0!K2U&o&(QY)ZxQZP6I%OJdwBVUNtt&(ppCY@Z7qmb16FH^DyUJYvZ` zN>?>ts`4a^L8fYxd+bYSumWlMu`QjjqXhw#)Cjo_jZmV8VQ^&R>8>WWG@+xT<5N(l zNqA{Wr%&V>YNK^F1EWc6eccsKF=ok50?-zH1gfs^KgY&u0&8^4i5`o`9F#*-`5Zp+q#5C6(rv31Hcf7rdrs(IP2=2{yV2c-&-jLd7 zN0prW7ewqY`=DLsSyE*Ln;lGG*8%`2%>~u4x_hL-IR7)+*l=Cu_%-2mazQ01q9b}w z`ec@%4Wd1G0;z*Yq3hFx5nqd+599ssq0?=Q;?N$lWs@SknW~(*V~}RWJ3sgR@@JjR zNr1Crt-4_6wMW&j>41Cm%cU^O60Td{J4cPlJDTO6o!Tiis1e9We zPF9ri=iFLX$;-r$9xp`Hiof2wFLi1@7G^`crMrxzjSa(5uPowWY<`}z z9j`PlIR!us&(6}2%5q}*;v3c__dGUNsaMV$#{lI`A(z&11u?BUslkV2 zM`<1AG+`e_x6c0La$@9SjS1Mp17hgk?0r&6>)YfO#*GVY=3ZFm(1Q@w*7j^l2KgV} zffU0o3G<%#k`&ZLVYQllNv;J~otzY$uKvz|7L`Es=DWKG2wF5d1{Ja|m=rBbao|d< z!wl)l4lsV^?WT?zQcerDqi|5xLWlCc%hmXwa~C7`8F=1)Hx>JI5>&vG@yNTeRhthw zJZ5SOmM*Oqc?=7_*y6TEleAzTx@dp?qf8D7Ak6T_SL!@MCMnv7NXiBN+aOK5bw5c{ z3|EdDkj-6i%~&wqyw0oszK3~Fb=hc1wPN5Hx9tXQT4Upk4@Q&FJ*uDtJ_lX@w&343 zs>%mWgx-y5Y=5D-CZ4VP%e4IZsS%_d4}`b1;K&vn$zfZJ-0*|p)qq&gK39FN%7z`HE9r1EPU(9NNQKW>tXdUyfL z4%~eFgl$1#A;Z4Z{ElX)(M^V%5<3k*yiJ_`F0#e{j)^2&5f;3^%wNTFnP08BAP+sF z{ah?UcT;7-L?RnitHZwCo*(0X*iPC|z(WSjEn8Udc&vart!WKj}%?xS4U0}!jS@n%1Cc(1cBx=ac*XC*exoKMkHwQ#BoPecn8K=g$P~IMm4$U9) zHpY_5*3aAmhZqNr1}c^e6;ZW?ib?HfWu_=!O1C>&KH9OM>^qiF^&sE9novhIIBo*s!E5a{aNNdqUHDy zO~vS%DCgKFqu)OO;YdHxQ*-=oY(;4W98w&(;^*R0D^KzJr!EDXm?xh=o%`#5CpMsN z`uwdDH-@wwo%HQU?{NB){+;qM$SwVmZJ4E(8yYh+&+eF?YW(tWm*I7?+^SI5K>ebqEk~Axj$gAeY0qaJv14Fwy zy#xVr|Grgd{`82lSG1IY=5oCM$L{VqMa{8W=Lfm%tNvaD?n)aiU;gi)7fFllV!L5v zl8BHSv*U?00WM>eUsL8H{xQZ7P3M+=FdZ(pMipeROncDWXIN4d>AWcoi9qjA1a-~i zOg;DxOjNs#fxg-4Ka3p|S5}<8Tjxsw4m2#{oCjer6Z6sgK44senz)eXwoQM*0~7zh z_%*wyT;45f>R;6BuqMyN{0IBznnNa6Xp0#DBAv$ScX!X@&riNJs}mSPZ~J)gH;vP< zhY;wD(yzz9L+{y+oPi-X%L#tlt@aNX9?tC^Mv5yb=-^8QN{^}1#42|@FUn?Yq-ZzK z+i8RgXdNa{qZ!!20By%$ZFwvOyX1*MHq(b*;YrpWV*iKinIN+FYSM^Hb?&XWEytZ) z-BvfcZN4ICgM&9L4+bmlC1Hnn$7%R}WS05J5ZPz3Xy1;mb;v9kGrv(oJ&x-v3 zs<4r#NTm=lW(YPlNEW)Pzc*KQn|@tB_F?6W+WBGp-sB!PJkA%{sT+A26w24Un~8Q$ zaj5~OOxuig5|F#ZSG%sOu%#g-g6Q9f|JglOcoKZQPWjfkMOoi7i}Q%NE_mqS13Pgn zXoxlUaEb?tx;W`KYcb)59dpwJZI2Ryx#z)yEzJLYC3(aRJT3o3c!__Rm(Q`0DdNVA zWsU +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200917082653_AddFileReferenceToProjectTable")] + partial class AddFileReferenceToProjectTable + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("File"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectIconFileIdId") + .HasColumnType("int"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectIconFileIdId"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.File", "ProjectIconFileId") + .WithMany() + .HasForeignKey("ProjectIconFileIdId"); + + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs b/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs new file mode 100644 index 00000000..f48b25ca --- /dev/null +++ b/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs @@ -0,0 +1,43 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class AddFileReferenceToProjectTable : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectIconFileIdId", + table: "Project", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Project_ProjectIconFileIdId", + table: "Project", + column: "ProjectIconFileIdId"); + + migrationBuilder.AddForeignKey( + name: "FK_Project_File_ProjectIconFileIdId", + table: "Project", + column: "ProjectIconFileIdId", + principalTable: "File", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Project_File_ProjectIconFileIdId", + table: "Project"); + + migrationBuilder.DropIndex( + name: "IX_Project_ProjectIconFileIdId", + table: "Project"); + + migrationBuilder.DropColumn( + name: "ProjectIconFileIdId", + table: "Project"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 853d906e..20d9efe6 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -136,6 +136,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("ProjectIconFileIdId") + .HasColumnType("int"); + b.Property("ShortDescription") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -152,6 +155,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); + b.HasIndex("ProjectIconFileIdId"); + b.HasIndex("UserId"); b.ToTable("Project"); @@ -262,6 +267,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Models.Project", b => { + b.HasOne("Models.File", "ProjectIconFileId") + .WithMany() + .HasForeignKey("ProjectIconFileIdId"); + b.HasOne("Models.User", "User") .WithMany("Projects") .HasForeignKey("UserId") diff --git a/Models/File.cs b/Models/File.cs index 20ffd2dc..16cb4b7c 100644 --- a/Models/File.cs +++ b/Models/File.cs @@ -25,10 +25,9 @@ namespace Models public class File { - public File(string path, DateTime uploadDateTime, string name, int uploaderId) + public File(string path, string name, int uploaderId) { Path = path; - UploadDateTime = uploadDateTime; Name = name; UploaderId = uploaderId; } diff --git a/Models/Project.cs b/Models/Project.cs index c22868e3..af8714ef 100644 --- a/Models/Project.cs +++ b/Models/Project.cs @@ -56,6 +56,8 @@ public Project() [Required] public DateTime Updated { get; set; } + public File ProjectIconFileId { get; set; } + } } diff --git a/Services/Services/FileService.cs b/Services/Services/FileService.cs index e742dcbb..d8c43403 100644 --- a/Services/Services/FileService.cs +++ b/Services/Services/FileService.cs @@ -63,6 +63,7 @@ public override void Update(File entity) public void UploadSingleFile(File entity) { + entity.UploadDateTime = DateTime.Now; Repository.Add(entity); Repository.Save(); } From 27e78e6026119f9dd8920d929309de3df5b7fe7a Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Fri, 18 Sep 2020 13:12:49 +0200 Subject: [PATCH 005/157] CreateProject now also accepts reference to File(project icon) --- API/Controllers/FileController.cs | 46 ++- API/Controllers/ProjectController.cs | 59 ++-- API/Resources/FileResource.cs | 2 +- API/Resources/FileResourceResult.cs | 2 +- API/Resources/ProjectResource.cs | 5 + ...0918105547_ChangedProjectModel.Designer.cs | 310 ++++++++++++++++++ .../20200918105547_ChangedProjectModel.cs | 110 +++++++ .../ApplicationDbContextModelSnapshot.cs | 19 +- Models/File.cs | 12 +- Models/Project.cs | 2 +- 10 files changed, 523 insertions(+), 44 deletions(-) create mode 100644 Data/Migrations/20200918105547_ChangedProjectModel.Designer.cs create mode 100644 Data/Migrations/20200918105547_ChangedProjectModel.cs diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 91f3ce8a..0c109993 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -18,6 +18,7 @@ using API.Extensions; using API.Resources; using AutoMapper; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; @@ -80,10 +81,10 @@ public async Task GetFilesAsync() if(!files.Any()) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting files.", - Detail = "The database does not contain any files.", - Instance = "47525791-57C4-4DE2-91B1-90086D893112" + { + Title = "Failed getting files.", + Detail = "The database does not contain any files.", + Instance = "47525791-57C4-4DE2-91B1-90086D893112" }; return NotFound(problem); } @@ -96,6 +97,7 @@ public async Task GetFilesAsync() /// /// HTTP Response [HttpPost] + [Authorize] public async Task UploadSingleFile() { IFormFile fileItem = HttpContext.Request.Form.Files["File"]; @@ -103,22 +105,46 @@ public async Task UploadSingleFile() if(fileItem == null) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed posting file.", - Detail = "File is null.", - Instance = "ACD46F17-A239-4353-92A5-0B81AA0A96E9" - }; + { + Title = "Failed posting file.", + Detail = "File is null.", + Instance = "ACD46F17-A239-4353-92A5-0B81AA0A96E9" + }; return NotFound(problem); } string path = await fileUploader.UploadSingleFile(fileItem); User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - File file = new File(path, fileItem.Name, user.Id); + File file = new File(path, fileItem.Name, user); fileService.UploadSingleFile(file); return Ok(file); } + /// + /// Find file by id + /// + /// + /// File + [HttpGet("{fileId}")] + public async Task GetSingleFile(int fileId) + { + File file = await fileService.FindAsync(fileId); + + if(file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File could not be found.", + Detail = "File could not be found.", + Instance = "875B6402-D771-45EC-AB56-3DE0CDD446D6" + }; + return NotFound(problem); + } + + return Ok(file); + } + } } diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 56afde63..af623228 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -43,7 +43,7 @@ public class ProjectController : ControllerBase private readonly IProjectService projectService; private readonly IUserService userService; private readonly IFileService fileService; - private IFileUploader fileUploader; + private readonly IFileUploader fileUploader; /// /// Initializes a new instance of the class. @@ -71,9 +71,9 @@ public ProjectController(IProjectService projectService, IUserService userServic public async Task GetAllProjects([FromQuery] ProjectFilterParamsResource projectFilterParamsResource) { ProblemDetails problem = new ProblemDetails - { - Title = "Invalid search request." - }; + { + Title = "Invalid search request." + }; if(projectFilterParamsResource.Page != null && projectFilterParamsResource.Page < 1) { @@ -105,14 +105,14 @@ public async Task GetAllProjects([FromQuery] ProjectFilterParamsR mapper.Map, IEnumerable>(projects); ProjectResultsResource resultsResource = new ProjectResultsResource() - { - Results = results.ToArray(), - Count = results.Count(), - TotalCount = await projectService.ProjectsCount(projectFilterParams), - Page = projectFilterParams.Page, - TotalPages = + { + Results = results.ToArray(), + Count = results.Count(), + TotalCount = await projectService.ProjectsCount(projectFilterParams), + Page = projectFilterParams.Page, + TotalPages = await projectService.GetProjectsTotalPages(projectFilterParams) - }; + }; return Ok(resultsResource); } @@ -169,7 +169,22 @@ public async Task CreateProjectAsync([FromBody] ProjectResource p return BadRequest(problem); } Project project = mapper.Map(projectResource); + File file = await fileService.FindAsync(projectResource.FileId); + + if(projectResource.FileId != 0 && file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File was not found.", + Detail = "The specified file was not found while creating project.", + Instance = "8CABE64D-6B73-4C88-BBD8-B32FA9FE6EC7" + }; + return BadRequest(problem); + } + + project.ProjectIcon = file; project.User = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + try { projectService.Add(project); @@ -286,10 +301,10 @@ public async Task UploadProjectImage() if(fileItem == null) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed posting file.", - Detail = "File is null.", - Instance = "2F309E3F-EF49-42C2-8A45-7155A1F2B907" + { + Title = "Failed posting file.", + Detail = "File is null.", + Instance = "2F309E3F-EF49-42C2-8A45-7155A1F2B907" }; return NotFound(problem); } @@ -299,26 +314,26 @@ public async Task UploadProjectImage() try { string path = await fileUploader.UploadSingleFile(fileItem); - File file = new File(path, fileItem.Name, user.Id); + File file = new File(path, fileItem.Name, user); fileService.UploadSingleFile(file); Project project = await projectService.FindWithUserAndCollaboratorsAsync(projectId) .ConfigureAwait(false); - project.ProjectIconFileId = file; + project.ProjectIcon = file; projectService.Update(project); return Ok(project); } catch { ProblemDetails problem = new ProblemDetails - { - Title = "Failed posting file or updating project", - Detail = "Failed posting file or updating project.", - Instance = "AD9E0FF5-BF36-4285-9AD1-18CFF3293F7E" + { + Title = "Failed posting file or updating project", + Detail = "Failed posting file or updating project.", + Instance = "AD9E0FF5-BF36-4285-9AD1-18CFF3293F7E" }; return NotFound(problem); } - + } } } diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs index 77f7e43a..14211e0b 100644 --- a/API/Resources/FileResource.cs +++ b/API/Resources/FileResource.cs @@ -47,7 +47,7 @@ public class FileResource /// /// UploaderId of file /// - public int UploaderId { get; set; } + public User Uploader { get; set; } } } diff --git a/API/Resources/FileResourceResult.cs b/API/Resources/FileResourceResult.cs index 1b9b96c9..80c705f9 100644 --- a/API/Resources/FileResourceResult.cs +++ b/API/Resources/FileResourceResult.cs @@ -47,6 +47,6 @@ public class FileResourceResult /// /// Id of uploader /// - public int UploaderId { get; set; } + public UserResourceResult Uploader { get; set; } } } diff --git a/API/Resources/ProjectResource.cs b/API/Resources/ProjectResource.cs index 44d85802..ee82d815 100644 --- a/API/Resources/ProjectResource.cs +++ b/API/Resources/ProjectResource.cs @@ -49,5 +49,10 @@ public class ProjectResource /// This gets or sets the collaborators /// public ICollection Collaborators { get; set; } + + /// + /// This gets or sets the file id + /// + public int FileId { get; set; } } } diff --git a/Data/Migrations/20200918105547_ChangedProjectModel.Designer.cs b/Data/Migrations/20200918105547_ChangedProjectModel.Designer.cs new file mode 100644 index 00000000..15e6a5e6 --- /dev/null +++ b/Data/Migrations/20200918105547_ChangedProjectModel.Designer.cs @@ -0,0 +1,310 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200918105547_ChangedProjectModel")] + partial class ChangedProjectModel + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UploaderId"); + + b.ToTable("File"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectIconId") + .HasColumnType("int"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectIconId"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.File", b => + { + b.HasOne("Models.User", "Uploader") + .WithMany() + .HasForeignKey("UploaderId"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.File", "ProjectIcon") + .WithMany() + .HasForeignKey("ProjectIconId"); + + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200918105547_ChangedProjectModel.cs b/Data/Migrations/20200918105547_ChangedProjectModel.cs new file mode 100644 index 00000000..a801b43c --- /dev/null +++ b/Data/Migrations/20200918105547_ChangedProjectModel.cs @@ -0,0 +1,110 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class ChangedProjectModel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Project_File_ProjectIconFileIdId", + table: "Project"); + + migrationBuilder.DropIndex( + name: "IX_Project_ProjectIconFileIdId", + table: "Project"); + + migrationBuilder.DropColumn( + name: "ProjectIconFileIdId", + table: "Project"); + + migrationBuilder.AddColumn( + name: "ProjectIconId", + table: "Project", + nullable: true); + + migrationBuilder.AlterColumn( + name: "UploaderId", + table: "File", + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.CreateIndex( + name: "IX_Project_ProjectIconId", + table: "Project", + column: "ProjectIconId"); + + migrationBuilder.CreateIndex( + name: "IX_File_UploaderId", + table: "File", + column: "UploaderId"); + + migrationBuilder.AddForeignKey( + name: "FK_File_User_UploaderId", + table: "File", + column: "UploaderId", + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Project_File_ProjectIconId", + table: "Project", + column: "ProjectIconId", + principalTable: "File", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_File_User_UploaderId", + table: "File"); + + migrationBuilder.DropForeignKey( + name: "FK_Project_File_ProjectIconId", + table: "Project"); + + migrationBuilder.DropIndex( + name: "IX_Project_ProjectIconId", + table: "Project"); + + migrationBuilder.DropIndex( + name: "IX_File_UploaderId", + table: "File"); + + migrationBuilder.DropColumn( + name: "ProjectIconId", + table: "Project"); + + migrationBuilder.AddColumn( + name: "ProjectIconFileIdId", + table: "Project", + type: "int", + nullable: true); + + migrationBuilder.AlterColumn( + name: "UploaderId", + table: "File", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldNullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Project_ProjectIconFileIdId", + table: "Project", + column: "ProjectIconFileIdId"); + + migrationBuilder.AddForeignKey( + name: "FK_Project_File_ProjectIconFileIdId", + table: "Project", + column: "ProjectIconFileIdId", + principalTable: "File", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 20d9efe6..fe3ab4fa 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -84,11 +84,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("UploadDateTime") .HasColumnType("datetime2"); - b.Property("UploaderId") + b.Property("UploaderId") .HasColumnType("int"); b.HasKey("Id"); + b.HasIndex("UploaderId"); + b.ToTable("File"); }); @@ -136,7 +138,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("ProjectIconFileIdId") + b.Property("ProjectIconId") .HasColumnType("int"); b.Property("ShortDescription") @@ -155,7 +157,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.HasIndex("ProjectIconFileIdId"); + b.HasIndex("ProjectIconId"); b.HasIndex("UserId"); @@ -256,6 +258,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Models.File", b => + { + b.HasOne("Models.User", "Uploader") + .WithMany() + .HasForeignKey("UploaderId"); + }); + modelBuilder.Entity("Models.Highlight", b => { b.HasOne("Models.Project", "Project") @@ -267,9 +276,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Models.Project", b => { - b.HasOne("Models.File", "ProjectIconFileId") + b.HasOne("Models.File", "ProjectIcon") .WithMany() - .HasForeignKey("ProjectIconFileIdId"); + .HasForeignKey("ProjectIconId"); b.HasOne("Models.User", "User") .WithMany("Projects") diff --git a/Models/File.cs b/Models/File.cs index 16cb4b7c..09565629 100644 --- a/Models/File.cs +++ b/Models/File.cs @@ -25,11 +25,15 @@ namespace Models public class File { - public File(string path, string name, int uploaderId) + public File() + { + } + + public File(string path, string name, User uploader) { Path = path; Name = name; - UploaderId = uploaderId; + Uploader = uploader; } public int Id { get; set; } @@ -37,7 +41,7 @@ public File(string path, string name, int uploaderId) public string Path { get; set; } public DateTime UploadDateTime { get; set; } public string Name { get; set; } - public int UploaderId { get; set; } - + public User Uploader { get; set; } + } } diff --git a/Models/Project.cs b/Models/Project.cs index af8714ef..92f60576 100644 --- a/Models/Project.cs +++ b/Models/Project.cs @@ -56,7 +56,7 @@ public Project() [Required] public DateTime Updated { get; set; } - public File ProjectIconFileId { get; set; } + public File ProjectIcon { get; set; } } From c405ff09ae457516b722c48645045d4990a917d1 Mon Sep 17 00:00:00 2001 From: Mees van Straten <41986758+MeesvanStraten@users.noreply.github.com> Date: Fri, 18 Sep 2020 14:25:15 +0200 Subject: [PATCH 006/157] Created linking UserProject table changed user model tho have UserProject object. --- Models/User.cs | 21 ++++++++++++--------- Models/UserProject.cs | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 Models/UserProject.cs diff --git a/Models/User.cs b/Models/User.cs index b1e9e345..6200d7ac 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -28,6 +28,7 @@ public User() { Projects = new List(); Services = new List(); + FollowedProject = new List(); } public int Id { get; set; } @@ -49,6 +50,8 @@ public User() public string ProfileUrl { get; set; } + public ICollection FollowedProject { get; set; } + /// /// Gets or sets a value indicating whether the user profile is public. /// diff --git a/Models/UserProject.cs b/Models/UserProject.cs new file mode 100644 index 00000000..e06ccea1 --- /dev/null +++ b/Models/UserProject.cs @@ -0,0 +1,14 @@ +namespace Models +{ + + public class UserProject + { + + public int IdentityId { get; set; } + public User User { get; set; } + public int Id { get; set; } + public Project Project { get; set; } + + } + +} From c06d9c241c451f4e6224a11ac186855ebeee2293 Mon Sep 17 00:00:00 2001 From: "Bouman,Dave D.H.M" Date: Fri, 18 Sep 2020 14:52:11 +0200 Subject: [PATCH 007/157] Added an userproject migration Changed previous commit because there was an error with duplicate ids --- ...200918123151_AddedUserProjects.Designer.cs | 299 ++++++++++++++++++ .../20200918123151_AddedUserProjects.cs | 92 ++++++ ...0918124148_UpdatedUserProjects.Designer.cs | 296 +++++++++++++++++ .../20200918124148_UpdatedUserProjects.cs | 24 ++ .../ApplicationDbContextModelSnapshot.cs | 39 ++- Models/UserProject.cs | 3 +- 6 files changed, 749 insertions(+), 4 deletions(-) create mode 100644 Data/Migrations/20200918123151_AddedUserProjects.Designer.cs create mode 100644 Data/Migrations/20200918123151_AddedUserProjects.cs create mode 100644 Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs create mode 100644 Data/Migrations/20200918124148_UpdatedUserProjects.cs diff --git a/Data/Migrations/20200918123151_AddedUserProjects.Designer.cs b/Data/Migrations/20200918123151_AddedUserProjects.Designer.cs new file mode 100644 index 00000000..c21905b5 --- /dev/null +++ b/Data/Migrations/20200918123151_AddedUserProjects.Designer.cs @@ -0,0 +1,299 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200918123151_AddedUserProjects")] + partial class AddedUserProjects + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("IdentityId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("FollowedProject") + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200918123151_AddedUserProjects.cs b/Data/Migrations/20200918123151_AddedUserProjects.cs new file mode 100644 index 00000000..98dfe900 --- /dev/null +++ b/Data/Migrations/20200918123151_AddedUserProjects.cs @@ -0,0 +1,92 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class AddedUserProjects : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_RoleScope_Role_RoleId", + table: "RoleScope"); + + migrationBuilder.AlterColumn( + name: "RoleId", + table: "RoleScope", + nullable: false, + oldClrType: typeof(int), + oldType: "int", + oldNullable: true); + + migrationBuilder.CreateTable( + name: "UserProject", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IdentityId = table.Column(nullable: false), + UserId = table.Column(nullable: true), + ProjectId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_UserProject", x => x.Id); + table.ForeignKey( + name: "FK_UserProject_Project_ProjectId", + column: x => x.ProjectId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_UserProject_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_UserProject_ProjectId", + table: "UserProject", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_UserProject_UserId", + table: "UserProject", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_RoleScope_Role_RoleId", + table: "RoleScope", + column: "RoleId", + principalTable: "Role", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_RoleScope_Role_RoleId", + table: "RoleScope"); + + migrationBuilder.DropTable( + name: "UserProject"); + + migrationBuilder.AlterColumn( + name: "RoleId", + table: "RoleScope", + type: "int", + nullable: true, + oldClrType: typeof(int)); + + migrationBuilder.AddForeignKey( + name: "FK_RoleScope_Role_RoleId", + table: "RoleScope", + column: "RoleId", + principalTable: "Role", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs b/Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs new file mode 100644 index 00000000..040dd275 --- /dev/null +++ b/Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs @@ -0,0 +1,296 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200918124148_UpdatedUserProjects")] + partial class UpdatedUserProjects + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("FollowedProject") + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200918124148_UpdatedUserProjects.cs b/Data/Migrations/20200918124148_UpdatedUserProjects.cs new file mode 100644 index 00000000..58567cb3 --- /dev/null +++ b/Data/Migrations/20200918124148_UpdatedUserProjects.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class UpdatedUserProjects : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IdentityId", + table: "UserProject"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IdentityId", + table: "UserProject", + type: "int", + nullable: false, + defaultValue: 0); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 58a8ca6f..60010ecf 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -150,7 +150,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("RoleId") + b.Property("RoleId") .HasColumnType("int"); b.Property("Scope") @@ -198,6 +198,28 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("User"); }); + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + modelBuilder.Entity("Models.Collaborator", b => { b.HasOne("Models.Project", null) @@ -244,7 +266,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasOne("Models.Role", null) .WithMany("Scopes") - .HasForeignKey("RoleId"); + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Models.User", b => @@ -253,6 +277,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) .WithMany() .HasForeignKey("RoleId"); }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("FollowedProject") + .HasForeignKey("UserId"); + }); #pragma warning restore 612, 618 } } diff --git a/Models/UserProject.cs b/Models/UserProject.cs index e06ccea1..712856ef 100644 --- a/Models/UserProject.cs +++ b/Models/UserProject.cs @@ -1,10 +1,9 @@ -namespace Models +namespace Models { public class UserProject { - public int IdentityId { get; set; } public User User { get; set; } public int Id { get; set; } public Project Project { get; set; } From f3a8d0291db92fa7aa8bb66a37d8c3757b9c4c09 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Mon, 21 Sep 2020 13:41:31 +0200 Subject: [PATCH 008/157] fixed and issue where fileuploader did not upload file --- .gitignore | 5 ++++- API/1_API.csproj | 10 ++++------ API/Controllers/FileController.cs | 2 +- API/Controllers/ProjectController.cs | 18 +++++++++++++++++ API/Extensions/FileUploader.cs | 27 ++++++++++++++++++++++---- API/Resources/FileResourceResult.cs | 5 +---- API/Resources/ProjectResourceResult.cs | 4 ++++ API/files/.gitkeep | 1 + 8 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 API/files/.gitkeep diff --git a/.gitignore b/.gitignore index 69c5bbff..1d169dd3 100644 --- a/.gitignore +++ b/.gitignore @@ -333,4 +333,7 @@ profile IdentityServer/tempkey.rsa -/API/FileFolder + +/API/files/* +!/API/files/.gitkeep +/API/filesangular-226066.png diff --git a/API/1_API.csproj b/API/1_API.csproj index c35cb26c..edbc2485 100644 --- a/API/1_API.csproj +++ b/API/1_API.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -41,11 +41,9 @@ - + + - - - - \ No newline at end of file + diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 0c109993..fcff3ce1 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -119,7 +119,7 @@ public async Task UploadSingleFile() File file = new File(path, fileItem.Name, user); fileService.UploadSingleFile(file); - return Ok(file); + return Ok(mapper.Map(file)); } /// diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index af623228..16a82355 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -228,6 +228,24 @@ public async Task UpdateProject(int projectId, [FromBody] Project } mapper.Map(projectResource, project); + File file = null; + if(projectResource.FileId != 0) + { + file = await fileService.FindAsync(projectResource.FileId); + project.ProjectIcon = file; + } + + if(projectResource.FileId != 0 && file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File was not found.", + Detail = "The specified file was not found while updating project.", + Instance = "69166D3D-6D34-4050-BD25-71F1BEBE43D3" + }; + return BadRequest(problem); + } + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.ProjectWrite)); diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index dea8033a..3e561376 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using File = Models.File; namespace API.Extensions { @@ -19,6 +20,7 @@ public interface IFileUploader /// /// Task UploadSingleFile(IFormFile file); + bool DeleteFile(File file); } @@ -28,7 +30,7 @@ public interface IFileUploader public class FileUploader : IFileUploader { - private static readonly string UploadPath = Directory.GetCurrentDirectory() + "FileFolder"; + private static readonly string UploadPath = Directory.GetCurrentDirectory() + "\\files\\"; /// /// Uploads single file @@ -39,9 +41,15 @@ public async Task UploadSingleFile(IFormFile file) { try { - await using Stream stream = new FileStream(UploadPath + file.Name, FileMode.Create); - await file.CopyToAsync(stream); - return UploadPath + file.Name; + using(Stream sourceStream = file.OpenReadStream()) + { + using(FileStream destinationStream = System.IO.File.Create(UploadPath + file.FileName)) + { + await sourceStream.CopyToAsync(destinationStream); + } + } + + return UploadPath + file.FileName; } catch(Exception e) { Log.Logger.Error(e, "Unexpected error"); @@ -49,5 +57,16 @@ public async Task UploadSingleFile(IFormFile file) } } + public bool DeleteFile(File file) + { + if(System.IO.File.Exists(Path.Combine(UploadPath, file.Name))) + { + System.IO.File.Delete(Path.Combine(UploadPath, file.Name)); + return true; + } + + return false; + } + } } diff --git a/API/Resources/FileResourceResult.cs b/API/Resources/FileResourceResult.cs index 80c705f9..e16c42c9 100644 --- a/API/Resources/FileResourceResult.cs +++ b/API/Resources/FileResourceResult.cs @@ -44,9 +44,6 @@ public class FileResourceResult /// File name /// public string Name { get; set; } - /// - /// Id of uploader - /// - public UserResourceResult Uploader { get; set; } + } } diff --git a/API/Resources/ProjectResourceResult.cs b/API/Resources/ProjectResourceResult.cs index 328aecc2..08614e47 100644 --- a/API/Resources/ProjectResourceResult.cs +++ b/API/Resources/ProjectResourceResult.cs @@ -74,5 +74,9 @@ public class ProjectResourceResult /// This gets or sets the Updated time of the project /// public DateTime Updated { get; set; } + /// + /// This gets or set the file of the project + /// + public FileResourceResult ProjectIcon { get; set; } } } diff --git a/API/files/.gitkeep b/API/files/.gitkeep new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/API/files/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file From 7d2ca191634416cae4371d0bde202ed2f2768079 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Mon, 21 Sep 2020 15:31:02 +0200 Subject: [PATCH 009/157] added summary to methods in fileuploader --- API/Extensions/FileUploader.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index 3e561376..3e0c6f44 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -15,11 +15,16 @@ namespace API.Extensions public interface IFileUploader { /// - /// Method that uploads the file to the file server + /// Uploads single file /// /// - /// + /// path of file location Task UploadSingleFile(IFormFile file); + /// + /// Method deletes the file from the file server + /// + /// + /// Bool which tells if file is deleted succesfully or not bool DeleteFile(File file); } @@ -57,6 +62,11 @@ public async Task UploadSingleFile(IFormFile file) } } + /// + /// Method deletes the file from the file server + /// + /// + /// Bool which tells if file is deleted succesfully or not public bool DeleteFile(File file) { if(System.IO.File.Exists(Path.Combine(UploadPath, file.Name))) From 55ffef21fcfdfa13a55742c629a192b41b59186a Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Mon, 21 Sep 2020 15:33:34 +0200 Subject: [PATCH 010/157] changed postman environment and added postman tests --- Postman/dex.postman_collection.json | 604 ++++++++++++++++++++++++- Postman/local.postman_environment.json | 57 +-- 2 files changed, 634 insertions(+), 27 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index ef7aa50d..d1ab7ca8 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -740,7 +740,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\",\r\n \"fileId\" : 3\r\n}", "options": { "raw": { "language": "json" @@ -881,6 +881,46 @@ } }, "response": [] + }, + { + "name": "Project-Upload-Image-Administrator", + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "/C:/Users/Niray/Desktop/angular-226066.png" + }, + { + "key": "ProjectId", + "value": "1", + "type": "text" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/Project/UploadImage", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "UploadImage" + ] + } + }, + "response": [] } ], "protocolProfileBehavior": {}, @@ -1186,6 +1226,93 @@ }, "response": [] }, + { + "name": "Highlight-GetHighlight-ByProject-Administrator Copy", + "event": [ + { + "listen": "test", + "script": { + "id": "e2f71037-c9dc-471c-af03-e6a4ed884b74", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var projectId = parseInt(pm.environment.get(\"projectId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findHighlightId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "function findProjectId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].project.id == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project is in list and matching: \" + projectId, function () {", + " foundAt = findProjectId(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Highlight is in list and matching:\" + highlightId, function () {", + " foundAt = findHighlightId(jsonData, highlightId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, { "name": "Highlight-UpdateHighlight-Administrator", "event": [ @@ -2960,6 +3087,122 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-Administrator", + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "/C:/Users/Niray/Desktop/angular-226066.png" + }, + { + "key": "Name", + "value": "AngularIcon", + "type": "text", + "disabled": true + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Adminstrator", + "event": [ + { + "listen": "test", + "script": { + "id": "81c12ccd-bbb8-4812-bd04-0cd536e73163", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "var fileId = pm.environment.get(\"fileId\");\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "var foundAt;\r", + "\r", + "function findItem(jsonData, item) {\r", + " for (var i = 0; i < jsonData.length; i++) {\r", + " if (jsonData[i].id == item) {\r", + " return i;\r", + " }\r", + " }\r", + " return -1;\r", + "}\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "pm.test(\"File is in list and matching: \" + fileId, function () {\r", + " foundAt = findItem(jsonData, fileId);\r", + " pm.expect(foundAt).to.not.eql(-1);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, @@ -4897,6 +5140,135 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Get-Files-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "9d2cbee0-a55f-419b-b83c-7935f57578a4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "var fileId = pm.environment.get(\"fileId\");\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "var foundAt;\r", + "\r", + "function findItem(jsonData, item) {\r", + " for (var i = 0; i < jsonData.length; i++) {\r", + " if (jsonData[i].id == item) {\r", + " return i;\r", + " }\r", + " }\r", + " return -1;\r", + "}\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "pm.test(\"File is in list and matching: \" + fileId, function () {\r", + " foundAt = findItem(jsonData, fileId);\r", + " pm.expect(foundAt).to.not.eql(-1);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Post-File-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "19b3d11e-6e99-409a-8b57-e1ad160ed660", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "/C:/Users/Niray/Desktop/angular-226066.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "event": [ @@ -7448,6 +7820,121 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-Registered", + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "/C:/Users/Niray/Desktop/angular-226066.png" + }, + { + "key": "Name", + "value": "AngularIcon", + "type": "text" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "c610771e-cf59-4510-bedf-b891ce8fa815", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "var fileId = pm.environment.get(\"fileId\");\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "var foundAt;\r", + "\r", + "function findItem(jsonData, item) {\r", + " for (var i = 0; i < jsonData.length; i++) {\r", + " if (jsonData[i].id == item) {\r", + " return i;\r", + " }\r", + " }\r", + " return -1;\r", + "}\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "pm.test(\"File is in list and matching: \" + fileId, function () {\r", + " foundAt = findItem(jsonData, fileId);\r", + " pm.expect(foundAt).to.not.eql(-1);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, @@ -10424,6 +10911,121 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Get-Files-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "cf2fa958-2e43-4e12-bf2e-3b8300dec03a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "var fileId = pm.environment.get(\"fileId\");\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "var foundAt;\r", + "\r", + "function findItem(jsonData, item) {\r", + " for (var i = 0; i < jsonData.length; i++) {\r", + " if (jsonData[i].id == item) {\r", + " return i;\r", + " }\r", + " }\r", + " return -1;\r", + "}\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "pm.test(\"File is in list and matching: \" + fileId, function () {\r", + " foundAt = findItem(jsonData, fileId);\r", + " pm.expect(foundAt).to.not.eql(-1);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Post-File-PR", + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "/C:/Users/Niray/Desktop/angular-226066.png" + }, + { + "key": "Name", + "value": "AngularIcon", + "type": "text" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 1cef8dfa..691eac49 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "b231668b-0723-406d-bba1-f394034ad801", + "id": "3e14f5b7-5105-4893-8e8a-242ee7641e35", "name": "Local", "values": [ { @@ -34,12 +34,12 @@ }, { "key": "projectId", - "value": "24", + "value": 37, "enabled": true }, { "key": "userName", - "value": "Developer", + "value": "postmantest_username_updated", "enabled": true }, { @@ -49,7 +49,7 @@ }, { "key": "projectName", - "value": "postmantest_projectname", + "value": "postmantest_projectname_updated", "enabled": true }, { @@ -59,7 +59,7 @@ }, { "key": "accessToken", - "value": "", + "value": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ik10LXVfZ0VuSUw1TzlxM1lJVU5lemciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MDA2ODgxOTUsImV4cCI6MTYwMDY5MTc5NSwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwNSIsImF1ZCI6ImRleC1hcGkiLCJjbGllbnRfaWQiOiJkZXgtYXBpLWNsaWVudCIsImNsaWVudF9yb2xlIjoiQmFja2VuZEFwcGxpY2F0aW9uIiwic2NvcGUiOlsiRW1iZWRSZWFkIiwiRW1iZWRXcml0ZSIsIkhpZ2hsaWdodFJlYWQiLCJIaWdobGlnaHRXcml0ZSIsIlByb2plY3RSZWFkIiwiUHJvamVjdFdyaXRlIiwiVXNlclJlYWQiLCJVc2VyV3JpdGUiXX0.TwqMmQXNMShypaoqwX6yXnazHkoPr1zFXejJWWjqjZhZahym8yZPekLCLABfUCECpuxDTfsGy0dy9SLhDIunplJUDbfFexG9VHu4LR8iMlDvWmoPlbzl6LhYSPZbSaxcjJkWz0CzTWYI7xddvZqrGyJdYhpseuYXKkjDx8dh89DmHqeMFpEb3eyy4WnD1Ie22NDjEt1Ou5u4AtbWqIL-ZOPzKRpnIaWdUoAJR3xNEYaRVYRRfSQyV1S1xvNizbV6y4Map4YPQB_PqxG4khi0VGSEgDQ9OmxyvuA_oSPorLmFgRHR1fmYGieVaMQG9HJHxXqv_o4MUnl-MG0Y1Jkvpg", "enabled": true }, { @@ -79,32 +79,32 @@ }, { "key": "roleId", - "value": "1", + "value": 34, "enabled": true }, { "key": "highlightId", - "value": "1", + "value": 66, "enabled": true }, { "key": "embedGuid", - "value": "", + "value": "78627411-a7e2-4fe1-84a1-633971ec66c3", "enabled": true }, { "key": "embeddedProjectId", - "value": "", + "value": 92, "enabled": true }, { "key": "highlightStartDate", - "value": "", + "value": "2020-09-18T08:15:16.681", "enabled": true }, { "key": "highlightEndDate", - "value": "", + "value": "2020-09-20T08:15:16.682", "enabled": true }, { @@ -119,7 +119,7 @@ }, { "key": "current_timestamp", - "value": "", + "value": "2020-09-18T08:15:16.890Z", "enabled": true }, { @@ -134,7 +134,7 @@ }, { "key": "future_timestamp", - "value": "", + "value": "2020-09-20T08:15:16.682Z", "enabled": true }, { @@ -149,22 +149,22 @@ }, { "key": "adminProjectId", - "value": "", + "value": 91, "enabled": true }, { "key": "adminEmbedGuid", - "value": "", + "value": "ea7067dc-3f01-43a6-b8f3-311968fc7303", "enabled": true }, { "key": "adminHighlightId", - "value": "", + "value": 67, "enabled": true }, { "key": "PrUserId", - "value": "", + "value": 17, "enabled": true }, { @@ -174,41 +174,46 @@ }, { "key": "otherEmbedGuid", - "value": "", + "value": "7eb1fdea-6dbd-447f-b3c7-6c46f515e6df", "enabled": true }, { "key": "otherEmbeddedProjectId", - "value": "", + "value": 91, "enabled": true }, { "key": "createdUserId", - "value": "", + "value": 84, "enabled": true }, { "key": "administratorUserId", - "value": "", + "value": 1, "enabled": true }, { "key": "registeredUserId", - "value": "", + "value": 33, "enabled": true }, { "key": "createdUserIdentityId", - "value": "", + "value": "999", "enabled": true }, { "key": "identityId", - "value": "", + "value": 84, + "enabled": true + }, + { + "key": "fileId", + "value": "1", "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-06-10T15:45:45.966Z", - "_postman_exported_using": "Postman/7.26.0" + "_postman_exported_at": "2020-09-21T13:32:42.589Z", + "_postman_exported_using": "Postman/7.32.0" } \ No newline at end of file From 5fc22ca70801ebb313ebf6da20e6a93246fd53c4 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Mon, 21 Sep 2020 15:50:30 +0200 Subject: [PATCH 011/157] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eed6d822..789eb9a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added descriptions for Project Highlights - [#219](https://github.com/DigitalExcellence/dex-backend/issues/219) +- Added a fileuploader which gives the opportunity to upload project icons - [#217] (https://github.com/DigitalExcellence/dex-backend/issues/217) ### Changed From be1421fc6d2fb85cf2164a7fa07eebc2dd985aa1 Mon Sep 17 00:00:00 2001 From: I380210 Date: Tue, 22 Sep 2020 15:36:40 +0200 Subject: [PATCH 012/157] Created UserFollowedProjects model & included it in User model en UserResource result UserFollowedProject class is meant for linking tables --- API/Resources/UserResourceResult.cs | 5 + Data/ApplicationDbContext.cs | 2 + ...inkingTableForFollowedProjects.Designer.cs | 300 +++++++++++++++++ ..._CreatedLinkingTableForFollowedProjects.cs | 52 +++ ...edDBSetForUserFollowedProjects.Designer.cs | 300 +++++++++++++++++ ...31414_AddedDBSetForUserFollowedProjects.cs | 107 +++++++ ...0200922131933_UpdatedUserModel.Designer.cs | 302 ++++++++++++++++++ .../20200922131933_UpdatedUserModel.cs | 52 +++ .../ApplicationDbContextModelSnapshot.cs | 35 ++ Models/User.cs | 3 + Models/UserFollowedProject.cs | 17 + Repositories/UserRepository.cs | 3 + 12 files changed, 1178 insertions(+) create mode 100644 Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs create mode 100644 Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs create mode 100644 Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs create mode 100644 Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs create mode 100644 Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs create mode 100644 Data/Migrations/20200922131933_UpdatedUserModel.cs create mode 100644 Models/UserFollowedProject.cs diff --git a/API/Resources/UserResourceResult.cs b/API/Resources/UserResourceResult.cs index 2bd7da37..0bbf5029 100644 --- a/API/Resources/UserResourceResult.cs +++ b/API/Resources/UserResourceResult.cs @@ -16,6 +16,7 @@ */ using Models; +using System.Collections.Generic; namespace API.Resources { @@ -59,6 +60,10 @@ public class UserResourceResult /// public Role Role { get; set; } + /// + /// Gets or sets the followed projects for user + /// + public List UserFollowedProjects { get; set; } } } diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index ad3ac839..29dee25f 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -76,6 +76,8 @@ public ApplicationDbContext(DbContextOptions options) : ba /// public DbSet Role { get; set; } + public DbSet UserFollowedProjects { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); diff --git a/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs b/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs new file mode 100644 index 00000000..a0439de1 --- /dev/null +++ b/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs @@ -0,0 +1,300 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200922130428_CreatedLinkingTableForFollowedProjects")] + partial class CreatedLinkingTableForFollowedProjects + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFollowedProject"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserFollowedProjects") + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs b/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs new file mode 100644 index 00000000..cfb02159 --- /dev/null +++ b/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class CreatedLinkingTableForFollowedProjects : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "UserFollowedProject", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProjectId = table.Column(nullable: true), + UserId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_UserFollowedProject", x => x.Id); + table.ForeignKey( + name: "FK_UserFollowedProject_Project_ProjectId", + column: x => x.ProjectId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_UserFollowedProject_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_UserFollowedProject_ProjectId", + table: "UserFollowedProject", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_UserFollowedProject_UserId", + table: "UserFollowedProject", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "UserFollowedProject"); + } + } +} diff --git a/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs b/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs new file mode 100644 index 00000000..2a4b653b --- /dev/null +++ b/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs @@ -0,0 +1,300 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200922131414_AddedDBSetForUserFollowedProjects")] + partial class AddedDBSetForUserFollowedProjects + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFollowedProjects"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserFollowedProjects") + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs b/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs new file mode 100644 index 00000000..6e95a836 --- /dev/null +++ b/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs @@ -0,0 +1,107 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class AddedDBSetForUserFollowedProjects : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_UserFollowedProject_Project_ProjectId", + table: "UserFollowedProject"); + + migrationBuilder.DropForeignKey( + name: "FK_UserFollowedProject_User_UserId", + table: "UserFollowedProject"); + + migrationBuilder.DropPrimaryKey( + name: "PK_UserFollowedProject", + table: "UserFollowedProject"); + + migrationBuilder.RenameTable( + name: "UserFollowedProject", + newName: "UserFollowedProjects"); + + migrationBuilder.RenameIndex( + name: "IX_UserFollowedProject_UserId", + table: "UserFollowedProjects", + newName: "IX_UserFollowedProjects_UserId"); + + migrationBuilder.RenameIndex( + name: "IX_UserFollowedProject_ProjectId", + table: "UserFollowedProjects", + newName: "IX_UserFollowedProjects_ProjectId"); + + migrationBuilder.AddPrimaryKey( + name: "PK_UserFollowedProjects", + table: "UserFollowedProjects", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_UserFollowedProjects_Project_ProjectId", + table: "UserFollowedProjects", + column: "ProjectId", + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + table: "UserFollowedProjects", + column: "UserId", + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_UserFollowedProjects_Project_ProjectId", + table: "UserFollowedProjects"); + + migrationBuilder.DropForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + table: "UserFollowedProjects"); + + migrationBuilder.DropPrimaryKey( + name: "PK_UserFollowedProjects", + table: "UserFollowedProjects"); + + migrationBuilder.RenameTable( + name: "UserFollowedProjects", + newName: "UserFollowedProject"); + + migrationBuilder.RenameIndex( + name: "IX_UserFollowedProjects_UserId", + table: "UserFollowedProject", + newName: "IX_UserFollowedProject_UserId"); + + migrationBuilder.RenameIndex( + name: "IX_UserFollowedProjects_ProjectId", + table: "UserFollowedProject", + newName: "IX_UserFollowedProject_ProjectId"); + + migrationBuilder.AddPrimaryKey( + name: "PK_UserFollowedProject", + table: "UserFollowedProject", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_UserFollowedProject_Project_ProjectId", + table: "UserFollowedProject", + column: "ProjectId", + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_UserFollowedProject_User_UserId", + table: "UserFollowedProject", + column: "UserId", + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs b/Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs new file mode 100644 index 00000000..1e0f88cd --- /dev/null +++ b/Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs @@ -0,0 +1,302 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200922131933_UpdatedUserModel")] + partial class UpdatedUserModel + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFollowedProjects"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserFollowedProjects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200922131933_UpdatedUserModel.cs b/Data/Migrations/20200922131933_UpdatedUserModel.cs new file mode 100644 index 00000000..e313dc34 --- /dev/null +++ b/Data/Migrations/20200922131933_UpdatedUserModel.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class UpdatedUserModel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + table: "UserFollowedProjects"); + + migrationBuilder.AlterColumn( + name: "UserId", + table: "UserFollowedProjects", + nullable: false, + oldClrType: typeof(int), + oldType: "int", + oldNullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + table: "UserFollowedProjects", + column: "UserId", + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + table: "UserFollowedProjects"); + + migrationBuilder.AlterColumn( + name: "UserId", + table: "UserFollowedProjects", + type: "int", + nullable: true, + oldClrType: typeof(int)); + + migrationBuilder.AddForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + table: "UserFollowedProjects", + column: "UserId", + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index ead5f215..08d73d79 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -202,6 +202,28 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("User"); }); + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFollowedProjects"); + }); + modelBuilder.Entity("Models.Collaborator", b => { b.HasOne("Models.Project", null) @@ -259,6 +281,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) .WithMany() .HasForeignKey("RoleId"); }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserFollowedProjects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); #pragma warning restore 612, 618 } } diff --git a/Models/User.cs b/Models/User.cs index b1e9e345..d3fc8803 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -28,6 +28,7 @@ public User() { Projects = new List(); Services = new List(); + UserFollowedProjects = new List(); } public int Id { get; set; } @@ -47,6 +48,8 @@ public User() public List Services { get; set; } + public List UserFollowedProjects { get; set; } + public string ProfileUrl { get; set; } /// diff --git a/Models/UserFollowedProject.cs b/Models/UserFollowedProject.cs new file mode 100644 index 00000000..f41d6d93 --- /dev/null +++ b/Models/UserFollowedProject.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Models +{ + public class UserFollowedProject + { + public int Id { get; set; } + public Project Project { get; set; } + public User User{ get; set; } + public int UserId { get; set; } + + } + + +} diff --git a/Repositories/UserRepository.cs b/Repositories/UserRepository.cs index ce81bcc6..212f0eb9 100644 --- a/Repositories/UserRepository.cs +++ b/Repositories/UserRepository.cs @@ -88,6 +88,7 @@ public override async Task FindAsync(int userId) .Where(s => s.Id == userId) .Include(s => s.Role) .ThenInclude(s => s.Scopes) + .Include(f => f.UserFollowedProjects) .SingleOrDefaultAsync(); } /// @@ -101,6 +102,7 @@ public async Task GetUserAsync(int userId) .Where(s => s.Id == userId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) + .Include(f => f.UserFollowedProjects) .SingleOrDefaultAsync(); } /// @@ -114,6 +116,7 @@ public async Task GetUserByIdentityIdAsync(string identityId) .Where(s => s.IdentityId == identityId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) + .Include(f => f.UserFollowedProjects) .SingleOrDefaultAsync(); } From 81a1ad0d48ac78d7a0153f84c51bddee9c327add Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Tue, 22 Sep 2020 19:28:11 +0200 Subject: [PATCH 013/157] Added modelbinding, fileuploader checks if file exists already, postman test .bat file added --- API/1_API.csproj | 2 +- API/Controllers/FileController.cs | 74 ++- API/Controllers/ProjectController.cs | 78 +-- API/Extensions/FileUploader.cs | 39 +- API/Resources/FileResource.cs | 5 +- Models/File.cs | 5 +- Postman/dex.postman_collection.json | 706 ++++++++++++++------------- Postman/runtests.bat | 1 + Postman/testimage.png | Bin 0 -> 13976 bytes 9 files changed, 477 insertions(+), 433 deletions(-) create mode 100644 Postman/runtests.bat create mode 100644 Postman/testimage.png diff --git a/API/1_API.csproj b/API/1_API.csproj index edbc2485..e255995d 100644 --- a/API/1_API.csproj +++ b/API/1_API.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index fcff3ce1..38507c3b 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -75,6 +75,7 @@ public FileController(IFileService fileService, IMapper mapper, IProjectService /// /// A response and list of files. [HttpGet] + [Authorize] public async Task GetFilesAsync() { IEnumerable files = await fileService.GetFilesAsync(); @@ -98,11 +99,9 @@ public async Task GetFilesAsync() /// HTTP Response [HttpPost] [Authorize] - public async Task UploadSingleFile() + public async Task UploadSingleFile([FromForm] FileResource fileResource) { - IFormFile fileItem = HttpContext.Request.Form.Files["File"]; - - if(fileItem == null) + if(fileResource.File == null) { ProblemDetails problem = new ProblemDetails { @@ -112,14 +111,25 @@ public async Task UploadSingleFile() }; return NotFound(problem); } + try + { + string path = await fileUploader.UploadSingleFile(fileResource.File); + User user = await HttpContext.GetContextUser(userService) + .ConfigureAwait(false); + File file = new File(path, fileResource.File.FileName, user); + fileService.UploadSingleFile(file); - string path = await fileUploader.UploadSingleFile(fileItem); - - User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - File file = new File(path, fileItem.Name, user); - fileService.UploadSingleFile(file); - - return Ok(mapper.Map(file)); + return Ok(mapper.Map(file)); + } catch(FileExistException fileExistException) + { + ProblemDetails problem = new ProblemDetails + { + Title = fileExistException.Message, + Detail = "Please rename filename.", + Instance = "D902F8C6-23FF-4506-B272-C757BD709464" + }; + return BadRequest(problem); + } } /// @@ -146,5 +156,47 @@ public async Task GetSingleFile(int fileId) return Ok(file); } + /// + /// Deletes single file + /// + /// + /// + [HttpDelete("{fileId}")] + [Authorize] + public async Task DeleteSingleFile(int fileId) + { + File file = await fileService.FindAsync(fileId); + + if(file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File could not be found.", + Detail = "File could not be found.", + Instance = "875B6402-D771-45EC-AB56-3DE0CDD446D6" + }; + return NotFound(problem); + } + try + { + await fileService.RemoveAsync(fileId) + .ConfigureAwait(false); + fileService.Save(); + fileUploader.DeleteFile(file); + return Ok(); + } catch(FileNotFoundException) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File could not be deleted because the path does not exist.", + Detail = "File could not be found.", + Instance = "436349B4-50D9-49FD-8618-82367BEB7941" + }; + + return NotFound(problem); + } + + } + } } diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 16a82355..d4c85530 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -274,84 +274,38 @@ public async Task UpdateProject(int projectId, [FromBody] Project [Authorize] public async Task DeleteProject(int projectId) { - Project project = await projectService.FindAsync(projectId).ConfigureAwait(false); + Project project = await projectService.FindAsync(projectId) + .ConfigureAwait(false); if(project == null) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed to delete the project.", - Detail = "The project could not be found in the database.", - Instance = "AF63CF48-ECAA-4996-BAA0-BF52926D12AC" - }; + { + Title = "Failed to delete the project.", + Detail = "The project could not be found in the database.", + Instance = "AF63CF48-ECAA-4996-BAA0-BF52926D12AC" + }; return NotFound(problem); } - User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + User user = await HttpContext.GetContextUser(userService) + .ConfigureAwait(false); bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.ProjectWrite)); if(!(project.UserId == user.Id || isAllowed)) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed to delete the project.", - Detail = "The user is not allowed to delete the project.", - Instance = "D0363680-5B4F-40A1-B381-0A7544C70164" - }; + { + Title = "Failed to delete the project.", + Detail = "The user is not allowed to delete the project.", + Instance = "D0363680-5B4F-40A1-B381-0A7544C70164" + }; return Unauthorized(problem); } - await projectService.RemoveAsync(projectId).ConfigureAwait(false); + await projectService.RemoveAsync(projectId) + .ConfigureAwait(false); projectService.Save(); return Ok(); } - - /// - /// Upload Image that belongs to a project - /// - /// Status code 200 - [HttpPost] - [Route("UploadImage")] - public async Task UploadProjectImage() - { - IFormFile fileItem = HttpContext.Request.Form.Files["File"]; - int projectId = int.Parse(HttpContext.Request.Form["ProjectId"]); - - if(fileItem == null) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed posting file.", - Detail = "File is null.", - Instance = "2F309E3F-EF49-42C2-8A45-7155A1F2B907" - }; - return NotFound(problem); - } - - User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - - try - { - string path = await fileUploader.UploadSingleFile(fileItem); - File file = new File(path, fileItem.Name, user); - fileService.UploadSingleFile(file); - - Project project = await projectService.FindWithUserAndCollaboratorsAsync(projectId) - .ConfigureAwait(false); - project.ProjectIcon = file; - projectService.Update(project); - return Ok(project); - } catch - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed posting file or updating project", - Detail = "Failed posting file or updating project.", - Instance = "AD9E0FF5-BF36-4285-9AD1-18CFF3293F7E" - }; - return NotFound(problem); - } - - - } } } diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index 3e0c6f44..a11f370f 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Http; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Serilog; using System; using System.Collections.Generic; @@ -9,6 +10,21 @@ namespace API.Extensions { + /// + /// File already exists exception + /// + [Serializable] + public class FileExistException : Exception + { + /// + /// File already exist constructor + /// + /// + public FileExistException(string name) + : base(String.Format("File {0} already exists", name)) + { } + } + /// /// Interface for file uploader /// @@ -24,8 +40,7 @@ public interface IFileUploader /// Method deletes the file from the file server /// /// - /// Bool which tells if file is deleted succesfully or not - bool DeleteFile(File file); + void DeleteFile(File file); } @@ -46,15 +61,20 @@ public async Task UploadSingleFile(IFormFile file) { try { - using(Stream sourceStream = file.OpenReadStream()) + if(!System.IO.File.Exists(UploadPath + file.FileName)) { - using(FileStream destinationStream = System.IO.File.Create(UploadPath + file.FileName)) + await using(Stream sourceStream = file.OpenReadStream()) { - await sourceStream.CopyToAsync(destinationStream); + await using(FileStream destinationStream = System.IO.File.Create(UploadPath + file.FileName)) + { + await sourceStream.CopyToAsync(destinationStream); + } } + + return UploadPath + file.FileName; } - return UploadPath + file.FileName; + throw new FileExistException(file.FileName); } catch(Exception e) { Log.Logger.Error(e, "Unexpected error"); @@ -67,15 +87,14 @@ public async Task UploadSingleFile(IFormFile file) /// /// /// Bool which tells if file is deleted succesfully or not - public bool DeleteFile(File file) + public void DeleteFile(File file) { if(System.IO.File.Exists(Path.Combine(UploadPath, file.Name))) { System.IO.File.Delete(Path.Combine(UploadPath, file.Name)); - return true; + return; } - - return false; + throw new FileNotFoundException(file.Name); } } diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs index 14211e0b..b899038c 100644 --- a/API/Resources/FileResource.cs +++ b/API/Resources/FileResource.cs @@ -48,6 +48,9 @@ public class FileResource /// UploaderId of file /// public User Uploader { get; set; } - + /// + /// Id of project + /// + public int ProjectId { get; set; } } } diff --git a/Models/File.cs b/Models/File.cs index 09565629..63fb1a09 100644 --- a/Models/File.cs +++ b/Models/File.cs @@ -24,10 +24,7 @@ namespace Models { public class File { - - public File() - { - } + public File() { } public File(string path, string name, User uploader) { diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index d1ab7ca8..7c6a3821 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "87bcd92b-930f-4092-aee5-59f6a37737c1", + "_postman_id": "1e04c4b6-4c13-4ed4-9994-eb1bb0986e69", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "3415efeb-08b1-44a9-8340-238db3c6120e", + "id": "c0c73e6c-7f31-4323-88e3-5e6fb469d111", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "529a2b71-6558-4305-b9cf-047fc3ac6dbd", + "id": "f8141afb-6e74-4260-91d2-11ddd20fef50", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -134,7 +134,7 @@ { "listen": "test", "script": { - "id": "9ae54e26-f32f-4e93-9ca2-f0046952b3ab", + "id": "96000457-5985-4446-9302-8a0d9134a775", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -203,7 +203,7 @@ { "listen": "test", "script": { - "id": "7ab5f5ae-8d87-4092-8e14-ef664094da3e", + "id": "7d7c1369-8db1-47df-8077-fcbcdf45142e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -271,7 +271,7 @@ { "listen": "test", "script": { - "id": "7ee1bd20-dd09-4f12-a414-df18d91967dc", + "id": "792e64aa-bf7e-46c9-a559-e0da6f287624", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -339,7 +339,7 @@ { "listen": "test", "script": { - "id": "0ae34c24-10b2-4c98-8521-2531967cdde1", + "id": "5e1d79c0-73ed-49ab-bfa8-2d1c1c424c96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -414,7 +414,7 @@ { "listen": "test", "script": { - "id": "dc34176a-f766-4622-b7fb-489d9257ab3a", + "id": "3f1bfe53-3e90-4e14-8601-10d74144028a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -479,7 +479,7 @@ { "listen": "test", "script": { - "id": "6f6ffe45-f584-48d2-b36b-63bb5d22dc93", + "id": "a2e44142-3b56-4fb4-8670-9a222e64e785", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -557,7 +557,7 @@ { "listen": "test", "script": { - "id": "692a4bef-ba4d-40c4-88db-599b546e614b", + "id": "b5543315-c35d-4571-913d-4dffd4fc8ffc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -630,7 +630,7 @@ { "listen": "test", "script": { - "id": "243b137c-9c9d-4c76-a62f-ff97e45bc4da", + "id": "f1649fb2-4f00-4b7f-bfa9-8e74ca0c28a4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -699,7 +699,7 @@ { "listen": "test", "script": { - "id": "38fafdfc-6fa1-4eda-b75c-63bbfad94687", + "id": "c0548410-2fe9-464c-8631-56f663bebba3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -740,7 +740,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\",\r\n \"fileId\" : 3\r\n}", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -767,7 +767,7 @@ { "listen": "test", "script": { - "id": "6e881525-5aec-4544-89fd-b6c2bd2578ed", + "id": "67b118ea-01f6-46ff-a9bb-d3cf766669ed", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -835,7 +835,7 @@ { "listen": "test", "script": { - "id": "c25fafdf-d646-4931-9d6c-8c3169bb5bad", + "id": "fb6a7b1e-d13d-4182-ba7f-6093b7cdb7fd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -935,7 +935,7 @@ { "listen": "test", "script": { - "id": "99b117cd-ec8a-4c09-aa1b-e83a9bad5c20", + "id": "33f93076-8f9c-469f-960a-38899de1df3c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -964,7 +964,7 @@ { "listen": "prerequest", "script": { - "id": "6ce4d831-9f1c-4d38-8fed-9db80d720c28", + "id": "8f14c602-9fe9-4130-9c80-5470e8008ad8", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -1014,7 +1014,7 @@ { "listen": "test", "script": { - "id": "06de7116-ef01-45b6-b11c-f7aa2378ef30", + "id": "8c8b6dbc-4290-456c-9809-7e79f5c95ed1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1083,7 +1083,7 @@ { "listen": "test", "script": { - "id": "9ce218a2-1db9-47b6-82e1-721e4852ea06", + "id": "53b26750-3a98-42b8-b272-3f031483d223", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1145,7 +1145,7 @@ { "listen": "test", "script": { - "id": "7620b4e0-46e5-417f-9f0a-38f70a2a27d8", + "id": "16f12e9b-1b7a-4acd-9f62-8e09b40388cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1232,7 +1232,7 @@ { "listen": "test", "script": { - "id": "e2f71037-c9dc-471c-af03-e6a4ed884b74", + "id": "b6c65dd1-ffe7-43ef-b3dd-3cadb4654bc1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1319,7 +1319,7 @@ { "listen": "test", "script": { - "id": "6fb79dd8-0d96-45ca-a6e6-c68f6c08aed6", + "id": "cbbb90b7-c73d-4e9d-8afc-346c93253059", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1351,7 +1351,7 @@ { "listen": "prerequest", "script": { - "id": "6d9a50d2-ce3d-489b-969f-a2fef5c9117b", + "id": "ba58b818-8af3-4d50-b551-c39080072d91", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1398,7 +1398,7 @@ { "listen": "test", "script": { - "id": "58a90678-3a2a-4eb4-800c-27a7274ac14c", + "id": "3c4df8ea-cd99-4e4d-8b8d-be8c205cf613", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1465,7 +1465,7 @@ { "listen": "test", "script": { - "id": "43688dbf-597e-4439-a1ed-ae00851cbc02", + "id": "3c385836-4c0e-4dd7-ad41-ee6241c5ea38", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1526,7 +1526,7 @@ { "listen": "test", "script": { - "id": "d2d1fbd9-c0c9-401b-a86d-0c9c6bd94899", + "id": "6a60db7a-b67d-4daa-b1ad-58b768c1211f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1590,7 +1590,7 @@ { "listen": "test", "script": { - "id": "cc59531f-b92f-4cff-82d3-fc0a2a17b4c7", + "id": "dd584fc4-f7cd-4e66-a868-e9bedc550e62", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1659,7 +1659,7 @@ { "listen": "test", "script": { - "id": "186b9cb8-7125-4b08-b316-dab397482f0c", + "id": "3046e342-6d62-46fe-93ac-39cb34ada637", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1717,7 +1717,7 @@ { "listen": "test", "script": { - "id": "126613ae-0354-4881-8138-93075187cecd", + "id": "d1cfcc23-041b-4535-98d2-63ed4de0030e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1771,7 +1771,7 @@ { "listen": "test", "script": { - "id": "e26cf186-056e-40bd-ac3a-c4f2ec56e8d2", + "id": "14ed7163-65f9-453d-a49a-ccd26412b84d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1832,7 +1832,7 @@ { "listen": "test", "script": { - "id": "70355788-9a5f-4e33-b285-b1bdf43be5ab", + "id": "a860d782-8838-4da2-8b1b-c28a9fefb918", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -1905,7 +1905,7 @@ { "listen": "test", "script": { - "id": "a42659a0-b745-4e81-b433-192af0538ff4", + "id": "4be54a78-b40f-4f5f-b84f-d080dae495f9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -1978,7 +1978,7 @@ { "listen": "test", "script": { - "id": "fa83070e-6ed3-4781-be62-1a5175245e23", + "id": "164d845f-ac47-4c71-a75d-7a81f643ff71", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2044,7 +2044,7 @@ { "listen": "test", "script": { - "id": "b744ac3b-0d32-46a1-8c70-40d6c753f2b5", + "id": "59ccdecc-65f3-4eee-ab1a-1de7a51d1cdf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2103,7 +2103,7 @@ { "listen": "test", "script": { - "id": "557b8d8d-0a68-4e2d-b770-2b8ac1b6fd07", + "id": "ab55cc1e-dead-4167-b7e2-62397616fc15", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2170,7 +2170,7 @@ { "listen": "test", "script": { - "id": "97c83fc2-a1be-4586-9ab5-f5f670236cb8", + "id": "b50c15dc-de14-48f3-98c5-cafbd4db02ae", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2228,7 +2228,7 @@ { "listen": "test", "script": { - "id": "cee7fcfc-dd5d-4f5a-8b02-7d50ccd0a3cd", + "id": "b579ad2c-d55d-48e5-988b-8fc00012760e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2307,7 +2307,7 @@ { "listen": "test", "script": { - "id": "290c4e77-17a1-407d-b27b-d66d50df9b0a", + "id": "c1c6f5a7-05d9-47e8-b212-3e85a135c203", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2365,7 +2365,7 @@ { "listen": "test", "script": { - "id": "28e97f5d-4d0c-462e-a1e3-604fd26d7d6c", + "id": "51fea22f-77e8-4dd5-ba04-f00c1ff5d72f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2426,7 +2426,7 @@ { "listen": "test", "script": { - "id": "e06d65ca-6bdd-4e00-8dfb-b0de09a1312b", + "id": "84fe99dd-396e-424e-b4ad-9e8fd687a7ce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2492,7 +2492,7 @@ { "listen": "test", "script": { - "id": "ec4acf5f-6c92-423c-af3b-8dbcd1bbdf81", + "id": "48d515e2-9750-4327-8b48-95e09938cdf9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2558,7 +2558,7 @@ { "listen": "test", "script": { - "id": "960c6cf7-93ab-450c-bb81-04d3f447c184", + "id": "2bfcbae7-d289-4b24-8f8d-04c1d4648efe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2603,7 +2603,7 @@ { "listen": "test", "script": { - "id": "ccaee888-6fdc-4f95-9037-7c6e8c4cda65", + "id": "8f04d4d6-1167-4456-b896-83aa864dd52d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2648,7 +2648,7 @@ { "listen": "test", "script": { - "id": "339fc299-a932-4e93-85dc-92b3003f5444", + "id": "715b7b99-30c5-4da8-8349-165bf2b6dc3b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2693,7 +2693,7 @@ { "listen": "test", "script": { - "id": "37e25c5d-45bb-4728-b863-0a03352f07cf", + "id": "0155df6c-852e-45e5-8e9a-78298cd5d305", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2738,7 +2738,7 @@ { "listen": "test", "script": { - "id": "a74e4e22-18c1-44cf-b0cd-5109a00622d2", + "id": "005f4a13-0173-4433-a8ad-748f1321fa50", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2783,7 +2783,7 @@ { "listen": "test", "script": { - "id": "bf62a4ee-1f18-4975-a19f-404211635efe", + "id": "2d8885c4-746e-4133-a16d-bb9d7a8aee3c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2835,7 +2835,7 @@ { "listen": "test", "script": { - "id": "669fd359-8297-4cd7-8f51-f2064aae60fb", + "id": "459f3aea-788a-4b68-87c1-99d034851e31", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2886,7 +2886,7 @@ { "listen": "test", "script": { - "id": "8def5c38-80f8-4ee0-b941-d74197db5104", + "id": "9953cd22-1a66-4d81-9e9f-8f613640bf25", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2937,7 +2937,7 @@ { "listen": "test", "script": { - "id": "bd3137e6-09e0-458b-a89c-b6eb523a2b90", + "id": "ed7f9f70-9064-47d2-b8df-b0f36b786632", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2988,7 +2988,7 @@ { "listen": "test", "script": { - "id": "6ffe6def-a448-46fd-a733-db362f81db95", + "id": "62eaa375-3e12-4dea-89c8-3a816957e178", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3039,7 +3039,7 @@ { "listen": "test", "script": { - "id": "86608f26-8e4f-44cd-b1be-5a5f3f3f8170", + "id": "4a76d70a-0c0f-4a2f-a85a-aa8da1680a1d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3092,7 +3092,27 @@ "name": "File", "item": [ { - "name": "Post-File-Administrator", + "name": "File-CreateFile-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "a6fed838-9156-4e3b-aa7d-19093a1a166a", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"adminFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], "request": { "method": "POST", "header": [ @@ -3108,13 +3128,7 @@ { "key": "File", "type": "file", - "src": "/C:/Users/Niray/Desktop/angular-226066.png" - }, - { - "key": "Name", - "value": "AngularIcon", - "type": "text", - "disabled": true + "src": "testimage.png" } ] }, @@ -3132,46 +3146,22 @@ "response": [] }, { - "name": "Get-Files-Adminstrator", + "name": "Files-GetAll-Adminstrator", "event": [ { "listen": "test", "script": { - "id": "81c12ccd-bbb8-4812-bd04-0cd536e73163", + "id": "b8e0c360-7259-4b41-a793-28a5dead87cf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "var fileId = pm.environment.get(\"fileId\");\r", - "\r", - "var jsonData = pm.response.json();\r", - "\r", - "var foundAt;\r", - "\r", - "function findItem(jsonData, item) {\r", - " for (var i = 0; i < jsonData.length; i++) {\r", - " if (jsonData[i].id == item) {\r", - " return i;\r", - " }\r", - " }\r", - " return -1;\r", - "}\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", "\r", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", "});\r", "\r", "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", - "});\r", - "\r", - "pm.test(\"File is in list and matching: \" + fileId, function () {\r", - " foundAt = findItem(jsonData, fileId);\r", - " pm.expect(foundAt).to.not.eql(-1);\r", "});" ], "type": "text/javascript" @@ -3183,8 +3173,8 @@ "header": [ { "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" + "type": "text", + "value": "{{administratorUserIdentityId}}" } ], "url": { @@ -3199,6 +3189,31 @@ } }, "response": [] + }, + { + "name": "File-Delete-Administrator", + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{adminFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{adminFileId}}" + ] + } + }, + "response": [] } ], "protocolProfileBehavior": {}, @@ -3220,7 +3235,7 @@ { "listen": "test", "script": { - "id": "e7c99083-8bf1-48b1-9d0d-1c77c0f0a22c", + "id": "1c49bb0f-a80a-4ec8-9b77-71c88c2a8ca9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3298,7 +3313,7 @@ { "listen": "test", "script": { - "id": "98bbcffa-0abf-4112-81e4-76f6f46c22d1", + "id": "dabb1953-bb5c-4e5d-9ce7-9eb08aec92dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3327,7 +3342,7 @@ { "listen": "prerequest", "script": { - "id": "43fe1d19-fa88-4b79-8dc5-29da48f30794", + "id": "0016471e-2136-495e-ad70-946c4c84860e", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3377,7 +3392,7 @@ { "listen": "test", "script": { - "id": "fd8d86d1-228b-48e5-b212-33cb49e13a8c", + "id": "6429ef39-ec55-4c96-a0e4-57a3e54e0fe0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3441,7 +3456,7 @@ { "listen": "prerequest", "script": { - "id": "889aafe2-90a3-4391-81fe-2044f8db97ed", + "id": "1509eb25-47b0-4d62-ae18-3db195334a24", "type": "text/javascript", "exec": [ "" @@ -3451,7 +3466,7 @@ { "listen": "test", "script": { - "id": "4d2f90a8-9f8d-4b40-b408-92b5d446e8a0", + "id": "671efc2b-31bf-433a-bfa9-17e14caf1c07", "type": "text/javascript", "exec": [ "" @@ -3471,7 +3486,7 @@ { "listen": "test", "script": { - "id": "f569ba9a-6aca-417c-986d-2cd5add7f5a7", + "id": "73b1dc2a-0974-481a-b56a-414564ac722c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3529,7 +3544,7 @@ { "listen": "test", "script": { - "id": "aeb80cf2-6b1d-48a4-aef2-58666f80ee41", + "id": "018cda9a-c119-4008-b75a-65150360a0e6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3579,7 +3594,7 @@ { "listen": "test", "script": { - "id": "e84179f0-d219-450a-94ea-b8435f7e304c", + "id": "72f6f834-9853-4493-943d-a9994676197b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3638,7 +3653,7 @@ { "listen": "test", "script": { - "id": "275a316a-bc58-4237-b451-59181b708141", + "id": "69c7c3cf-cce7-45ca-9bcc-99aad98b4961", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3687,7 +3702,7 @@ { "listen": "prerequest", "script": { - "id": "1d59a311-70a5-41b4-8c7c-ec8e3970fc70", + "id": "26427efc-c53a-4d85-8428-f82fec1c530a", "type": "text/javascript", "exec": [ "" @@ -3697,7 +3712,7 @@ { "listen": "test", "script": { - "id": "3a6c58f3-ec2e-431f-ae7d-be0c45b78228", + "id": "0774a81a-c0a1-45dd-a8c7-c7cfaca99bce", "type": "text/javascript", "exec": [ "" @@ -3717,7 +3732,7 @@ { "listen": "test", "script": { - "id": "f31eecf3-101e-45d8-896c-93b6829ef997", + "id": "d6fe063b-42e8-469f-900e-50ae8d5eb018", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3777,7 +3792,7 @@ { "listen": "test", "script": { - "id": "ed928136-0f9f-4517-a165-88278771235e", + "id": "dec994bf-4221-407a-8d63-de70fb2505cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3847,7 +3862,7 @@ { "listen": "test", "script": { - "id": "de8abdfd-be95-41ee-a438-880a78ed9e57", + "id": "8c385d5b-d36d-425e-9734-06799ea7ba9b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3902,7 +3917,7 @@ { "listen": "test", "script": { - "id": "956adc17-e4e2-481d-a319-fc563430356a", + "id": "856d4987-2438-4774-9e83-8caa801b4921", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3959,7 +3974,7 @@ { "listen": "test", "script": { - "id": "4940a995-6afd-4045-a20f-714037ba0df7", + "id": "bda2b8f6-48ef-48a3-a1df-b38e0240c4ad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4008,7 +4023,7 @@ { "listen": "prerequest", "script": { - "id": "9cdb4743-ed03-4229-9b63-994a17209b2a", + "id": "35d19ad1-25f5-4aec-9337-9da1cb491593", "type": "text/javascript", "exec": [ "" @@ -4018,7 +4033,7 @@ { "listen": "test", "script": { - "id": "94317dc8-4595-49eb-8ef1-4d7846c54298", + "id": "ef2e77fe-df74-4a3e-93fb-e0bd8744535d", "type": "text/javascript", "exec": [ "" @@ -4038,7 +4053,7 @@ { "listen": "test", "script": { - "id": "d4d0d510-5377-4273-b398-4d9669311a85", + "id": "ee5c73df-e992-43b1-bbad-b50cc4a7cc3d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4065,7 +4080,7 @@ { "listen": "prerequest", "script": { - "id": "b456dde9-2a41-4384-b450-4e88819292ce", + "id": "79055a16-e6aa-4d43-a82c-371920634186", "exec": [ "" ], @@ -4104,7 +4119,7 @@ { "listen": "test", "script": { - "id": "9f205e7c-a6a0-4141-80ab-31561476a4c0", + "id": "aae9c527-2524-4500-9d27-6049c78aa607", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4149,7 +4164,7 @@ { "listen": "test", "script": { - "id": "0b25d214-e133-4301-9d50-ddb80d04e8c0", + "id": "d70a2f62-7be2-47c8-8720-1d7d62a2a675", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4204,7 +4219,7 @@ { "listen": "test", "script": { - "id": "8a56b167-bf41-4b17-be1c-58082dec9824", + "id": "27061337-b57d-454d-bc69-65deace7e62c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4253,7 +4268,7 @@ { "listen": "test", "script": { - "id": "a9124968-82c1-4d18-a433-9e9a7eefa06c", + "id": "75c010ff-0398-4e6b-8f69-4150f80523c4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4280,7 +4295,7 @@ { "listen": "prerequest", "script": { - "id": "c44a8d2d-cfde-44c5-91c0-f78ce1011a55", + "id": "d4f00da8-260d-46da-8c72-fba87a20486b", "exec": [ "" ], @@ -4320,7 +4335,7 @@ { "listen": "test", "script": { - "id": "348f6246-fa7c-4959-90c9-73833a2506b1", + "id": "58b9eb9f-167d-4808-ac00-6d6a9f3fc438", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4369,7 +4384,7 @@ { "listen": "prerequest", "script": { - "id": "d70f8336-aab5-41c5-86c9-21afb9b280e8", + "id": "bb31940e-4904-4d79-b690-d124ad31de90", "type": "text/javascript", "exec": [ "" @@ -4379,7 +4394,7 @@ { "listen": "test", "script": { - "id": "e75b3c22-ec2d-4e82-97ed-16158c27a16e", + "id": "f901351a-9d4e-47af-a28d-3165fb808de9", "type": "text/javascript", "exec": [ "" @@ -4399,7 +4414,7 @@ { "listen": "test", "script": { - "id": "2ad1d526-a72e-4d0f-b45a-4dc92340f58e", + "id": "ca321509-a235-438e-96cc-425a8859dcbf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4454,7 +4469,7 @@ { "listen": "test", "script": { - "id": "32fe3e45-3ac4-47f2-bac2-30334702a3c6", + "id": "746d6887-2e9d-4160-a479-426733a2669b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4500,7 +4515,7 @@ { "listen": "test", "script": { - "id": "dcd2885d-69b0-4e2a-a5f0-38b146880df5", + "id": "2707a764-fa65-43a0-b12f-e4da537abc7f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4547,7 +4562,7 @@ { "listen": "test", "script": { - "id": "af38008a-4aff-475f-89e6-7d93aac608ff", + "id": "a4f9a8a7-e3bc-4898-89d0-b3a14522b239", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4596,7 +4611,7 @@ { "listen": "prerequest", "script": { - "id": "d3fb6133-8b0e-4b96-a0ba-06ea6fd7b479", + "id": "f50f3d63-5d20-44c2-98e8-96fc6af33cc7", "type": "text/javascript", "exec": [ "" @@ -4606,7 +4621,7 @@ { "listen": "test", "script": { - "id": "f4dd093b-d580-4dff-9a84-a69dc44e8d1a", + "id": "73138c78-8c56-4d5f-b35f-9a9431dafd77", "type": "text/javascript", "exec": [ "" @@ -4626,7 +4641,7 @@ { "listen": "test", "script": { - "id": "2e37d845-1719-4f49-a395-b4ea2bc33353", + "id": "26cab543-84e4-4341-9e81-c89c25b753e5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4682,7 +4697,7 @@ { "listen": "test", "script": { - "id": "123a115d-e03e-4ac3-9cfb-15a1c236406a", + "id": "5e3b1bf6-97ec-4123-b713-75fbbb64ffa6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4729,7 +4744,7 @@ { "listen": "test", "script": { - "id": "f8d87263-342b-4d32-bdde-08d3351d7813", + "id": "a6041d9c-185a-4308-8e6b-318ea67c6d0b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4777,7 +4792,7 @@ { "listen": "test", "script": { - "id": "788ed43b-c45a-46ec-bcf3-3ec5ac30e1b5", + "id": "d39e2577-cecc-4062-b570-9f72693c6f0a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4825,7 +4840,7 @@ { "listen": "test", "script": { - "id": "223451e7-b0d5-4a05-b030-66ec1003c39c", + "id": "d6a209ba-5683-4498-9fdc-9d45e738e50c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4882,7 +4897,7 @@ { "listen": "test", "script": { - "id": "210efb08-e192-4b27-8d2d-6cc881c952f9", + "id": "4648032e-899f-4190-bbf6-677fda89ef00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4953,7 +4968,7 @@ { "listen": "prerequest", "script": { - "id": "927376a6-7594-4cbc-8939-fb23d6347d29", + "id": "897bda5e-f9d8-4b06-b378-b5569ed99596", "type": "text/javascript", "exec": [ "" @@ -4963,7 +4978,7 @@ { "listen": "test", "script": { - "id": "cfd7cc0e-ae53-4786-8684-1cb0890e017a", + "id": "1912923b-7bd8-4e25-9e9e-d8ece09e8593", "type": "text/javascript", "exec": [ "" @@ -4983,7 +4998,7 @@ { "listen": "test", "script": { - "id": "18549450-5d4c-4ff9-8a5e-ca147880c54b", + "id": "ed57f482-6eef-4d02-81f0-36ad6fee0d81", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5034,7 +5049,7 @@ { "listen": "prerequest", "script": { - "id": "83cfd939-a951-40c5-afda-552f50ccf153", + "id": "8f8effd9-8638-4d5e-a2af-8fb448c84ee2", "type": "text/javascript", "exec": [ "" @@ -5044,7 +5059,7 @@ { "listen": "test", "script": { - "id": "76a652ca-8fb0-4b77-833f-145bd5160cce", + "id": "0b252cab-2396-40bd-99f2-e13b96d8792d", "type": "text/javascript", "exec": [ "" @@ -5064,7 +5079,7 @@ { "listen": "test", "script": { - "id": "2aae1abf-408d-4f0d-a3b4-9df1ca861910", + "id": "97b466a4-eace-474c-9765-d5406c6adb0e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5120,7 +5135,7 @@ { "listen": "prerequest", "script": { - "id": "fbacf122-a3f1-4525-a1e8-88f6e29824bf", + "id": "2b117980-2db2-4731-9db8-12fc6c2ffef7", "type": "text/javascript", "exec": [ "" @@ -5130,7 +5145,7 @@ { "listen": "test", "script": { - "id": "724686a9-00cc-47cd-a5ed-f778fd7c5c95", + "id": "4321f7be-43ec-4394-9eb8-30d2d87f5286", "type": "text/javascript", "exec": [ "" @@ -5150,7 +5165,7 @@ { "listen": "test", "script": { - "id": "9d2cbee0-a55f-419b-b83c-7935f57578a4", + "id": "bda204f3-9483-4fe7-9bae-fa5030dc6a67", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "var fileId = pm.environment.get(\"fileId\");\r", @@ -5159,32 +5174,12 @@ "\r", "var foundAt;\r", "\r", - "function findItem(jsonData, item) {\r", - " for (var i = 0; i < jsonData.length; i++) {\r", - " if (jsonData[i].id == item) {\r", - " return i;\r", - " }\r", - " }\r", - " return -1;\r", - "}\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", "});\r", "\r", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "\r", - "pm.test(\"File is in list and matching: \" + fileId, function () {\r", - " foundAt = findItem(jsonData, fileId);\r", - " pm.expect(foundAt).to.not.eql(-1);\r", "});" ], "type": "text/javascript" @@ -5192,6 +5187,9 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", "header": [], "url": { @@ -5213,7 +5211,7 @@ { "listen": "test", "script": { - "id": "19b3d11e-6e99-409a-8b57-e1ad160ed660", + "id": "2d226309-550b-4c77-8463-9ee68b9184f6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -5275,7 +5273,7 @@ { "listen": "prerequest", "script": { - "id": "64a0f5f6-404f-4443-89ce-b7c470b929c3", + "id": "79000e1c-060b-497c-b9bd-aac4c56b030b", "type": "text/javascript", "exec": [ "" @@ -5285,7 +5283,7 @@ { "listen": "test", "script": { - "id": "d89ae775-f38f-4630-9fc1-5ac76dbab80f", + "id": "e524f41a-075d-4e0d-b185-b7c683a2a91c", "type": "text/javascript", "exec": [ "" @@ -5308,7 +5306,7 @@ { "listen": "test", "script": { - "id": "ebb10d5b-77eb-415b-b38e-00cb24d8e3fe", + "id": "6a4fefa1-1981-4deb-9304-f4f24bf74449", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5377,7 +5375,7 @@ { "listen": "test", "script": { - "id": "2305df9c-9028-43ce-b1cc-5c8ed744b53a", + "id": "86da24b0-429d-4e19-8d74-8f718da42337", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5456,7 +5454,7 @@ { "listen": "test", "script": { - "id": "bfe9e171-309b-441a-8b3f-1daa3263bdd1", + "id": "bdf226c6-3f35-4c02-9af1-1e57c2f63615", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5485,7 +5483,7 @@ { "listen": "prerequest", "script": { - "id": "f623e1cd-0607-48c5-8568-d2475682543e", + "id": "ba84a929-a4d9-4da9-b98f-18167bb72a91", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5535,7 +5533,7 @@ { "listen": "test", "script": { - "id": "7f5b764b-0540-4a90-8297-441445fa4b99", + "id": "243b9b85-4e59-4256-81a1-b08d862349e4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5600,7 +5598,7 @@ { "listen": "test", "script": { - "id": "f41e6068-3325-4603-8e8e-cbefab149620", + "id": "538019fd-aca1-4831-8b01-9a8bff2f9b36", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5673,7 +5671,7 @@ { "listen": "prerequest", "script": { - "id": "1bc765df-497e-4b29-9f9e-a9005bf5e6b0", + "id": "e8773fce-296c-43a6-9507-a07f6599441f", "type": "text/javascript", "exec": [ "" @@ -5683,7 +5681,7 @@ { "listen": "test", "script": { - "id": "902d672a-ef19-4744-9150-fef0718faee6", + "id": "05adf8cc-4736-4904-987d-c3e48fa2e709", "type": "text/javascript", "exec": [ "" @@ -5703,7 +5701,7 @@ { "listen": "test", "script": { - "id": "91ea27d9-0be0-4e2a-8338-8b79f3d3b999", + "id": "02fe2189-5a20-4f19-90b8-629b88fced33", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -5763,7 +5761,7 @@ { "listen": "test", "script": { - "id": "874176a4-8f81-4bc4-98ea-aa7513bfedaf", + "id": "08c84fca-7087-4d72-8615-66c4675da916", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5816,7 +5814,7 @@ { "listen": "test", "script": { - "id": "bd897fe3-0e30-484f-bc29-d8320ed4d0da", + "id": "feb2e309-5778-4c0f-a95e-9fb0b85d155a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -5874,7 +5872,7 @@ { "listen": "test", "script": { - "id": "0715648b-54ac-4979-8fa2-5217680038bf", + "id": "f8b48cf5-0669-497d-9d89-62aed3614e0f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -5941,7 +5939,7 @@ { "listen": "test", "script": { - "id": "ccd36a14-6440-4757-81e5-792edc95c859", + "id": "b3548720-cd28-434f-b7e0-d81e9b669f8a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6003,7 +6001,7 @@ { "listen": "prerequest", "script": { - "id": "99373590-b848-4271-80fe-9614ce90b4d1", + "id": "5ce85a14-947e-4d7f-9535-45bc0953b092", "type": "text/javascript", "exec": [ "" @@ -6013,7 +6011,7 @@ { "listen": "test", "script": { - "id": "3a4e309f-1ff8-4e19-9800-469c5b31a755", + "id": "c01dcfd5-e421-49d4-9806-c5017ddfd833", "type": "text/javascript", "exec": [ "" @@ -6033,7 +6031,7 @@ { "listen": "test", "script": { - "id": "da27776b-00ab-4e24-81c2-3d9005c7c766", + "id": "96b37a8e-1c03-4488-bf5e-528827de332f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6099,7 +6097,7 @@ { "listen": "test", "script": { - "id": "70a289b4-2136-4521-9ed7-f3f5d3c16e6b", + "id": "3dd9de87-c988-4597-a5aa-2f8df30614b2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6172,7 +6170,7 @@ { "listen": "test", "script": { - "id": "7d78523e-e636-4cb0-b65c-2f2b71a339e4", + "id": "5991b9e0-4422-4c3b-a7fd-e70fd43c6616", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6230,7 +6228,7 @@ { "listen": "test", "script": { - "id": "6f1e9d16-dba9-484e-b3dd-9c8b6bc85a36", + "id": "3636c57c-5eb6-4af2-ac8e-0cd7a309b3d0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6280,7 +6278,7 @@ { "listen": "test", "script": { - "id": "88436bbe-4b0f-4893-bc32-7adc6abd3e60", + "id": "2316752d-f40a-4290-9c36-26a25d564e59", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -6347,7 +6345,7 @@ { "listen": "test", "script": { - "id": "dbec3f69-9895-4a36-a768-de9011126769", + "id": "1b8af729-0630-496e-853d-14b8f5e71670", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6414,7 +6412,7 @@ { "listen": "test", "script": { - "id": "0de8a2b0-618d-4727-9dfc-9c1774dc9d4e", + "id": "c5c91adb-5c0c-4122-b77c-fa97beac99c6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6478,7 +6476,7 @@ { "listen": "test", "script": { - "id": "298f55fa-20ae-4c0a-92de-a3aba255250f", + "id": "fd73158c-b3d3-483e-b95e-e00ea26a86ee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6539,7 +6537,7 @@ { "listen": "test", "script": { - "id": "598e788e-0a2b-4878-beca-e91776535040", + "id": "61bd239a-80c2-4e45-8056-2a46dccabda0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6591,7 +6589,7 @@ { "listen": "test", "script": { - "id": "df306696-978d-4cd3-acd1-adfed80be4cf", + "id": "29253423-467c-489c-8b02-fe4a07c580ad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -6656,7 +6654,7 @@ { "listen": "test", "script": { - "id": "a51481bd-e084-4e02-91b4-0f1fac1ea5d7", + "id": "fe3d183f-a6bd-494b-91ce-0c752a1a6844", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6682,7 +6680,7 @@ { "listen": "prerequest", "script": { - "id": "049169a7-0260-4cf4-875d-213c39f8da39", + "id": "a1887e51-b588-451f-8c1e-b625e4ac7696", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -6732,7 +6730,7 @@ { "listen": "test", "script": { - "id": "3358c856-c92c-441f-8f0d-ba566c7d7960", + "id": "34ae4cd0-a79c-4883-8ada-9fbc912b1a17", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -6801,7 +6799,7 @@ { "listen": "test", "script": { - "id": "e610ffdd-f207-4e52-9611-7064eec1c536", + "id": "7ea7c06e-7d28-49bb-aed7-6c08a4699a92", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -6863,7 +6861,7 @@ { "listen": "test", "script": { - "id": "de8f304d-d695-409c-9e66-715252b8bc10", + "id": "8408b6a6-bbea-4026-a4b3-c056d8cef972", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6918,7 +6916,7 @@ { "listen": "test", "script": { - "id": "19a444c3-d12d-4231-8782-4b66f605688a", + "id": "66479555-e648-4132-a1f1-8470cae3df9c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6987,7 +6985,7 @@ { "listen": "test", "script": { - "id": "13d4e71b-c891-4808-9e6f-3212f7077cb0", + "id": "394fd4c8-af49-406c-b87a-05e439c98418", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7048,7 +7046,7 @@ { "listen": "test", "script": { - "id": "ab6b88f5-f7cd-41a6-9214-146b77507ed4", + "id": "24b6be10-28bc-4f4b-a723-a16cee55b22e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7100,7 +7098,7 @@ { "listen": "test", "script": { - "id": "67b24c11-d444-4a05-9322-a3cadfba54c5", + "id": "c04efc10-8344-4b5e-958d-be2c780602ec", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7153,7 +7151,7 @@ { "listen": "test", "script": { - "id": "1ad43cc3-177c-414c-a8a2-b20b12b56d73", + "id": "f2648a4d-ff48-4784-a648-fb6b1639c5f0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7206,7 +7204,7 @@ { "listen": "test", "script": { - "id": "99426315-de87-4ae4-a0ad-955e357c04f3", + "id": "2152fc44-7d8d-4a98-819b-2d799f64b2c1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7268,7 +7266,7 @@ { "listen": "test", "script": { - "id": "73e8d65c-73fd-406e-852c-1de0268991df", + "id": "0dc1165c-211a-4a5c-8008-c5ed1427ed23", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7349,7 +7347,7 @@ { "listen": "test", "script": { - "id": "3f6441c9-b36a-4722-a2d8-5f5cd57dc49f", + "id": "8a2f9eb2-881f-4220-b387-fc80eeee962a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7408,7 +7406,7 @@ { "listen": "test", "script": { - "id": "3cd95667-559d-4c69-ad32-90c664b290e0", + "id": "6bfcc70d-8d15-4d1c-bf50-1318eb6ee7d1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -7474,7 +7472,7 @@ { "listen": "test", "script": { - "id": "f4574f79-0fd2-4c66-beb2-18518b3e3be0", + "id": "ea5f0b58-5de6-43c9-9e19-56165c4a2c11", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7523,7 +7521,7 @@ { "listen": "test", "script": { - "id": "69b175b0-45c4-4036-add9-2632f98869c6", + "id": "169e65dc-c0ab-4a21-ba29-105639fb2dac", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7574,7 +7572,7 @@ { "listen": "test", "script": { - "id": "f5dbb78e-bff0-44e6-952b-471c8c1fbe04", + "id": "87cf585a-27e7-4bfc-a49c-7ea1fd34933d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7625,7 +7623,7 @@ { "listen": "test", "script": { - "id": "14192d70-5ab7-46fb-a5e7-e5ed0bedc424", + "id": "44752391-c239-4efb-85b4-0272e0b8c57a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7670,7 +7668,7 @@ { "listen": "test", "script": { - "id": "1cee0e3a-ac3b-455b-8701-d2747a121bd4", + "id": "5b58f2cd-4f45-472b-954e-9e44dc146e02", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7721,7 +7719,7 @@ { "listen": "test", "script": { - "id": "73060625-c1e1-4a96-ba30-b307d75a308a", + "id": "778700eb-8d15-4a20-be05-4d80bfd602da", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7772,7 +7770,7 @@ { "listen": "test", "script": { - "id": "6cb284d4-7a70-4942-950b-ce7f243b2882", + "id": "d94c496e-e311-4bac-8b88-09e4b10e0ae3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7826,6 +7824,25 @@ "item": [ { "name": "Post-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "88185be2-ef36-4b69-b029-978de18c4730", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"registeredFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], "request": { "method": "POST", "header": [ @@ -7841,12 +7858,7 @@ { "key": "File", "type": "file", - "src": "/C:/Users/Niray/Desktop/angular-226066.png" - }, - { - "key": "Name", - "value": "AngularIcon", - "type": "text" + "src": "testimage.png" } ] }, @@ -7869,41 +7881,19 @@ { "listen": "test", "script": { - "id": "c610771e-cf59-4510-bedf-b891ce8fa815", + "id": "948f3a85-70d9-434e-b044-ca69d0bde753", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "var fileId = pm.environment.get(\"fileId\");\r", "\r", "var jsonData = pm.response.json();\r", "\r", - "var foundAt;\r", - "\r", - "function findItem(jsonData, item) {\r", - " for (var i = 0; i < jsonData.length; i++) {\r", - " if (jsonData[i].id == item) {\r", - " return i;\r", - " }\r", - " }\r", - " return -1;\r", - "}\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", "});\r", "\r", "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", - "});\r", - "\r", - "pm.test(\"File is in list and matching: \" + fileId, function () {\r", - " foundAt = findItem(jsonData, fileId);\r", - " pm.expect(foundAt).to.not.eql(-1);\r", "});" ], "type": "text/javascript" @@ -7931,6 +7921,25 @@ } }, "response": [] + }, + { + "name": "Delete-File-Registered", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File/{{registeredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{registeredFileId}}" + ] + } + }, + "response": [] } ], "protocolProfileBehavior": {}, @@ -7952,7 +7961,7 @@ { "listen": "test", "script": { - "id": "86d75a7e-2ba4-4313-b4c1-a876fe24eb32", + "id": "e12a86a5-e2ed-400f-a316-23535ee6a691", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8021,7 +8030,7 @@ { "listen": "test", "script": { - "id": "a7c80da4-0c6b-461a-a50b-6c58a4edebfa", + "id": "b99dcd01-5d91-4c32-9a75-f63bb2d7f5c2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8100,7 +8109,7 @@ { "listen": "test", "script": { - "id": "d1681d9f-d9eb-400d-9a6d-fd8ecca7c79e", + "id": "f896adb5-6499-434e-acae-2bac22df1418", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8129,7 +8138,7 @@ { "listen": "prerequest", "script": { - "id": "3fab5196-9963-4a65-9b97-cb12e74f1fd8", + "id": "cd45030e-f268-4a72-bc2f-e76e9fcc2b54", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8179,7 +8188,7 @@ { "listen": "test", "script": { - "id": "4bd15b0e-9b23-4e37-9557-c74f94052c5a", + "id": "2383872b-e42e-40f0-b391-8c513156d470", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8243,7 +8252,7 @@ { "listen": "test", "script": { - "id": "a1a717be-5b52-4c13-b130-74532a5562e8", + "id": "f2c9c6d1-a9b9-4ec8-886b-a1b8bf25019c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8316,7 +8325,7 @@ { "listen": "prerequest", "script": { - "id": "3073b7ea-cdc2-46fe-bdd7-8fccd41d9c16", + "id": "7d19da17-56a4-4025-9e72-bd62d9632e83", "type": "text/javascript", "exec": [ "" @@ -8326,7 +8335,7 @@ { "listen": "test", "script": { - "id": "9962391e-6a04-4b9d-b2ea-28a93844e89f", + "id": "3418de5e-690b-47af-8f31-922465bf321b", "type": "text/javascript", "exec": [ "" @@ -8346,7 +8355,7 @@ { "listen": "test", "script": { - "id": "e4564fe6-7891-489b-a24d-1ba47346d128", + "id": "3f76e672-e3e7-405a-9645-3e04021f5e4b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -8406,7 +8415,7 @@ { "listen": "test", "script": { - "id": "d45e0960-0000-4056-98a0-c28087fcc4b4", + "id": "238c139c-0dfc-4fd2-a0e7-ac5f5a8d8593", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8459,7 +8468,7 @@ { "listen": "test", "script": { - "id": "9cf3cc38-154e-4839-bb34-8b765e865793", + "id": "1e357f48-3461-4f08-8483-9cdb76a40912", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -8517,7 +8526,7 @@ { "listen": "test", "script": { - "id": "a53ccfcf-83b7-4a54-8ff2-9fd47fdbf207", + "id": "8002f97e-7c2c-4d97-9ed5-2dfbff32cfed", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -8584,7 +8593,7 @@ { "listen": "test", "script": { - "id": "aa729705-c6f9-48a2-9fc2-e75d48b7bb39", + "id": "9dff6b94-e746-4745-a93f-530ceaa9fbd4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8646,7 +8655,7 @@ { "listen": "prerequest", "script": { - "id": "0eb4be27-3b1e-4140-af7e-8aa76f42e299", + "id": "9a2cadcf-fe74-4db4-948f-37cad5e0145f", "type": "text/javascript", "exec": [ "" @@ -8656,7 +8665,7 @@ { "listen": "test", "script": { - "id": "32db062f-6a84-4131-a715-7d63bc2feb13", + "id": "7ded2f08-b954-4456-817c-89a4bf25987f", "type": "text/javascript", "exec": [ "" @@ -8676,7 +8685,7 @@ { "listen": "test", "script": { - "id": "626162f1-0517-4f7d-b5c7-7d718f65bc2f", + "id": "d716c27a-c9b1-4dd6-95ec-8e0bfe415608", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -8742,7 +8751,7 @@ { "listen": "test", "script": { - "id": "4041da04-18c8-42be-badf-512516b7fa53", + "id": "10a8fa62-4f31-4c27-a740-88e4c10ed5ff", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8815,7 +8824,7 @@ { "listen": "test", "script": { - "id": "f8b70da0-78ca-4b7d-820d-00f609531e0e", + "id": "6db65780-3baa-4159-bbf2-44260a1a13db", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8873,7 +8882,7 @@ { "listen": "test", "script": { - "id": "c5c011bc-40db-41d4-9222-6a246956826d", + "id": "894e4dc8-8a00-4b1a-8b65-6c115bd4851c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -8923,7 +8932,7 @@ { "listen": "test", "script": { - "id": "b900bf7d-099e-4ae5-935b-173e6e04612a", + "id": "49b2a3a6-19dc-41c4-9727-d9e41d4d134b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -8990,7 +8999,7 @@ { "listen": "test", "script": { - "id": "0f35f244-ac36-44d3-8913-7a5b017ed57f", + "id": "258d622e-4541-4365-bbe9-3403d3e84a6c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9057,7 +9066,7 @@ { "listen": "test", "script": { - "id": "078e1158-12d7-48cf-a5c7-201fb5a1deb5", + "id": "877d92ec-4a31-4764-8a5f-bb797ec37ecb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9121,7 +9130,7 @@ { "listen": "test", "script": { - "id": "b0c4ed4b-f882-41d9-b17a-e59ded461fbe", + "id": "83377c69-3a90-44ca-9d7f-03abd18b5af2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9185,7 +9194,7 @@ { "listen": "test", "script": { - "id": "92efd26c-c091-4972-851f-509e94753019", + "id": "c735c7b8-988b-45fa-8117-f38db3dc5414", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9237,7 +9246,7 @@ { "listen": "test", "script": { - "id": "45eb84a1-ddcf-4bfc-bd2f-7f845d99452f", + "id": "fcba375a-7ba8-43a8-84f7-9589081fe5f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -9295,7 +9304,7 @@ { "listen": "test", "script": { - "id": "10ad0812-48d9-488f-b60d-2238169c981d", + "id": "2ee8c4c1-d852-4761-b1e2-3128d1587936", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -9360,7 +9369,7 @@ { "listen": "test", "script": { - "id": "e6cc5d02-3b27-47a5-9a7b-ffbfbb5716cf", + "id": "e71ace0c-8144-4be6-a81c-3fbefe4d9999", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9388,7 +9397,7 @@ { "listen": "prerequest", "script": { - "id": "e73d5684-8a33-421c-a298-5a679635136e", + "id": "3196284c-29db-4212-9965-c69958c46af6", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9438,7 +9447,7 @@ { "listen": "test", "script": { - "id": "78e143b3-fa97-417a-a77f-aa69bd1b89a9", + "id": "621f51ee-1cb2-42be-a182-9fc3788210bb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9500,7 +9509,7 @@ { "listen": "test", "script": { - "id": "2870f74a-1eb4-4c5f-9873-29d0deacae94", + "id": "d62fd082-0ba7-48db-a0df-4ec2b4d30cd9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9587,7 +9596,7 @@ { "listen": "test", "script": { - "id": "95833f0f-c9ec-43db-9554-58875a6b860f", + "id": "853e709a-07a4-42f5-a0da-2cf17fa9840b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9613,7 +9622,7 @@ { "listen": "prerequest", "script": { - "id": "5e62987a-59d2-49a4-8fbe-70773a257969", + "id": "9173a117-50e3-4403-aa18-009e63a458f5", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9660,7 +9669,7 @@ { "listen": "test", "script": { - "id": "3ac7cacd-fd54-4259-9f64-91ce1ef8d0c7", + "id": "6f0dee03-d88a-4d79-bbde-bb8af27fd4fc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9687,7 +9696,7 @@ { "listen": "prerequest", "script": { - "id": "2672a24f-9794-45ac-960c-c2642b8f79f5", + "id": "68a576c3-f2ac-416d-8f09-53f2297d7338", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9737,7 +9746,7 @@ { "listen": "test", "script": { - "id": "41c18b70-27f3-4cba-9577-d4b032fe3d6d", + "id": "35840ca5-0967-43d1-b825-a316b8a7926f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9799,7 +9808,7 @@ { "listen": "test", "script": { - "id": "c267e17a-ca35-4ec9-8829-b37fcbedb421", + "id": "467a55aa-1b3e-4600-8d2b-cfbd053328e6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9886,7 +9895,7 @@ { "listen": "test", "script": { - "id": "4b24201b-fd5b-4fb7-803c-67d6b038ad7b", + "id": "b35fd0b2-305a-43d9-8a01-a57d1005ae30", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9912,7 +9921,7 @@ { "listen": "prerequest", "script": { - "id": "2198fd5a-c82b-4f40-bcf1-446422e89706", + "id": "f28b0b8a-6327-441a-8997-ec31e8ba8800", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9959,7 +9968,7 @@ { "listen": "test", "script": { - "id": "f88bc669-dfb4-4981-b62d-77260e639d70", + "id": "a9e2aa25-edd3-4a70-983d-2aa7ab7d26b1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10035,7 +10044,7 @@ { "listen": "test", "script": { - "id": "6ca1d0dc-3f40-48dc-b9f2-562995303c27", + "id": "52a9fea3-1e46-498d-8633-3ce516efe091", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10096,7 +10105,7 @@ { "listen": "test", "script": { - "id": "5deee44c-c2c2-4fa1-8577-038884b39f8e", + "id": "20ef741e-4858-4f00-8784-0e6ae0b2fc3a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10148,7 +10157,7 @@ { "listen": "test", "script": { - "id": "dfb8591c-ef03-4d0d-9a4e-f497e2ef0e8f", + "id": "301a6dbc-bd69-45f5-8967-5cb797d355c1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10201,7 +10210,7 @@ { "listen": "test", "script": { - "id": "49933d24-e3b5-4a0a-ab4c-cba2aacafea9", + "id": "e74d7127-a975-40ca-a8d6-131e06711cab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10254,7 +10263,7 @@ { "listen": "test", "script": { - "id": "5cca3606-27e6-4fd2-a914-508c74712e83", + "id": "9dd11f58-4136-4a5e-ae9f-cbc0ee317f22", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10316,7 +10325,7 @@ { "listen": "test", "script": { - "id": "1cc59e35-94f1-41d2-bab6-0afea72309d0", + "id": "8ed5ab50-4097-48b2-9e1d-e36d6c76709a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10397,7 +10406,7 @@ { "listen": "test", "script": { - "id": "e79fea6d-d632-4af4-9365-93efde82c9e1", + "id": "6cbcb199-af63-4429-8317-6c8d66dd1221", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10456,7 +10465,7 @@ { "listen": "test", "script": { - "id": "f3788638-93cc-458c-bdb0-882321ea2475", + "id": "e8ec61b8-ea91-4dfc-809a-0bf96b6e6e9c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -10522,7 +10531,7 @@ { "listen": "test", "script": { - "id": "8074834b-c21b-4c02-bd49-a21fc1597e4a", + "id": "361e8a38-d34c-46a9-bb83-1f181dd27bc2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10571,7 +10580,7 @@ { "listen": "test", "script": { - "id": "c8e0d889-e8d3-4d7a-b3dd-fc24d8662ff8", + "id": "32c9611e-b97e-4a3f-932f-0587f3016753", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10620,7 +10629,7 @@ { "listen": "test", "script": { - "id": "58a882b6-ef2a-454d-be84-e405e7312d76", + "id": "36291d9c-81c0-4891-afb1-9fd54657e3d6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10665,7 +10674,7 @@ { "listen": "test", "script": { - "id": "bc19e128-cec0-4fdb-a7ca-8607181df075", + "id": "c432acf7-4dbd-4ca2-ba6e-030fdad805f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10710,7 +10719,7 @@ { "listen": "test", "script": { - "id": "a0da056f-24ff-4c9d-a012-e1493a4094e7", + "id": "f6cca7b1-2f69-416e-9c84-d65620eca53a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10755,7 +10764,7 @@ { "listen": "test", "script": { - "id": "b5cd2c3e-1e1f-466d-9dba-d94d901114d5", + "id": "c4695129-6ef3-4cd9-9833-3a1b47a20849", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10808,7 +10817,7 @@ { "listen": "test", "script": { - "id": "8ddc5b02-3443-4c34-bcef-3bf76205d7d3", + "id": "b533e04e-224e-4fde-9c76-db5febaac2c7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10861,7 +10870,7 @@ { "listen": "test", "script": { - "id": "3b1e1f73-6bb8-406d-9e0a-e179d4ab869e", + "id": "8b7943b3-1f1d-4298-a4f4-86db61b7ea85", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10916,46 +10925,75 @@ "name": "File", "item": [ { - "name": "Get-Files-PR", + "name": "Post-File-PR", "event": [ { "listen": "test", "script": { - "id": "cf2fa958-2e43-4e12-bf2e-3b8300dec03a", + "id": "dcdb326d-fa8b-4a52-90b5-643452aec0fe", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "var fileId = pm.environment.get(\"fileId\");\r", - "\r", "var jsonData = pm.response.json();\r", "\r", - "var foundAt;\r", - "\r", - "function findItem(jsonData, item) {\r", - " for (var i = 0; i < jsonData.length; i++) {\r", - " if (jsonData[i].id == item) {\r", - " return i;\r", - " }\r", - " }\r", - " return -1;\r", - "}\r", + "pm.environment.set(\"prFileId\", jsonData.id)\r", "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "/C:/Users/Niray/source/repos/dex-backend/Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "98ab479b-8107-4489-9363-ea6307658246", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", "});\r", "\r", "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", - "});\r", - "\r", - "pm.test(\"File is in list and matching: \" + fileId, function () {\r", - " foundAt = findItem(jsonData, fileId);\r", - " pm.expect(foundAt).to.not.eql(-1);\r", "});" ], "type": "text/javascript" @@ -10985,39 +11023,19 @@ "response": [] }, { - "name": "Post-File-PR", + "name": "Delete-File-PR", "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "/C:/Users/Niray/Desktop/angular-226066.png" - }, - { - "key": "Name", - "value": "AngularIcon", - "type": "text" - } - ] - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{apiUrl}}/api/File", + "raw": "{{apiUrl}}/api/File/{{prFileId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "File" + "File", + "{{prFileId}}" ] } }, @@ -11059,7 +11077,7 @@ { "listen": "prerequest", "script": { - "id": "65f53329-1549-483c-8c7b-513f37c1ca29", + "id": "16096042-d8ba-420a-b43d-d4ef971fb73e", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11103,7 +11121,7 @@ { "listen": "test", "script": { - "id": "cac65308-248d-4c31-be9f-b1186e7b3b72", + "id": "0ae5945b-7504-4611-bff4-94a931427ba8", "type": "text/javascript", "exec": [ "" diff --git a/Postman/runtests.bat b/Postman/runtests.bat new file mode 100644 index 00000000..17b98801 --- /dev/null +++ b/Postman/runtests.bat @@ -0,0 +1 @@ +start cmd /k newman run dex.postman_collection.json -e local.postman_environment.json -k \ No newline at end of file diff --git a/Postman/testimage.png b/Postman/testimage.png new file mode 100644 index 0000000000000000000000000000000000000000..b415191db085ca2688bb06e5d5e49857d8ebe1b4 GIT binary patch literal 13976 zcma*OWk6Kl7d3om=#cJ^7F49AJEWvr8bm}=VnA}}p&OKL0hN;OQoxb!4(X1e>$$)G z`+j-8J$$(g!#U^Pz4uvr?S0pY&{S7^giC`90Kg+b}Rru^fLfZx@0zKiGyEY zTB$0^gIDn9O0GEoykNO2t0`cuU=kBN<9K3s08aQaQdwR`*K2ma^;0srP4?#9C#yzP zC!u~;QX*YJaxG$v#9#E9bA9_<3)jUTa(kPnha0=!`A!JGU5|NPaO#uY z@TvVGV(HWvo!F0HOyFfMju-wkP79Qd2frKF+lly|IVf8?M5?B)?wKsYI54yWYSE+c zkcqhnNd=IPx-Xw>UA?-LV+Cwt?b2B)rH=66yzo(^>L8>YYKA_G-z`jmqG4Vm#*zMF znf|0hdYRaQ_*~zd+ogfOyShJ1`0 z$VAtNwxcid;Quoj-i_tRRsvK$PfkwaGW7`TIbVxN*J>2EW4w0Y_3Gt`9?U&dkhheF zYFd3Rrbc^W9k9iKNrRR>3dtq+lEJQOYityuKk{WZA;OWyu}Cil4tma)hp@shCB8nd zq`gr(W4XA9jRWiVlpw2z=_TsDEX7Ac7zuLMB51O}d2V4e%z1z&D<65<(Ikit4f z__}${(IxWQKod!h?sv8m-hA=r(quqo%F5ChhWmZLeCEP|D|`~J1h9_H&X(aa{kC>K z+(erq3cBH{rcOq~>U-3LiIPRbC>q9TiFtupOtkvm&CPAt?U^z3L4i|oc6OEwd{E1P zF)4z1Y3zgAzD?!2!~A#uL_bK*cXj@>6)7os?-?tXBS3u?mLWYBl)dpQ6K&E$>dAKj z{C{tUNuLQpABs3B^~+6^xzcDO_dCrIeohRL*3FllXyXpEN*|D~td>laP;*~P_N06^ zZkH6={ont4lB`23qgC3Qc{J&nwcq{}pe#Tg#tF9J{IFx*sU*$~kwtn7W7b$kbsB4NxUR@UmlG!^ z^+SjzIvn;0@7!~lw?08iHV3utj`g)^Cv}b|C=m|lWmD#Az#t2{iX6*q$dj64<&r5v z4B|5L3}^UyN0cnWGb1B|Uq+)O8GAyE`rYfXXf&NFDHLWruD3d%@Zq=!iN*cxAq2wLpt(AU6z`M=d~38 z<2cdYYYB@!95FX#%C^^nb52UK~#L_+WZplYqwhEDM zJ@BqkP8#_wlqW!deXVaAjj`835nR-9UUI&I!3+UXxy@tqIan&A-g2Qkv9a=AURM>2 zJIuWP@Xwp%=G<)ZivdSAPRB0}+?~pm_i9PQ?62j=!=Ft)C3NUk*M7tIemIx=cN_y4 zjL@PXTxrkk?+_EEmM_>Lt3)OeKB+r#b&0dn`+t$j)2+Cj35}=IS6$q!T=EL^yd-|3 zWHlfE5!c?W&A4h%ToQ>X+eO$I`P{4y<__V&?b2(d`A<}A$wLy=b*^U4oop9j$u(}a zW=!wv=l?`VJy45f`=#HSF?1d2J#rl90Nn@1sN(o|U;TC_=Mkjt^oU$Ri(v2zKl_%* zm23_XFedQ4Qfe=%GVW0Jc#hpwBvGurZTYX*KXV7wv!VOM;QIOBQ{1;fgY7pJ_gp4Z zBTkQF1V8f4PKy!i>D|w^i<(ZejhdssdDP9ZI74FfM;~}&Z0y0*voJk`A|&+G%8fW>Nxh)QQ2Cw~gKK zSTkpS8SZ}U$GRbl@c~O!b4giGy|>GE+DKK7r;vsc_ethuGuhQn%0@bJb3f$|-J)eu zi;>>v4#PT4;!Wxce4^pQ~53+pO+F>cEUA}bvbO*!!L!n6SpO5Ksw2fg>h z^+e$GRnBpmKR>aQ#_UEgh*OpD50OX8wo|6&#x&mD#=#C3)qH$zuG%-_9&qt}9=5Mk{m(O?!0;7efZ|4$IfleS*S4~`Q~LWu{PI?=*H#vg zoY5DU9ceOYN`xr1$^A}-n1!b6j}CcC{EqOnbEj=t*Wy4-~B!EBMF>; zG$v57DZ4sAAJP-dU2XKN{r2Tc5P$Fb6-zd|_KDmgMSX=mepL8ijPmUc-!Uc}6EE!)%Nsihj0*FU<4N zVKt{JxO$3#S)ydIn)GE4w7Ko{bbiYG41CzDo6xWjYFGMGvq^%g3j5>aTww!=}xY0bua%s}$SC%vTu=b4iJ9Bq@7AoU`osMCdke z9;p|pG5+i2hN(Lear08Ubev^~gRL3A=JOja5d|@i#B{=X&7XE?xnt(dOb(WWUx1e0c!E&AMkd*B)Vf>8GY4Kn8>-(=xiQb=fhJX3 zwI2WC0CXy{VYO=l629pNj*V&B3g+fGV4h z2O9qJPE+dFtm$E}F@^ewX-;EBbThC9=C*;GB4;c;TSMXA6PeAPWQqzEYb#XL$Mf;%rk9K z$Va>g%q>It{E}}z{{7r+Gy{l7emp09cySes6=bINp6K`hwO*_YdlCFrc>c`-9W)i> z06ywv%oopq1&LiO$Z4e%DhWrqRh%g?l~s5<&Y0i}O{OpZBiNm%zmd393s?`IZnK&I~gEt*cA9))WX6fr*gjbQSY?;2%;4Ar{ zv*&%8r_=%&R?n`)vvHc0uJ$uP_afy3I?waI6jUxOvtTDFPTA2=W1TYR zV)m?ck&WeR502?Lsq)>t3{l`fw1s@N(Qy}^2Q^5xKn=AnE^D8=3Qd1~BCJXLBCIQb4+ z$afv~{+8O*zsC05`)%T`tQ>6(qmi?a%pR@)-RBovMm>b|)o!~& zo?@rWxXe{s%JP4|H2;nu%nhGLh4;1G)1*c%1{0@Q(Mzds#7w+hH1x~6IqB&ykqiGr z7JUBg&e|C|9I@b6tN;5i>R)f^l?(q%+Nq=#@V>A&5j!6e<6gw`!^$Y`4t$g=Oi59E z$e`Q$r9`vZL{wP{2O6f?`(Fo+7wZD&n-`HLdH{ZRUq*2wCE=L+P<`cMLv|#$kFzEH zN@h=sB5~;(yMMdij}Gv=EUre zBl7P6=A^u`4vIF&M#@V5i8wbQj(&zS&NebViIzzQm*m4f1jE;19(e>7T>0=#2(QX1q5dx zC1xOWMU)z=&WWYpPA|$)mgAP)h$X2B^8#6-jDLDac|p3vcMgt-QgzIE5H5Q8s_ z3BaY|Nxv<0JGLN(I%+j|jCYke#N`w_J}-?5aA5=prEXmwi`5SE&iI4>8mMicXm!vM zWNwZiJqr35I=#1%>nyV*tF@ONIw%|w%#UF?v%R!5u&vr$z)MfC zp#oIDe9HMS_V|YEcxHeDEvUk_V!^M%l!sqdv}=Jlw_t-=9iu~!Q(E#divjukWX+zI zZlXqj)Rqx&uFfiWmzVo>gx%#6`t&Xi&@cxPUK}${SFdaO-7YrPi%@IC+b>={{Tb;B zH4BmSxVE8+UTa1OkJ zGKQ{=El%8=?hpgg;}Zp;nxFq*>M4wi5L6xZ91ssbck)j%5rOjGSsp5g(;Ma9^Q#3U0xmJi)jC$ z64TQi=e1ZqtI8lv2-X@U15dyMuDrd`<9IF zjE{?OeblL7zzsa}-?vakT5`Yz#a-t79`Z>IS! zyEVfS=gzBiGp_#{Q6Z8*FPPOxN`-s9`j$K=2 zP@-=?U1u}QTKYkraC3s^Dh5-krO#N{GkRIj7BsqCM%f{QtmZ5K&26EsC6LQnlkti; z!!@nu_=kJ?ARD*Y3d4(0M`TgCM&r3?4X<_4EQe6?eT>sBf3xwMHztn%3J-zm+B+5g z|^JbUo9DkLA-HO6;Ucp|3KZ6M)KPG@n3V7nk)ZSI*3$+*| zL(mYau~~;+_c`VMfhp{*`FcBa(yg)f@Q}Z(*ydyj+C;6D2(gF>s z&2-h1q&@WKXZwBT-wm}^^ZGNnlN%Ge7W;f%%gw$rG#CF{=!QFb^IoMKo{BD2A*H+x z8&3b(y{P$R=ubquZ#D{7XUC*w&Pfr>9;JeRpiD#uA3j_%1GaGIg%(Cp+!oP@#<*N1 z_tZD+8pGSGa#=GC*|$PVea4mf)9g@U1I4lV@j!Re3N&0I0PK5o$Ou(Ls6)$xiW7WQ zoLbul*DI{DME>1k%y4c`%@z(S=kO30@m?PMwtQ7u{!s_>9^GZMHU_%6@rN)z1_l_g z-goGZ=XI}9_pNVTuAi2hr+#`c{cf$eKA<{=7{GTTy@+AndEtT!`Xvtz%Q)sj?~YY&*_;nRc&It7j2XsaN+4LpF@ z&C{!(So=s~Ak71kUmy*?{5!)DjHz5ZavYW8Bl+&W&ysIfGG6o$O!ORj4Yc*_fZOKa zi@)l`ZVur7O(uk!9v<2?p531;(J{BeVv?)Ip3fBul4ylLQfyuqwELGv;@<;Ee}pb` zQRKFneORB-X8fl!Hq0T?`i8C}Pm3aqr- zwt2xN{idkcB5vi{1hbK6dVLcaiUqM$Pdy$L!B<=8h0$x!gaP4LzJ4~6wQHB2G}u42 zo`WXEvKSPtbG+2rtxGYH>wa^eKXX+`15wXA#bzKa4%iQ!eQF4BB1J=@x)}92U#V}5 z81yMiwi;d&luRX>KTdE;np2W*K2-znFS9_H1LWSe(nFK|oHhUGfj6JES{VK?6c z9rlcaru>HVuu09mle$U%J4xtgq;Y`c?z_8o`-DlB@_FqVVfm_1+liTlKh>u3!=xMU zFMl=>Pf0`l90}alTqdloLT0^qL#mD^pKv6TiKf_>)&NqgsxYq0%fTj{9?34yVxm!TL%oqF7G30Xu?PVX%_ zT=Eh-{{1H^g_FUryAuYLgH1cwdg7@HO=?a!A3+*JG?){L#7t9!`=n>!Ra6*$2gryX zO@~`S1Y*{7hWcs~21bup@d7!yZ&u!wvh^tNMM$1?N>5U-R%Zm7L=VLQcknjS9qRT& z2*@#uW|i6>9yc!RcXIONu(xVE;T%t+u!?RpWJ7HlV<6bNz`4~|W>IDXy_lkl6pE3q z@=F%#_SpM!`FGvkC*kWUM3gU|qI?eU++*69(YwBKNOPD0=l`BimE;GRFlf2mozIQ* z#-x2CX{n0yQBxv zAvC_lX8+C1tNWga+%)fO5V)+eQVnEH{!2=8huGdzJId6CiY z-^Q|41)+406)S}V+k*PAVt_%Hs9*ZuibXI? z5GPzzt8VxJIwQEbUg&=jb+h7smuKb{qe}}G@=EPb>(v8z3k}*aNmLQ`^|3OI{_nwQ zgUgub_v7W5fE!4!t=3F>`U&U5cMe@~mik2o>E1-js?k`V>dRP8;dHsd0Cy~#D03LD8oI$dv$ly=d{4==t~?&nsKi= zj6{(Yb*2D&Lihz+B$|QP(sj`=Kt(PX9BIsR~iVAZUlNbhx0zn%R4 zTLoFmLa!iG>Us9d&>bJ}Vh6A)ts!(0*tXXbGrS9Ii_bVM|0*2kx&9FKMJMl8^pbjz z@EP{pPm~P!g7EivuXB({8@Pp)9;P(W^eL2G45)YvQD0_$!JG3sF{#BdHMVSaupQ9> zl5DgxgC(2JT+}zWT_vZBo^s0IObMSlG~rd0x2o2jSs>f%+qN4mHs9xp4T{vl*nTbZ zJF3;hcQ?)b?&9nr!aJd+8t4`)U7^db5<)mWNlCjN69#3=ju^7tW5al__cjv2Kplm6 ziKij6P(9`0_AYu1P04Z4vpFa3E9XpCIeJmLeTv4sX}*uNXgr<=CK~zQTgc!rAp`L)1a^)Rz*2xQ2mygJ zdID_M*zvcEW7wNn#w@pmA$Va84p@^1UrY(7hDq_35wA`C`hP(X>0}X#tW!5p9AKMV zObe3`$D5{{C<499G}8AH21aT3bS;D~;YaDyMlP8MMFzR?WQ`ZWuA&&iars0UdT%h~ zLT;$wM^`|4M#j)Gv((I}hpS$!ST1@j;+K-YhJR~2Vs(UF4c1&lKvvYY7;`#m%AdXH z;M0-{`%3vH{ne!DRe^MblmME?(Q@ur;uUmL#enzv!#`c3k)-gSsWyJQDUKBw9aldi zY*Gf5;Y6@+6^KNc_6z^|p^3ni6LgCJu&HXBq7R*eNN@K*x70{gMf(c5nG=;!cCK?j zKZPP08HchTnEL2}A~!O_DntK*A?(8lH6Nk`?0``tO&RIsRv_8bj>n@%$;xInr;Sqs z!X-OCp1VYQe=)euB3*)E!M)sosr$4Cs(Yz<$SwQ$I@*Y6_1`-!t%#Bmm(xT|Joq=K zqM2F$yx3BMYat?`H()U>Pt0*gJIt<5;7wy7U-+TJ^lho_|CVYf)64!=!kDAvC5~~Z zBz}+1yseVOBCEvNQ`)8C7fk!0O)$M#>K8Xo$_ zHu&Z!IQzE^@j-f^`CvIa~3>~oVO zEv13Rq^@ePa%@ZHiDA~%dzSr%bKy1Eo^8@^=V~pQPT3Om4=P8yxf(*fPSNXUp ztf#mT?cE(SI$0J=6#+I{UBx7m-W3pmOm*+qqK(h1N~pAO9Mt+^K3r7W-|VWf{XtCB z+=ymcRE#VIHNzh`(@y0v?efh3MCa4e=t5~1y(I|%mc;^1pMD)2nAX|$9YrVm@@W3D zy0UDa>`!uUZF{y=6c%Q3!{uu3$21WJLpp*TI*itFypl50N7EwNk0C*H5SK;lvv=UJSYnSOO2W4#dx6NdSzQ>Sf*`M_9 z6B2Aj8rO<)(`ZDi8Jw5`#(&D!BlBaNWvPXEwu+#zLaTUQfKd@phxBHeW&SAd9PJtz zm!TK`JT1pxIM?rg!aFnMiQYPYl+Yjl$^M54ZJCP0MrN)7E_`%&OOT|F6$TjXomj;7 z>FFg*b!%C3H*P&O-?{VP{KSi58kR};bYozcc!RU!xe$XbV~)FWfZj1C%P8T+1%z1| zHcXcpM#|RJP43z?yc!>m_d@Y*!@ei6t5%Oym>YgoPh6-}FHbPcoOZtwYh84qMsvY7 zMsLXqF04(N*Rrr$^p#if56vG;aZEU^pyYG@j*0xJZX~ls_*xEZS2d~E4@irOiAg+1 zcl9SooZL_cf+TUrJ^thWOR@i1<(I|O8|WHXbljY6YC9tSsGx4XVl=6zc>uEvK7ViM zKM12UF4Ifjc2bwft)(Rn$`4BQ78*O5v!-s#H^ifY>1IlBcSIhi{ zVy~z!6H0HYwnt|M5cK<_n6A3Ri)M-LuJhCy#p2H*4F5VtT*0VM;~UXjZZjUQvA`w$ zp|d~gmFumu#FeLZI8KIm8|l6XO(_YHW{6-xg~PaVDdC%-k2C;v*uzKp;yQDSFK@`B z0+yrp!6!GgW!}u8vQhp+cv*7$s64!`gRbEA3;CZ*(s}j3GaE?B#Qg@niGiV&2ce~sb&1GqqSyU zRp{rET_&^;ExL-iG|3A6fOVe{@(Q?(#;DxAdvWqhe>0Nfq{6UzPKqhuDA$B#0YlDL zMr$uDcQAnj4RFO^tO=C?nUNT&s-V_dj?kLx+sQvtB;&th6{uZ*xQj7oyUf+Qq*;aQknd6s zqQW^XZ)7gd9q zsZNSHym;;lW4sD_wR2et&3|8BSD|6Ia7kM&79ezgtQF0IyX(r3p8oBkpJEezQJd6t z;nVEcryuMWp5!W*f{m6KJ}fK(tFL^bvVU0M=4bbek+-J_e>3bEckK%1kt7)}dmUF| zziCTH2X3|kTwmh;cK)2%)9N^$vMeqiJni^$S%alj(W<_|$Ng6d92#@G(*0KIUa5)R z=7^}K%F|0ITMW_%xdFRR8_TB~13z6>disjB4Ih{N$oc;k%Rr^;wap(+I~;0xUms#w7vwz)i{NCE>!ZIRWid^L3_Q}N+!HG|iBr{rWYzxF= zd>}iz2<7R4?p0V+r0_vaKnlI%QyQZwyRqK>mzA|uTfgTg!?nz=_gAqD^r6iW19ngE zJ^QQY>(G*}Zwc?Qr5X3TCM>%nmM-9gNVM-9C)^y>w3C)ut|kF>7B$Asa;^UFKL$4( zVhs19cT|f#2Vk_3TmfYq>)@9xH-Wt`|8rkrpr zXzut#()&--;YBm@kEDXwPAA{=y)B&kPws+Gr+c)kP&Vmkk>HLM&S0K!0~cTJYd!qM zB5l?A&%pWCtCsMajf`Y?%76?P-VB{Smu-&7X7z&9kjFy+#qNA#-xVd#Rl!o?LKDUh zyF?SYGE<(y(||ia8Eylxl=9b7T7q0M0g7-pILqPUl_8v&j_b?Wu5jc2&3U+hZGgp( z=sU=hq{gGb!C3~YYNPKa6yD`k-|?K2ZD!`uqVD}?9$ulVY;p$#Hd)fkPV9ALMcpHo zZksiwbz~anU(%GQTnuqVvk5#BAh+p|mgkF@SXmS~JVEcse+>gf_DtagZpjXgrX!1! ze-(}W4E5zdSH?bO^Fh5I9&32UWevE>V%rsUc*h^0ZSCy1lH(_TD`RDd>d)4f4>@dz zfmCv;I++Xj62Y%dH-n>WznD}9wG@i)ArKvvob{kQ$m%e=Xw^WjM$;1~5)mI$@?E|` zY-QG(>g0y(a)NS3kF%q{ShW4g_=PvBy@txhxJlrj< zPNR*zH#z4^X^$OsU{OIkYub%?VTgduQROa^{-~aX_(sv=EjQ8H_6}R_-7hQ^c+d3; zv|aNZqha}`yUK@%B{z9noo*B?dDK%X$p29Uxs_?E4LvlBQW*H!8@>K_%ed6am#z8nSC>dIU92{G5*8ZbA`(~hZu|dmW zI;v8fCUHZSa;LSq+BG5oHV#zJ%X#U%m(r=p`s|+p< zJMNe*)yaQ`3XrMh(n2(QDNz@2)7P%NECjz z;o(%1?}AK`P@>Wv$*;9{?} zq-UlS!R3BJ0!K2U&o&(QY)ZxQZP6I%OJdwBVUNtt&(ppCY@Z7qmb16FH^DyUJYvZ` zN>?>ts`4a^L8fYxd+bYSumWlMu`QjjqXhw#)Cjo_jZmV8VQ^&R>8>WWG@+xT<5N(l zNqA{Wr%&V>YNK^F1EWc6eccsKF=ok50?-zH1gfs^KgY&u0&8^4i5`o`9F#*-`5Zp+q#5C6(rv31Hcf7rdrs(IP2=2{yV2c-&-jLd7 zN0prW7ewqY`=DLsSyE*Ln;lGG*8%`2%>~u4x_hL-IR7)+*l=Cu_%-2mazQ01q9b}w z`ec@%4Wd1G0;z*Yq3hFx5nqd+599ssq0?=Q;?N$lWs@SknW~(*V~}RWJ3sgR@@JjR zNr1Crt-4_6wMW&j>41Cm%cU^O60Td{J4cPlJDTO6o!Tiis1e9We zPF9ri=iFLX$;-r$9xp`Hiof2wFLi1@7G^`crMrxzjSa(5uPowWY<`}z z9j`PlIR!us&(6}2%5q}*;v3c__dGUNsaMV$#{lI`A(z&11u?BUslkV2 zM`<1AG+`e_x6c0La$@9SjS1Mp17hgk?0r&6>)YfO#*GVY=3ZFm(1Q@w*7j^l2KgV} zffU0o3G<%#k`&ZLVYQllNv;J~otzY$uKvz|7L`Es=DWKG2wF5d1{Ja|m=rBbao|d< z!wl)l4lsV^?WT?zQcerDqi|5xLWlCc%hmXwa~C7`8F=1)Hx>JI5>&vG@yNTeRhthw zJZ5SOmM*Oqc?=7_*y6TEleAzTx@dp?qf8D7Ak6T_SL!@MCMnv7NXiBN+aOK5bw5c{ z3|EdDkj-6i%~&wqyw0oszK3~Fb=hc1wPN5Hx9tXQT4Upk4@Q&FJ*uDtJ_lX@w&343 zs>%mWgx-y5Y=5D-CZ4VP%e4IZsS%_d4}`b1;K&vn$zfZJ-0*|p)qq&gK39FN%7z`HE9r1EPU(9NNQKW>tXdUyfL z4%~eFgl$1#A;Z4Z{ElX)(M^V%5<3k*yiJ_`F0#e{j)^2&5f;3^%wNTFnP08BAP+sF z{ah?UcT;7-L?RnitHZwCo*(0X*iPC|z(WSjEn8Udc&vart!WKj}%?xS4U0}!jS@n%1Cc(1cBx=ac*XC*exoKMkHwQ#BoPecn8K=g$P~IMm4$U9) zHpY_5*3aAmhZqNr1}c^e6;ZW?ib?HfWu_=!O1C>&KH9OM>^qiF^&sE9novhIIBo*s!E5a{aNNdqUHDy zO~vS%DCgKFqu)OO;YdHxQ*-=oY(;4W98w&(;^*R0D^KzJr!EDXm?xh=o%`#5CpMsN z`uwdDH-@wwo%HQU?{NB){+;qM$SwVmZJ4E(8yYh+&+eF?YW(tWm*I7?+^SI5K>ebqEk~Axj$gAeY0qaJv14Fwy zy#xVr|Grgd{`82lSG1IY=5oCM$L{VqMa{8W=Lfm%tNvaD?n)aiU;gi)7fFllV!L5v zl8BHSv*U?00WM>eUsL8H{xQZ7P3M+=FdZ(pMipeROncDWXIN4d>AWcoi9qjA1a-~i zOg;DxOjNs#fxg-4Ka3p|S5}<8Tjxsw4m2#{oCjer6Z6sgK44senz)eXwoQM*0~7zh z_%*wyT;45f>R;6BuqMyN{0IBznnNa6Xp0#DBAv$ScX!X@&riNJs}mSPZ~J)gH;vP< zhY;wD(yzz9L+{y+oPi-X%L#tlt@aNX9?tC^Mv5yb=-^8QN{^}1#42|@FUn?Yq-ZzK z+i8RgXdNa{qZ!!20By%$ZFwvOyX1*MHq(b*;YrpWV*iKinIN+FYSM^Hb?&XWEytZ) z-BvfcZN4ICgM&9L4+bmlC1Hnn$7%R}WS05J5ZPz3Xy1;mb;v9kGrv(oJ&x-v3 zs<4r#NTm=lW(YPlNEW)Pzc*KQn|@tB_F?6W+WBGp-sB!PJkA%{sT+A26w24Un~8Q$ zaj5~OOxuig5|F#ZSG%sOu%#g-g6Q9f|JglOcoKZQPWjfkMOoi7i}Q%NE_mqS13Pgn zXoxlUaEb?tx;W`KYcb)59dpwJZI2Ryx#z)yEzJLYC3(aRJT3o3c!__Rm(Q`0DdNVA zWsU Date: Wed, 23 Sep 2020 11:41:26 +0200 Subject: [PATCH 014/157] GetProject endpoints now also return project icon --- API/Resources/ProjectResultResource.cs | 4 ++++ Repositories/ProjectRepository.cs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/API/Resources/ProjectResultResource.cs b/API/Resources/ProjectResultResource.cs index 1ace8100..12db64d4 100644 --- a/API/Resources/ProjectResultResource.cs +++ b/API/Resources/ProjectResultResource.cs @@ -55,6 +55,10 @@ public class ProjectResultResource /// Get or Set the owner of the project /// public LimitedUserResourceResult User { get; set; } + /// + /// This gets or set the file of the project + /// + public FileResourceResult ProjectIcon { get; set; } } } diff --git a/Repositories/ProjectRepository.cs b/Repositories/ProjectRepository.cs index b57c8f48..140a4405 100644 --- a/Repositories/ProjectRepository.cs +++ b/Repositories/ProjectRepository.cs @@ -16,6 +16,7 @@ */ using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query; using Models; using Models.Defaults; using Repositories.Base; @@ -183,7 +184,8 @@ public virtual async Task> GetAllWithUsersAsync( ) { IQueryable queryable = DbSet - .Include(p => p.User); + .Include(p => p.User) + .Include(p => p.ProjectIcon); queryable = ApplyFilters(queryable, skip, take, orderBy, orderByAsc, highlighted); List projects = await queryable.ToListAsync(); @@ -270,6 +272,7 @@ public async Task FindWithUserAndCollaboratorsAsync(int id) Project project = await GetDbSet() .Include(p => p.User) .Include(p => p.Collaborators) + .Include(p => p.ProjectIcon) .Where(p => p.Id == id) .FirstOrDefaultAsync(); From a8ad52a461b5c845b75b049025e624a5c3a9c267 Mon Sep 17 00:00:00 2001 From: I380210 Date: Thu, 24 Sep 2020 09:46:15 +0200 Subject: [PATCH 015/157] Created mapping for returning user followed projects. --- API/Configuration/MappingProfile.cs | 8 +++++++- .../UserFollowedProjectResourceResult.cs | 16 ++++++++++++++++ Models/UserFollowedProject.cs | 1 - 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 API/Resources/UserFollowedProjectResourceResult.cs diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 3cb31569..ccc49bcf 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -31,8 +31,14 @@ public class MappingProfile : Profile /// public MappingProfile() { - CreateMap(); + CreateMap() + .ForMember(q => q.UserFollowedProjects, options => options.MapFrom(q => q.Project.Name)) + .ForAllOtherMembers(o => o.Ignore()); + CreateMap(); + + CreateMap(); + CreateMap(); CreateMap(); diff --git a/API/Resources/UserFollowedProjectResourceResult.cs b/API/Resources/UserFollowedProjectResourceResult.cs new file mode 100644 index 00000000..a2324c2e --- /dev/null +++ b/API/Resources/UserFollowedProjectResourceResult.cs @@ -0,0 +1,16 @@ +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + public class UserFollowedProjectResourceResult + { + public int Id { get; set; } + public Project Project { get; set; } + public User User { get; set; } + public int UserId { get; set; } + } +} diff --git a/Models/UserFollowedProject.cs b/Models/UserFollowedProject.cs index f41d6d93..5865ecf5 100644 --- a/Models/UserFollowedProject.cs +++ b/Models/UserFollowedProject.cs @@ -10,7 +10,6 @@ public class UserFollowedProject public Project Project { get; set; } public User User{ get; set; } public int UserId { get; set; } - } From d454f9916de14c58d995c635fd7263e8af6e0ff7 Mon Sep 17 00:00:00 2001 From: Dave Bouman Date: Thu, 24 Sep 2020 14:16:43 +0200 Subject: [PATCH 016/157] Created repository/controller/service for following projects --- API/Controllers/UserController.cs | 13 +++++++- API/Resources/UserFollowedProjectResource.cs | 32 +++++++++++++++++++ Repositories/UserFollowedProjectRepository.cs | 20 ++++++++++++ .../Services/UserFollowedProjectService.cs | 30 +++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 API/Resources/UserFollowedProjectResource.cs create mode 100644 Repositories/UserFollowedProjectRepository.cs create mode 100644 Services/Services/UserFollowedProjectService.cs diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index ef69c0fd..2319db9a 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -41,6 +41,7 @@ public class UserController : ControllerBase private readonly IMapper mapper; private readonly IUserService userService; private readonly IRoleService roleService; + private readonly IUserFollowedProjectService userFollowedProjectService; /// /// Initializes a new instance of the class. @@ -48,11 +49,12 @@ public class UserController : ControllerBase /// The user service. /// The mapper. /// The role service. - public UserController(IUserService userService, IMapper mapper, IRoleService roleService) + public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserFollowedProjectService userFollowedProjectService) { this.userService = userService; this.mapper = mapper; this.roleService = roleService; + this.userFollowedProjectService = userFollowedProjectService; } /// @@ -216,6 +218,15 @@ public async Task DeleteAccount() return Ok(); } + [HttpPost("follow/{projectId}")] + [Authorize] + public async Task FollowProject([FromBody]UserFollowedProject project) + { + userFollowedProjectService.Add(project); + + return Ok(); + } + /// /// Delete the user account. /// diff --git a/API/Resources/UserFollowedProjectResource.cs b/API/Resources/UserFollowedProjectResource.cs new file mode 100644 index 00000000..92010fce --- /dev/null +++ b/API/Resources/UserFollowedProjectResource.cs @@ -0,0 +1,32 @@ +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + /// + /// The view model result of UserFollowedProject + /// + public class UserFollowedProjectResource + { + /// + /// Get or Set Id of a UserFollowedProject Resource Result + /// + public int Id { get; set; } + /// + /// This gets or sets the project + /// + public Project Project { get; set; } + + /// + /// This gets or sets the user + /// + public User User { get; set; } + /// + /// This gets or sets the userid + /// + public int UserId { get; set; } + } +} diff --git a/Repositories/UserFollowedProjectRepository.cs b/Repositories/UserFollowedProjectRepository.cs new file mode 100644 index 00000000..354a5326 --- /dev/null +++ b/Repositories/UserFollowedProjectRepository.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using Models; +using Repositories.Base; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Repositories +{ + public interface IUserFollowedProjectRepository + { + void Add(UserFollowedProject entity); + } + + + public class UserFollowedProjectRepository : Repository + { + public UserFollowedProjectRepository(DbContext dbContext) : base(dbContext) { } + } +} diff --git a/Services/Services/UserFollowedProjectService.cs b/Services/Services/UserFollowedProjectService.cs new file mode 100644 index 00000000..c8fb66aa --- /dev/null +++ b/Services/Services/UserFollowedProjectService.cs @@ -0,0 +1,30 @@ +using Models; +using Repositories; +using Services.Base; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Services.Services +{ + public interface IUserFollowedProjectService : IService + { + + + + } + + public class UserFollowedProjectProjectService : Service + { + protected new IUserFollowedProjectRepository Repository => (IUserFollowedProjectRepository) base.Repository; + + public UserFollowedProjectProjectService(UserFollowedProjectRepository repository) : base(repository) { } + + private void Add(UserFollowedProject entity) + { + Repository.Add(entity); + } + + } + +} From 2ea8500abe8819303c030bc7b847358ed27c40e1 Mon Sep 17 00:00:00 2001 From: I380210 Date: Thu, 24 Sep 2020 15:18:21 +0200 Subject: [PATCH 017/157] Added UserFollowedProject service, added end point to follow new project. --- API/Controllers/UserController.cs | 11 +++- Models/UserFollowedProject.cs | 6 ++ Repositories/UserFollowedProjectRepository.cs | 8 ++- .../Services/UserFollowedProjectService.cs | 63 ++++++++++++++++--- 4 files changed, 76 insertions(+), 12 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 2319db9a..f461f0e1 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -41,6 +41,7 @@ public class UserController : ControllerBase private readonly IMapper mapper; private readonly IUserService userService; private readonly IRoleService roleService; + private readonly IProjectService projectService; private readonly IUserFollowedProjectService userFollowedProjectService; /// @@ -49,11 +50,12 @@ public class UserController : ControllerBase /// The user service. /// The mapper. /// The role service. - public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserFollowedProjectService userFollowedProjectService) + public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserFollowedProjectService userFollowedProjectService,IProjectService projectService) { this.userService = userService; this.mapper = mapper; this.roleService = roleService; + this.projectService = projectService; this.userFollowedProjectService = userFollowedProjectService; } @@ -220,9 +222,12 @@ public async Task DeleteAccount() [HttpPost("follow/{projectId}")] [Authorize] - public async Task FollowProject([FromBody]UserFollowedProject project) + public async Task FollowProject([FromBody]int userId,int projectId) { - userFollowedProjectService.Add(project); + User user = await userService.FindAsync(userId); + Project project = await projectService.FindAsync(projectId); + UserFollowedProject userFollowedProject = new UserFollowedProject(project, user); + userFollowedProjectService.Add(userFollowedProject); return Ok(); } diff --git a/Models/UserFollowedProject.cs b/Models/UserFollowedProject.cs index 5865ecf5..6eb11771 100644 --- a/Models/UserFollowedProject.cs +++ b/Models/UserFollowedProject.cs @@ -6,6 +6,12 @@ namespace Models { public class UserFollowedProject { + public UserFollowedProject(Project project, User user) + { + Project = project; + User = user; + } + public int Id { get; set; } public Project Project { get; set; } public User User{ get; set; } diff --git a/Repositories/UserFollowedProjectRepository.cs b/Repositories/UserFollowedProjectRepository.cs index 354a5326..fc936639 100644 --- a/Repositories/UserFollowedProjectRepository.cs +++ b/Repositories/UserFollowedProjectRepository.cs @@ -13,8 +13,14 @@ public interface IUserFollowedProjectRepository } - public class UserFollowedProjectRepository : Repository + public class UserFollowedProjectRepository : Repository,IUserFollowedProjectRepository { public UserFollowedProjectRepository(DbContext dbContext) : base(dbContext) { } + + public void Add(UserFollowedProject followedProject) + { + //TODO: Specify DB set + DbContext.Add(followedProject); + } } } diff --git a/Services/Services/UserFollowedProjectService.cs b/Services/Services/UserFollowedProjectService.cs index c8fb66aa..89b56b21 100644 --- a/Services/Services/UserFollowedProjectService.cs +++ b/Services/Services/UserFollowedProjectService.cs @@ -4,27 +4,74 @@ using System; using System.Collections.Generic; using System.Text; +using System.Threading.Tasks; namespace Services.Services { public interface IUserFollowedProjectService : IService { + void SaveFollowedProjectAsync(int userId,int projectId); + } + + public class UserFollowedProjectProjectService : Service,IUserFollowedProjectService + { + private readonly UserRepository userRepository; + private readonly ProjectRepository projectRepository; + + public UserFollowedProjectProjectService(UserFollowedProjectRepository repository,UserRepository userRepository,ProjectRepository projectRepository) : base(repository) { + this.userRepository = userRepository; + this.projectRepository = projectRepository; + + } + protected new IUserFollowedProjectRepository userFollowedProjectRepository => (IUserFollowedProjectRepository) base.Repository; - } + public async void Add(UserFollowedProject userFollowed) + { + userFollowedProjectRepository.Add(userFollowed); + } - public class UserFollowedProjectProjectService : Service - { - protected new IUserFollowedProjectRepository Repository => (IUserFollowedProjectRepository) base.Repository; + public Task AddAsync(UserFollowedProject entity) + { + throw new NotImplementedException(); + } + + public void AddRange(IEnumerable entities) + { + throw new NotImplementedException(); + } - public UserFollowedProjectProjectService(UserFollowedProjectRepository repository) : base(repository) { } + public void Remove(UserFollowedProject entity) + { + throw new NotImplementedException(); + } + + public async void SaveFollowedProjectAsync(int userId,int projectId) + { + User user = await userRepository.FindAsync(userId); + Project project = await projectRepository.FindAsync(projectId); + UserFollowedProject followedProject = new UserFollowedProject(project,user); + + userFollowedProjectRepository.Add(followedProject); + } + + public void Update(UserFollowedProject entity) + { + throw new NotImplementedException(); + } - private void Add(UserFollowedProject entity) + Task IService.FindAsync(int id) { - Repository.Add(entity); + throw new NotImplementedException(); } + Task> IService.GetAll() + { + throw new NotImplementedException(); + } } -} + } + + From 3d40d8397b7a459e4ea4655b90d727ac1d25679a Mon Sep 17 00:00:00 2001 From: I380210 Date: Thu, 24 Sep 2020 15:40:29 +0200 Subject: [PATCH 018/157] Injected IUserFollowedProjects in startup.cs --- .../DependencyInjectionExtensions.cs | 2 + ...structorForUserFollowedProject.Designer.cs | 302 ++++++++++++++++++ ..._AddedConstructorForUserFollowedProject.cs | 17 + Models/UserFollowedProject.cs | 5 + .../Services/UserFollowedProjectService.cs | 8 +- 5 files changed, 331 insertions(+), 3 deletions(-) create mode 100644 Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs create mode 100644 Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index c11b181c..78113661 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -64,6 +64,8 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + return services; } } diff --git a/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs b/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs new file mode 100644 index 00000000..d5d87dbd --- /dev/null +++ b/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs @@ -0,0 +1,302 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200924132339_AddedConstructorForUserFollowedProject")] + partial class AddedConstructorForUserFollowedProject + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFollowedProjects"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserFollowedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserFollowedProjects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs b/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs new file mode 100644 index 00000000..8a8a9d67 --- /dev/null +++ b/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class AddedConstructorForUserFollowedProject : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Models/UserFollowedProject.cs b/Models/UserFollowedProject.cs index 6eb11771..2686fddc 100644 --- a/Models/UserFollowedProject.cs +++ b/Models/UserFollowedProject.cs @@ -12,6 +12,11 @@ public UserFollowedProject(Project project, User user) User = user; } + public UserFollowedProject() + { + + } + public int Id { get; set; } public Project Project { get; set; } public User User{ get; set; } diff --git a/Services/Services/UserFollowedProjectService.cs b/Services/Services/UserFollowedProjectService.cs index 89b56b21..44f034f6 100644 --- a/Services/Services/UserFollowedProjectService.cs +++ b/Services/Services/UserFollowedProjectService.cs @@ -15,17 +15,19 @@ public interface IUserFollowedProjectService : IService public class UserFollowedProjectProjectService : Service,IUserFollowedProjectService { - private readonly UserRepository userRepository; - private readonly ProjectRepository projectRepository; + private readonly IUserRepository userRepository; + private readonly IProjectRepository projectRepository; + private readonly UserFollowedProjectRepository userFollowedProjectRepository; public UserFollowedProjectProjectService(UserFollowedProjectRepository repository,UserRepository userRepository,ProjectRepository projectRepository) : base(repository) { this.userRepository = userRepository; this.projectRepository = projectRepository; + this.userFollowedProjectRepository = repository; } - protected new IUserFollowedProjectRepository userFollowedProjectRepository => (IUserFollowedProjectRepository) base.Repository; + // protected new IUserFollowedProjectRepository userFollowedProjectRepository => (IUserFollowedProjectRepository) base.Repository; public async void Add(UserFollowedProject userFollowed) { From 828e142a2de1f13301079bbd900fe8b44468c5b6 Mon Sep 17 00:00:00 2001 From: I380210 Date: Thu, 24 Sep 2020 19:18:32 +0200 Subject: [PATCH 019/157] Added UserFollowedProjectRepository to DI system --- API/Controllers/UserController.cs | 1 + API/Extensions/DependencyInjectionExtensions.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index f461f0e1..a6bbeccf 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -229,6 +229,7 @@ public async Task FollowProject([FromBody]int userId,int projectI UserFollowedProject userFollowedProject = new UserFollowedProject(project, user); userFollowedProjectService.Add(userFollowedProject); + userFollowedProjectService.Save(); return Ok(); } diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 78113661..1310133c 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -65,6 +65,7 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); return services; } From 16ea14ed87f1391c4597bc675883ea497f5ad05c Mon Sep 17 00:00:00 2001 From: I380210 Date: Thu, 24 Sep 2020 19:52:18 +0200 Subject: [PATCH 020/157] added IRepo props to service --- Services/Services/UserFollowedProjectService.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Services/Services/UserFollowedProjectService.cs b/Services/Services/UserFollowedProjectService.cs index 44f034f6..fd1a5e6e 100644 --- a/Services/Services/UserFollowedProjectService.cs +++ b/Services/Services/UserFollowedProjectService.cs @@ -19,15 +19,13 @@ public class UserFollowedProjectProjectService : Service (IUserFollowedProjectRepository) base.Repository; + protected new IProjectRepository Project => (IProjectRepository) base.Repository; + protected new IUserFollowedProjectRepository UserFollowedProjectRepository => (IUserFollowedProjectRepository) base.Repository; + protected new IUserRepository UserRepository => (IUserRepository) base.Repository; public async void Add(UserFollowedProject userFollowed) { From 3f8359a0a4b19c325c3ee35d60cfdc06f63b4af4 Mon Sep 17 00:00:00 2001 From: Mees van Straten <41986758+MeesvanStraten@users.noreply.github.com> Date: Fri, 25 Sep 2020 10:45:38 +0200 Subject: [PATCH 021/157] Renamed UserFollowedProject to UserProject Changed names to be in line with naming convention. --- API/Configuration/MappingProfile.cs | 4 +- API/Controllers/UserController.cs | 16 +- .../DependencyInjectionExtensions.cs | 4 +- ...jectResource.cs => UserProjectResource.cs} | 6 +- ...Result.cs => UserProjectResourceResult.cs} | 2 +- API/Resources/UserResourceResult.cs | 2 +- Data/ApplicationDbContext.cs | 2 +- ...FollowedProjectsToUserProjects.Designer.cs | 302 ++++++++++++++++++ ...namedUserFollowedProjectsToUserProjects.cs | 91 ++++++ ...UserProjectsTableToUserProject.Designer.cs | 302 ++++++++++++++++++ ...52_ChangeUserProjectsTableToUserProject.cs | 107 +++++++ .../ApplicationDbContextModelSnapshot.cs | 8 +- Models/User.cs | 4 +- Models/UserFollowedProject.cs | 27 -- Models/UserProject.cs | 20 +- Repositories/UserFollowedProjectRepository.cs | 26 -- Repositories/UserProjectRepository.cs | 95 ++++++ Repositories/UserRepository.cs | 6 +- .../Services/UserFollowedProjectService.cs | 77 ----- Services/Services/UserProjectService.cs | 128 ++++++++ 20 files changed, 1069 insertions(+), 160 deletions(-) rename API/Resources/{UserFollowedProjectResource.cs => UserProjectResource.cs} (79%) rename API/Resources/{UserFollowedProjectResourceResult.cs => UserProjectResourceResult.cs} (85%) create mode 100644 Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs create mode 100644 Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs create mode 100644 Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs create mode 100644 Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs delete mode 100644 Models/UserFollowedProject.cs delete mode 100644 Repositories/UserFollowedProjectRepository.cs create mode 100644 Repositories/UserProjectRepository.cs delete mode 100644 Services/Services/UserFollowedProjectService.cs create mode 100644 Services/Services/UserProjectService.cs diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index ccc49bcf..7d04097b 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -31,8 +31,8 @@ public class MappingProfile : Profile /// public MappingProfile() { - CreateMap() - .ForMember(q => q.UserFollowedProjects, options => options.MapFrom(q => q.Project.Name)) + CreateMap() + .ForMember(q => q.UserProjects, options => options.MapFrom(q => q.Project.Name)) .ForAllOtherMembers(o => o.Ignore()); CreateMap(); diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index a6bbeccf..98175dd5 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -42,7 +42,7 @@ public class UserController : ControllerBase private readonly IUserService userService; private readonly IRoleService roleService; private readonly IProjectService projectService; - private readonly IUserFollowedProjectService userFollowedProjectService; + private readonly IUserProjectService userProjectService; /// /// Initializes a new instance of the class. @@ -50,13 +50,13 @@ public class UserController : ControllerBase /// The user service. /// The mapper. /// The role service. - public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserFollowedProjectService userFollowedProjectService,IProjectService projectService) + public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserProjectService userProjectService, IProjectService projectService) { this.userService = userService; this.mapper = mapper; this.roleService = roleService; this.projectService = projectService; - this.userFollowedProjectService = userFollowedProjectService; + this.userProjectService = userProjectService; } /// @@ -222,14 +222,14 @@ public async Task DeleteAccount() [HttpPost("follow/{projectId}")] [Authorize] - public async Task FollowProject([FromBody]int userId,int projectId) + public async Task FollowProject(int projectId) { - User user = await userService.FindAsync(userId); + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); Project project = await projectService.FindAsync(projectId); - UserFollowedProject userFollowedProject = new UserFollowedProject(project, user); - userFollowedProjectService.Add(userFollowedProject); + UserProject userProject = new UserProject(project, user); + userProjectService.Add(userProject); - userFollowedProjectService.Save(); + userProjectService.Save(); return Ok(); } diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 1310133c..63087a97 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -64,8 +64,8 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); - services.AddScoped(); - services.AddScoped(); + services.AddScoped(); + services.AddScoped(); return services; } diff --git a/API/Resources/UserFollowedProjectResource.cs b/API/Resources/UserProjectResource.cs similarity index 79% rename from API/Resources/UserFollowedProjectResource.cs rename to API/Resources/UserProjectResource.cs index 92010fce..10977b98 100644 --- a/API/Resources/UserFollowedProjectResource.cs +++ b/API/Resources/UserProjectResource.cs @@ -7,12 +7,12 @@ namespace API.Resources { /// - /// The view model result of UserFollowedProject + /// The view model result of UserProject /// - public class UserFollowedProjectResource + public class UserProjectResource { /// - /// Get or Set Id of a UserFollowedProject Resource Result + /// Get or Set Id of a userProjectService Resource Result /// public int Id { get; set; } /// diff --git a/API/Resources/UserFollowedProjectResourceResult.cs b/API/Resources/UserProjectResourceResult.cs similarity index 85% rename from API/Resources/UserFollowedProjectResourceResult.cs rename to API/Resources/UserProjectResourceResult.cs index a2324c2e..2ddee1a2 100644 --- a/API/Resources/UserFollowedProjectResourceResult.cs +++ b/API/Resources/UserProjectResourceResult.cs @@ -6,7 +6,7 @@ namespace API.Resources { - public class UserFollowedProjectResourceResult + public class UserProjectResourceResult { public int Id { get; set; } public Project Project { get; set; } diff --git a/API/Resources/UserResourceResult.cs b/API/Resources/UserResourceResult.cs index 0bbf5029..cbd86937 100644 --- a/API/Resources/UserResourceResult.cs +++ b/API/Resources/UserResourceResult.cs @@ -63,7 +63,7 @@ public class UserResourceResult /// /// Gets or sets the followed projects for user /// - public List UserFollowedProjects { get; set; } + public List UserProjects { get; set; } } } diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index 29dee25f..87223e45 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -76,7 +76,7 @@ public ApplicationDbContext(DbContextOptions options) : ba /// public DbSet Role { get; set; } - public DbSet UserFollowedProjects { get; set; } + public DbSet UserProject { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { diff --git a/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs b/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs new file mode 100644 index 00000000..1fe00650 --- /dev/null +++ b/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs @@ -0,0 +1,302 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200925083321_RenamedUserFollowedProjectsToUserProjects")] + partial class RenamedUserFollowedProjectsToUserProjects + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProjects"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProjects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs b/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs new file mode 100644 index 00000000..4fa50ab6 --- /dev/null +++ b/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs @@ -0,0 +1,91 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class RenamedUserFollowedProjectsToUserProjects : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "UserFollowedProjects"); + + migrationBuilder.CreateTable( + name: "UserProjects", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProjectId = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserProjects", x => x.Id); + table.ForeignKey( + name: "FK_UserProjects_Project_ProjectId", + column: x => x.ProjectId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_UserProjects_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_UserProjects_ProjectId", + table: "UserProjects", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_UserProjects_UserId", + table: "UserProjects", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "UserProjects"); + + migrationBuilder.CreateTable( + name: "UserFollowedProjects", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProjectId = table.Column(type: "int", nullable: true), + UserId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserFollowedProjects", x => x.Id); + table.ForeignKey( + name: "FK_UserFollowedProjects_Project_ProjectId", + column: x => x.ProjectId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_UserFollowedProjects_ProjectId", + table: "UserFollowedProjects", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_UserFollowedProjects_UserId", + table: "UserFollowedProjects", + column: "UserId"); + } + } +} diff --git a/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs b/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs new file mode 100644 index 00000000..b1962fca --- /dev/null +++ b/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs @@ -0,0 +1,302 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200925083952_ChangeUserProjectsTableToUserProject")] + partial class ChangeUserProjectsTableToUserProject + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProjects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs b/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs new file mode 100644 index 00000000..453ab937 --- /dev/null +++ b/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs @@ -0,0 +1,107 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class ChangeUserProjectsTableToUserProject : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_UserProjects_Project_ProjectId", + table: "UserProjects"); + + migrationBuilder.DropForeignKey( + name: "FK_UserProjects_User_UserId", + table: "UserProjects"); + + migrationBuilder.DropPrimaryKey( + name: "PK_UserProjects", + table: "UserProjects"); + + migrationBuilder.RenameTable( + name: "UserProjects", + newName: "UserProject"); + + migrationBuilder.RenameIndex( + name: "IX_UserProjects_UserId", + table: "UserProject", + newName: "IX_UserProject_UserId"); + + migrationBuilder.RenameIndex( + name: "IX_UserProjects_ProjectId", + table: "UserProject", + newName: "IX_UserProject_ProjectId"); + + migrationBuilder.AddPrimaryKey( + name: "PK_UserProject", + table: "UserProject", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_UserProject_Project_ProjectId", + table: "UserProject", + column: "ProjectId", + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_UserProject_User_UserId", + table: "UserProject", + column: "UserId", + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_UserProject_Project_ProjectId", + table: "UserProject"); + + migrationBuilder.DropForeignKey( + name: "FK_UserProject_User_UserId", + table: "UserProject"); + + migrationBuilder.DropPrimaryKey( + name: "PK_UserProject", + table: "UserProject"); + + migrationBuilder.RenameTable( + name: "UserProject", + newName: "UserProjects"); + + migrationBuilder.RenameIndex( + name: "IX_UserProject_UserId", + table: "UserProjects", + newName: "IX_UserProjects_UserId"); + + migrationBuilder.RenameIndex( + name: "IX_UserProject_ProjectId", + table: "UserProjects", + newName: "IX_UserProjects_ProjectId"); + + migrationBuilder.AddPrimaryKey( + name: "PK_UserProjects", + table: "UserProjects", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_UserProjects_Project_ProjectId", + table: "UserProjects", + column: "ProjectId", + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_UserProjects_User_UserId", + table: "UserProjects", + column: "UserId", + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 08d73d79..652ff6d5 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -202,7 +202,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("User"); }); - modelBuilder.Entity("Models.UserFollowedProject", b => + modelBuilder.Entity("Models.UserProject", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -221,7 +221,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("UserFollowedProjects"); + b.ToTable("UserProject"); }); modelBuilder.Entity("Models.Collaborator", b => @@ -282,14 +282,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("RoleId"); }); - modelBuilder.Entity("Models.UserFollowedProject", b => + modelBuilder.Entity("Models.UserProject", b => { b.HasOne("Models.Project", "Project") .WithMany() .HasForeignKey("ProjectId"); b.HasOne("Models.User", "User") - .WithMany("UserFollowedProjects") + .WithMany("UserProjects") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); diff --git a/Models/User.cs b/Models/User.cs index d3fc8803..e1380d2a 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -28,7 +28,7 @@ public User() { Projects = new List(); Services = new List(); - UserFollowedProjects = new List(); + UserProjects = new List(); } public int Id { get; set; } @@ -48,7 +48,7 @@ public User() public List Services { get; set; } - public List UserFollowedProjects { get; set; } + public List UserProjects { get; set; } public string ProfileUrl { get; set; } diff --git a/Models/UserFollowedProject.cs b/Models/UserFollowedProject.cs deleted file mode 100644 index 2686fddc..00000000 --- a/Models/UserFollowedProject.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Models -{ - public class UserFollowedProject - { - public UserFollowedProject(Project project, User user) - { - Project = project; - User = user; - } - - public UserFollowedProject() - { - - } - - public int Id { get; set; } - public Project Project { get; set; } - public User User{ get; set; } - public int UserId { get; set; } - } - - -} diff --git a/Models/UserProject.cs b/Models/UserProject.cs index 712856ef..39b088c3 100644 --- a/Models/UserProject.cs +++ b/Models/UserProject.cs @@ -1,13 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Text; + namespace Models { - public class UserProject { + public UserProject(Project project, User user) + { + Project = project; + User = user; + } + + public UserProject() + { + + } - public User User { get; set; } public int Id { get; set; } public Project Project { get; set; } - + public User User{ get; set; } + public int UserId { get; set; } } + } diff --git a/Repositories/UserFollowedProjectRepository.cs b/Repositories/UserFollowedProjectRepository.cs deleted file mode 100644 index fc936639..00000000 --- a/Repositories/UserFollowedProjectRepository.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Models; -using Repositories.Base; -using System; -using System.Collections.Generic; -using System.Text; - -namespace Repositories -{ - public interface IUserFollowedProjectRepository - { - void Add(UserFollowedProject entity); - } - - - public class UserFollowedProjectRepository : Repository,IUserFollowedProjectRepository - { - public UserFollowedProjectRepository(DbContext dbContext) : base(dbContext) { } - - public void Add(UserFollowedProject followedProject) - { - //TODO: Specify DB set - DbContext.Add(followedProject); - } - } -} diff --git a/Repositories/UserProjectRepository.cs b/Repositories/UserProjectRepository.cs new file mode 100644 index 00000000..144dfc68 --- /dev/null +++ b/Repositories/UserProjectRepository.cs @@ -0,0 +1,95 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Microsoft.EntityFrameworkCore; +using Models; +using Models.Defaults; +using Repositories.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; + +namespace Repositories +{ + + public interface IUserProjectRepository : IRepository + { + + Task> GetAllWithUsersAsync( + int? skip = null, + int? take = null, + Expression> orderBy = null, + bool orderByAsc = true, + bool? highlighted = null + ); + + Task CountAsync(bool? highlighted = null); + + Task> SearchAsync( + string query, + int? skip = null, + int? take = null, + Expression> orderBy = null, + bool orderByAsc = true, + bool? highlighted = null + ); + + Task SearchCountAsync(string query, bool? highlighted = null); + + Task FindWithUserAndCollaboratorsAsync(int id); + + } + + public class UserProjectRepository : Repository, IUserProjectRepository + { + + public UserProjectRepository(DbContext dbContext) : base(dbContext) { } + + public void Add(UserProject entity) + { + DbContext.Add(entity); + } + + public Task CountAsync(bool? highlighted = null) + { + throw new NotImplementedException(); + } + + public Task FindWithUserAndCollaboratorsAsync(int id) + { + throw new NotImplementedException(); + } + + public Task> GetAllWithUsersAsync(int? skip = null, int? take = null, Expression> orderBy = null, bool orderByAsc = true, bool? highlighted = null) + { + throw new NotImplementedException(); + } + + public Task> SearchAsync(string query, int? skip = null, int? take = null, Expression> orderBy = null, bool orderByAsc = true, bool? highlighted = null) + { + throw new NotImplementedException(); + } + + public Task SearchCountAsync(string query, bool? highlighted = null) + { + throw new NotImplementedException(); + } + } + +} diff --git a/Repositories/UserRepository.cs b/Repositories/UserRepository.cs index 212f0eb9..bf726bb9 100644 --- a/Repositories/UserRepository.cs +++ b/Repositories/UserRepository.cs @@ -88,7 +88,7 @@ public override async Task FindAsync(int userId) .Where(s => s.Id == userId) .Include(s => s.Role) .ThenInclude(s => s.Scopes) - .Include(f => f.UserFollowedProjects) + .Include(f => f.UserProjects) .SingleOrDefaultAsync(); } /// @@ -102,7 +102,7 @@ public async Task GetUserAsync(int userId) .Where(s => s.Id == userId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) - .Include(f => f.UserFollowedProjects) + .Include(f => f.UserProjects) .SingleOrDefaultAsync(); } /// @@ -116,7 +116,7 @@ public async Task GetUserByIdentityIdAsync(string identityId) .Where(s => s.IdentityId == identityId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) - .Include(f => f.UserFollowedProjects) + .Include(f => f.UserProjects) .SingleOrDefaultAsync(); } diff --git a/Services/Services/UserFollowedProjectService.cs b/Services/Services/UserFollowedProjectService.cs deleted file mode 100644 index fd1a5e6e..00000000 --- a/Services/Services/UserFollowedProjectService.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Models; -using Repositories; -using Services.Base; -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - -namespace Services.Services -{ - public interface IUserFollowedProjectService : IService - { - void SaveFollowedProjectAsync(int userId,int projectId); - } - - public class UserFollowedProjectProjectService : Service,IUserFollowedProjectService - { - private readonly IUserRepository userRepository; - private readonly IProjectRepository projectRepository; - private readonly UserFollowedProjectRepository userFollowedProjectRepository; - - public UserFollowedProjectProjectService(IUserFollowedProjectRepository userFollowedRepository,IUserRepository userRepository,IProjectRepository projectRepository) : base(userFollowedRepository) { - - - } - protected new IProjectRepository Project => (IProjectRepository) base.Repository; - protected new IUserFollowedProjectRepository UserFollowedProjectRepository => (IUserFollowedProjectRepository) base.Repository; - protected new IUserRepository UserRepository => (IUserRepository) base.Repository; - - public async void Add(UserFollowedProject userFollowed) - { - userFollowedProjectRepository.Add(userFollowed); - } - - public Task AddAsync(UserFollowedProject entity) - { - throw new NotImplementedException(); - } - - public void AddRange(IEnumerable entities) - { - throw new NotImplementedException(); - } - - public void Remove(UserFollowedProject entity) - { - throw new NotImplementedException(); - } - - public async void SaveFollowedProjectAsync(int userId,int projectId) - { - User user = await userRepository.FindAsync(userId); - Project project = await projectRepository.FindAsync(projectId); - UserFollowedProject followedProject = new UserFollowedProject(project,user); - - userFollowedProjectRepository.Add(followedProject); - } - - public void Update(UserFollowedProject entity) - { - throw new NotImplementedException(); - } - - Task IService.FindAsync(int id) - { - throw new NotImplementedException(); - } - - Task> IService.GetAll() - { - throw new NotImplementedException(); - } - } - - } - - diff --git a/Services/Services/UserProjectService.cs b/Services/Services/UserProjectService.cs new file mode 100644 index 00000000..9260f203 --- /dev/null +++ b/Services/Services/UserProjectService.cs @@ -0,0 +1,128 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Ganss.XSS; +using Models; +using Repositories; +using Services.Base; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; + +namespace Services.Services +{ + + public interface IUserProjectService : IService + { + void SaveFollowedProjectAsync(int userId, int projectId); + + + /// + /// Get a list of all the projects + /// + /// The parameters to filter, sort and paginate the projects + /// A list of all the projects + Task> GetAllWithUsersAsync(ProjectFilterParams projectFilterParams); + + Task FindWithUserAndCollaboratorsAsync(int id); + + /// + /// Get the number of projects + /// + /// The parameters to filter, sort and paginate the projects + /// The number of projects + Task ProjectsCount(ProjectFilterParams projectFilterParams); + + /// + /// Get the total number of pages for the results + /// + /// The parameters to filter, sort and paginate the projects + /// The total number of pages for the results + Task GetProjectsTotalPages(ProjectFilterParams projectFilterParams); + + } + + public class UserProjectService : Service, IUserProjectService + { + + public UserProjectService(IUserProjectRepository repository) : base(repository) { } + + protected new IUserProjectRepository Repository => (IUserProjectRepository) base.Repository; + + public void Add(UserProject entity) + { + Repository.Add(entity); + } + + public Task AddAsync(UserProject entity) + { + throw new NotImplementedException(); + } + + public void AddRange(IEnumerable entities) + { + throw new NotImplementedException(); + } + + public Task FindWithUserAndCollaboratorsAsync(int id) + { + throw new NotImplementedException(); + } + + public Task> GetAllWithUsersAsync(ProjectFilterParams projectFilterParams) + { + throw new NotImplementedException(); + } + + public Task GetProjectsTotalPages(ProjectFilterParams projectFilterParams) + { + throw new NotImplementedException(); + } + + public Task ProjectsCount(ProjectFilterParams projectFilterParams) + { + throw new NotImplementedException(); + } + + public void Remove(UserProject entity) + { + throw new NotImplementedException(); + } + + public void SaveFollowedProjectAsync(int userId, int projectId) + { + throw new NotImplementedException(); + } + + public void Update(UserProject entity) + { + throw new NotImplementedException(); + } + + Task IService.FindAsync(int id) + { + throw new NotImplementedException(); + } + + Task> IService.GetAll() + { + throw new NotImplementedException(); + } + } + +} From 488a68223c35247dabade418e06d9f48b0fcc094 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Fri, 25 Sep 2020 12:22:29 +0200 Subject: [PATCH 022/157] fixed an issue where updating project did not update the ProjectIcon to null --- Models/Project.cs | 2 ++ Repositories/ProjectRepository.cs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Models/Project.cs b/Models/Project.cs index 92f60576..c23b01a8 100644 --- a/Models/Project.cs +++ b/Models/Project.cs @@ -56,6 +56,8 @@ public Project() [Required] public DateTime Updated { get; set; } + public int? ProjectIconId { get; set; } + public File ProjectIcon { get; set; } } diff --git a/Repositories/ProjectRepository.cs b/Repositories/ProjectRepository.cs index 140a4405..589349b6 100644 --- a/Repositories/ProjectRepository.cs +++ b/Repositories/ProjectRepository.cs @@ -299,6 +299,12 @@ public override void Update(Project entity) } + if(entity.ProjectIcon == null) + { + DbContext.Entry(entity) + .Entity.ProjectIconId = null; + } + DbSet.Update(entity); } From 996017989bf8c6a58ed428c2ce11f400c0739dc2 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Fri, 25 Sep 2020 14:08:05 +0200 Subject: [PATCH 023/157] file is now renamed (filename + upload datetime) before uploading to decrease chance of duplicate filenames --- API/Controllers/FileController.cs | 20 ++++++------- API/Extensions/FileUploader.cs | 47 ++++++++++++++++++++++++++----- API/Resources/FileResource.cs | 4 --- Models/File.cs | 9 +++--- Services/Services/FileService.cs | 1 - 5 files changed, 53 insertions(+), 28 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 38507c3b..59f7ef84 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -19,23 +19,14 @@ using API.Resources; using AutoMapper; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.WebUtilities; -using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Models; -using RestSharp; using Services.Services; -using System.Collections; -using System.Collections.Specialized; +using System; using System.IO; -using System.Net.Http; -using System.Security.Claims; -using System.Security.Principal; using File = Models.File; namespace API.Controllers @@ -113,10 +104,15 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe } try { - string path = await fileUploader.UploadSingleFile(fileResource.File); + DateTime uploadDateTime = DateTime.Now; + int fileExtPos = fileResource.File.FileName.LastIndexOf("."); + string extension = fileResource.File.FileName.Substring(fileExtPos); + string newFileName = fileUploader.RemoveSpecialCharacters(fileResource.File.FileName.Remove(fileExtPos) + uploadDateTime + extension); + string path = await fileUploader.UploadSingleFile(fileResource.File, newFileName); User user = await HttpContext.GetContextUser(userService) .ConfigureAwait(false); - File file = new File(path, fileResource.File.FileName, user); + + File file = new File(path, newFileName, user, uploadDateTime); fileService.UploadSingleFile(file); return Ok(mapper.Map(file)); diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index a11f370f..124c41f0 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -1,3 +1,4 @@ +using API.Resources; using Microsoft.AspNetCore.Http; using Microsoft.CodeAnalysis.CSharp.Syntax; using Serilog; @@ -5,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using System.Threading.Tasks; using File = Models.File; @@ -30,12 +32,23 @@ public FileExistException(string name) /// public interface IFileUploader { + + /// + /// Remove specials characters from string + /// + /// + /// String without special characters + string RemoveSpecialCharacters(string str); + + /// /// Uploads single file /// /// + /// /// path of file location - Task UploadSingleFile(IFormFile file); + Task UploadSingleFile(IFormFile file, string fileName); + /// /// Method deletes the file from the file server /// @@ -52,29 +65,49 @@ public class FileUploader : IFileUploader private static readonly string UploadPath = Directory.GetCurrentDirectory() + "\\files\\"; + /// + /// Removes special characters for string to avoid problems + /// + /// + /// String without special characters + public string RemoveSpecialCharacters(string str) + { + StringBuilder sb = new StringBuilder(); + foreach(char c in str) + { + if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '.' || c == '_') + { + sb.Append(c); + } + } + return sb.ToString(); + } + + /// /// Uploads single file /// - /// + /// File to upload + /// Name of file /// path of file location - public async Task UploadSingleFile(IFormFile file) + public async Task UploadSingleFile(IFormFile file, string fileName) { try { - if(!System.IO.File.Exists(UploadPath + file.FileName)) + if(!System.IO.File.Exists(UploadPath + fileName)) { await using(Stream sourceStream = file.OpenReadStream()) { - await using(FileStream destinationStream = System.IO.File.Create(UploadPath + file.FileName)) + await using(FileStream destinationStream = System.IO.File.Create(UploadPath + fileName)) { await sourceStream.CopyToAsync(destinationStream); } } - return UploadPath + file.FileName; + return UploadPath + fileName; } - throw new FileExistException(file.FileName); + throw new FileExistException(fileName); } catch(Exception e) { Log.Logger.Error(e, "Unexpected error"); diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs index b899038c..5ecdc59c 100644 --- a/API/Resources/FileResource.cs +++ b/API/Resources/FileResource.cs @@ -36,10 +36,6 @@ public class FileResource /// public IFormFile File { get; set; } /// - /// Name of file - /// - public string Name { get; set; } - /// /// Date and time of uploading /// public DateTime UploadDateTime { get; set; } diff --git a/Models/File.cs b/Models/File.cs index 63fb1a09..06765bb0 100644 --- a/Models/File.cs +++ b/Models/File.cs @@ -26,11 +26,12 @@ public class File { public File() { } - public File(string path, string name, User uploader) + public File(string path, string name, User uploader, DateTime uploadDateTime) { - Path = path; - Name = name; - Uploader = uploader; + this.Path = path; + this.Name = name; + this.Uploader = uploader; + this.UploadDateTime = uploadDateTime; } public int Id { get; set; } diff --git a/Services/Services/FileService.cs b/Services/Services/FileService.cs index d8c43403..e742dcbb 100644 --- a/Services/Services/FileService.cs +++ b/Services/Services/FileService.cs @@ -63,7 +63,6 @@ public override void Update(File entity) public void UploadSingleFile(File entity) { - entity.UploadDateTime = DateTime.Now; Repository.Add(entity); Repository.Save(); } From e51aaee71c5c7ccd697779e36a3a72679ed866a4 Mon Sep 17 00:00:00 2001 From: Dave Bouman Date: Mon, 28 Sep 2020 10:44:30 +0200 Subject: [PATCH 024/157] error handing for following user/project --- API/Controllers/UserController.cs | 23 ++ API/Resources/UserResourceResult.cs | 2 +- ...FollowedProjectsToUserProjects.Designer.cs | 302 ------------------ ...namedUserFollowedProjectsToUserProjects.cs | 91 ------ 4 files changed, 24 insertions(+), 394 deletions(-) delete mode 100644 Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs delete mode 100644 Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 98175dd5..cd460a02 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -225,7 +225,30 @@ public async Task DeleteAccount() public async Task FollowProject(int projectId) { User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + if(await userService.FindAsync(user.Id) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the user account.", + Detail = "The database does not contain a user with this user id.", + Instance = "C4C62149-FF9A-4E4C-8C9F-6BBF518BA085" + }; + return NotFound(problem); + } + Project project = await projectService.FindAsync(projectId); + + if(await projectService.FindAsync(projectId) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the project.", + Detail = "The database does not contain a project with this project id.", + Instance = "C4C62149-FF9A-4E4C-8C9F-6BBF518BA085" + }; + return NotFound(problem); + } UserProject userProject = new UserProject(project, user); userProjectService.Add(userProject); diff --git a/API/Resources/UserResourceResult.cs b/API/Resources/UserResourceResult.cs index cbd86937..db347dcf 100644 --- a/API/Resources/UserResourceResult.cs +++ b/API/Resources/UserResourceResult.cs @@ -63,7 +63,7 @@ public class UserResourceResult /// /// Gets or sets the followed projects for user /// - public List UserProjects { get; set; } + public List UserProject { get; set; } } } diff --git a/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs b/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs deleted file mode 100644 index 1fe00650..00000000 --- a/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.Designer.cs +++ /dev/null @@ -1,302 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200925083321_RenamedUserFollowedProjectsToUserProjects")] - partial class RenamedUserFollowedProjectsToUserProjects - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserProjects"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserProjects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs b/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs deleted file mode 100644 index 4fa50ab6..00000000 --- a/Data/Migrations/20200925083321_RenamedUserFollowedProjectsToUserProjects.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class RenamedUserFollowedProjectsToUserProjects : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserFollowedProjects"); - - migrationBuilder.CreateTable( - name: "UserProjects", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserProjects", x => x.Id); - table.ForeignKey( - name: "FK_UserProjects_Project_ProjectId", - column: x => x.ProjectId, - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_UserProjects_User_UserId", - column: x => x.UserId, - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserProjects_ProjectId", - table: "UserProjects", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_UserProjects_UserId", - table: "UserProjects", - column: "UserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserProjects"); - - migrationBuilder.CreateTable( - name: "UserFollowedProjects", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(type: "int", nullable: true), - UserId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserFollowedProjects", x => x.Id); - table.ForeignKey( - name: "FK_UserFollowedProjects_Project_ProjectId", - column: x => x.ProjectId, - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_UserFollowedProjects_User_UserId", - column: x => x.UserId, - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserFollowedProjects_ProjectId", - table: "UserFollowedProjects", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_UserFollowedProjects_UserId", - table: "UserFollowedProjects", - column: "UserId"); - } - } -} From b236f49d021de8e0f8a73743b78237b048ec108c Mon Sep 17 00:00:00 2001 From: Mees van Straten <41986758+MeesvanStraten@users.noreply.github.com> Date: Mon, 28 Sep 2020 20:47:11 +0200 Subject: [PATCH 025/157] Added method to check if user already follows a given project --- API/Controllers/UserController.cs | 11 +++++++++++ Repositories/UserProjectRepository.cs | 16 +++++++++++++++- Services/Services/UserProjectService.cs | 11 +++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index cd460a02..d0120991 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -237,6 +237,17 @@ public async Task FollowProject(int projectId) return NotFound(problem); } + if(userProjectService.CheckIfUserFollows(user.Id,projectId)) + { + ProblemDetails problem = new ProblemDetails + { + Title = "User already follows this project", + Detail = "You are already following this project.", + Instance = "C4C62149-FF9A-4E4C-8C9F-6BBF518BA085" + }; + return NotFound(problem); + } + Project project = await projectService.FindAsync(projectId); if(await projectService.FindAsync(projectId) == null) diff --git a/Repositories/UserProjectRepository.cs b/Repositories/UserProjectRepository.cs index 144dfc68..e404f09b 100644 --- a/Repositories/UserProjectRepository.cs +++ b/Repositories/UserProjectRepository.cs @@ -54,6 +54,8 @@ Task> SearchAsync( Task FindWithUserAndCollaboratorsAsync(int id); + bool CheckIfUserFollows(int userId,int projectId); + } public class UserProjectRepository : Repository, IUserProjectRepository @@ -61,7 +63,7 @@ public class UserProjectRepository : Repository, IUserProjectReposi public UserProjectRepository(DbContext dbContext) : base(dbContext) { } - public void Add(UserProject entity) + public override void Add(UserProject entity) { DbContext.Add(entity); } @@ -90,6 +92,18 @@ public Task SearchCountAsync(string query, bool? highlighted = null) { throw new NotImplementedException(); } + + bool IUserProjectRepository.CheckIfUserFollows(int userId, int projectId) + { + UserProject userProject = GetDbSet() + .Where(s => (s.UserId == userId) && s.Project.Id == projectId) + .SingleOrDefault(); + if(userProject != null) + { + return true; + } + return false; + } } } diff --git a/Services/Services/UserProjectService.cs b/Services/Services/UserProjectService.cs index 9260f203..85e3b3d0 100644 --- a/Services/Services/UserProjectService.cs +++ b/Services/Services/UserProjectService.cs @@ -55,6 +55,8 @@ public interface IUserProjectService : IService /// The total number of pages for the results Task GetProjectsTotalPages(ProjectFilterParams projectFilterParams); + bool CheckIfUserFollows(int userId,int projectId); + } public class UserProjectService : Service, IUserProjectService @@ -114,6 +116,15 @@ public void Update(UserProject entity) throw new NotImplementedException(); } + bool IUserProjectService.CheckIfUserFollows(int userId, int projectId) + { + if(Repository.CheckIfUserFollows(userId,projectId)) + { + return true; + } + return false; + } + Task IService.FindAsync(int id) { throw new NotImplementedException(); From 602f4c0819389b53151e5ead7de06c7dfd0f27d4 Mon Sep 17 00:00:00 2001 From: Mees van Straten <41986758+MeesvanStraten@users.noreply.github.com> Date: Mon, 28 Sep 2020 21:40:25 +0200 Subject: [PATCH 026/157] Needs work but function to unfollow project --- API/Controllers/UserController.cs | 65 +++++++++++++++++++++++-- Repositories/UserProjectRepository.cs | 7 +++ Services/Services/UserProjectService.cs | 4 +- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index d0120991..569569e1 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -220,6 +220,11 @@ public async Task DeleteAccount() return Ok(); } + /// + /// Follows a project with given projectId and gets userId + /// + /// + /// 200 if success 409 if user already follows project [HttpPost("follow/{projectId}")] [Authorize] public async Task FollowProject(int projectId) @@ -232,7 +237,7 @@ public async Task FollowProject(int projectId) { Title = "Failed getting the user account.", Detail = "The database does not contain a user with this user id.", - Instance = "C4C62149-FF9A-4E4C-8C9F-6BBF518BA085" + Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" }; return NotFound(problem); } @@ -243,9 +248,9 @@ public async Task FollowProject(int projectId) { Title = "User already follows this project", Detail = "You are already following this project.", - Instance = "C4C62149-FF9A-4E4C-8C9F-6BBF518BA085" + Instance = "27D14082-9906-4EB8-AE4C-65BAEC0BB4FD" }; - return NotFound(problem); + return Conflict(problem); } Project project = await projectService.FindAsync(projectId); @@ -256,7 +261,7 @@ public async Task FollowProject(int projectId) { Title = "Failed getting the project.", Detail = "The database does not contain a project with this project id.", - Instance = "C4C62149-FF9A-4E4C-8C9F-6BBF518BA085" + Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" }; return NotFound(problem); } @@ -267,6 +272,58 @@ public async Task FollowProject(int projectId) return Ok(); } + /// + /// Unfollows project + /// + /// + /// + [HttpDelete("follow/{projectId}")] + [Authorize] + public async Task UnfollowProject(int projectId) + { + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + if(await userService.FindAsync(user.Id) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the user account.", + Detail = "The database does not contain a user with this user id.", + Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" + }; + return NotFound(problem); + } + + if(userProjectService.CheckIfUserFollows(user.Id, projectId)== false) + { + ProblemDetails problem = new ProblemDetails + { + Title = "User is not following this project", + Detail = "You are not following this project.", + Instance = "27D14082-9906-4EB8-AE4C-65BAEC0BB4FD" + }; + return Conflict(problem); + } + + Project project = await projectService.FindAsync(projectId); + + if(await projectService.FindAsync(projectId) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the project.", + Detail = "The database does not contain a project with this project id.", + Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" + }; + return NotFound(problem); + } + UserProject userProject = new UserProject(project, user); + userProjectService.Remove(userProject); + + userProjectService.Save(); + return Ok(); + } + /// /// Delete the user account. /// diff --git a/Repositories/UserProjectRepository.cs b/Repositories/UserProjectRepository.cs index e404f09b..9e49ad50 100644 --- a/Repositories/UserProjectRepository.cs +++ b/Repositories/UserProjectRepository.cs @@ -51,6 +51,7 @@ Task> SearchAsync( ); Task SearchCountAsync(string query, bool? highlighted = null); + void Remove(UserProject userProject); Task FindWithUserAndCollaboratorsAsync(int id); @@ -104,6 +105,12 @@ bool IUserProjectRepository.CheckIfUserFollows(int userId, int projectId) } return false; } + + void IUserProjectRepository.Remove(UserProject userProject) + { + GetDbSet() + .Remove(userProject); + } } } diff --git a/Services/Services/UserProjectService.cs b/Services/Services/UserProjectService.cs index 85e3b3d0..c5a92387 100644 --- a/Services/Services/UserProjectService.cs +++ b/Services/Services/UserProjectService.cs @@ -101,9 +101,9 @@ public Task ProjectsCount(ProjectFilterParams projectFilterParams) throw new NotImplementedException(); } - public void Remove(UserProject entity) + public override void Remove(UserProject entity) { - throw new NotImplementedException(); + Repository.Remove(entity); } public void SaveFollowedProjectAsync(int userId, int projectId) From eed48abf9ac56b0d8198ded22b4c6e72649c32ad Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Tue, 29 Sep 2020 09:33:02 +0200 Subject: [PATCH 027/157] added authorization --- API/Controllers/FileController.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 59f7ef84..c0569635 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -24,6 +24,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Models; +using Models.Defaults; using Services.Services; using System; using System.IO; @@ -89,7 +90,7 @@ public async Task GetFilesAsync() /// /// HTTP Response [HttpPost] - [Authorize] + [Authorize(Policy = nameof(Defaults.Scopes.ProjectWrite))] public async Task UploadSingleFile([FromForm] FileResource fileResource) { if(fileResource.File == null) @@ -162,17 +163,20 @@ public async Task GetSingleFile(int fileId) public async Task DeleteSingleFile(int fileId) { File file = await fileService.FindAsync(fileId); + User user = await HttpContext.GetContextUser(userService) + .ConfigureAwait(false); - if(file == null) + if(file.Uploader != user) { ProblemDetails problem = new ProblemDetails { - Title = "File could not be found.", - Detail = "File could not be found.", - Instance = "875B6402-D771-45EC-AB56-3DE0CDD446D6" - }; - return NotFound(problem); + Title = "Not authorized.", + Detail = "You are not the uploader of this file.", + Instance = "88967A6F-B168-44E2-A8E7-E9EBD555940E" + }; + return Unauthorized(problem); } + try { await fileService.RemoveAsync(fileId) From b6db6ab8e88e2fc8e3a7fe699b0b0d4e7e1f21db Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Tue, 29 Sep 2020 10:25:54 +0200 Subject: [PATCH 028/157] added more assertions in tests and changed authorization for filecontroller endpoints --- API/Controllers/FileController.cs | 15 +- Postman/dex.postman_collection.json | 649 ++++++++++++++++--------- Postman/local.postman_environment.json | 18 +- 3 files changed, 435 insertions(+), 247 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index c0569635..ca001131 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -90,7 +90,7 @@ public async Task GetFilesAsync() /// /// HTTP Response [HttpPost] - [Authorize(Policy = nameof(Defaults.Scopes.ProjectWrite))] + [Authorize] public async Task UploadSingleFile([FromForm] FileResource fileResource) { if(fileResource.File == null) @@ -166,7 +166,18 @@ public async Task DeleteSingleFile(int fileId) User user = await HttpContext.GetContextUser(userService) .ConfigureAwait(false); - if(file.Uploader != user) + if(file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File was not found.", + Detail = "File was not found.", + Instance = "9D3830A2-E7D1-4610-A147-1D43BFB8DDBC" + }; + return NotFound(problem); + } + + if(file.Uploader != user && !userService.UserHasScope(user.IdentityId, Defaults.Roles.Administrator)) { ProblemDetails problem = new ProblemDetails { diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 7c6a3821..c7335d4f 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "1e04c4b6-4c13-4ed4-9994-eb1bb0986e69", + "_postman_id": "7a49f632-3a1a-425b-8193-8f5ff064e277", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "c0c73e6c-7f31-4323-88e3-5e6fb469d111", + "id": "6f2e6c0c-c9f6-45d2-ac7c-510471ff6a13", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "f8141afb-6e74-4260-91d2-11ddd20fef50", + "id": "c565aed3-c829-4bc5-b34b-a03ad538f1cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -134,7 +134,7 @@ { "listen": "test", "script": { - "id": "96000457-5985-4446-9302-8a0d9134a775", + "id": "cf37d4ad-8780-4c78-9399-240af9fe0447", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -203,7 +203,7 @@ { "listen": "test", "script": { - "id": "7d7c1369-8db1-47df-8077-fcbcdf45142e", + "id": "f0490b63-0a3b-4d32-aeeb-1519062e83fb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -271,7 +271,7 @@ { "listen": "test", "script": { - "id": "792e64aa-bf7e-46c9-a559-e0da6f287624", + "id": "bd055a94-87b7-4c1d-879c-6bef4a79eb95", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -339,7 +339,7 @@ { "listen": "test", "script": { - "id": "5e1d79c0-73ed-49ab-bfa8-2d1c1c424c96", + "id": "79eb2350-5e30-46e1-84f1-a9860c3a0b35", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -414,7 +414,7 @@ { "listen": "test", "script": { - "id": "3f1bfe53-3e90-4e14-8601-10d74144028a", + "id": "48fc3e2b-d59f-45f8-968f-7f4c6876b312", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -479,7 +479,7 @@ { "listen": "test", "script": { - "id": "a2e44142-3b56-4fb4-8670-9a222e64e785", + "id": "54a28d1d-7d74-44d8-bbf5-30d2c380eafd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -557,7 +557,7 @@ { "listen": "test", "script": { - "id": "b5543315-c35d-4571-913d-4dffd4fc8ffc", + "id": "c92d762d-3c8a-4c04-bd86-6fea64d1a484", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -630,7 +630,7 @@ { "listen": "test", "script": { - "id": "f1649fb2-4f00-4b7f-bfa9-8e74ca0c28a4", + "id": "23684c74-e061-4408-9cf7-8482116b5ed3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -699,7 +699,7 @@ { "listen": "test", "script": { - "id": "c0548410-2fe9-464c-8631-56f663bebba3", + "id": "1c8f3a6b-c6cf-495e-aa6d-1f49f7486241", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -767,7 +767,7 @@ { "listen": "test", "script": { - "id": "67b118ea-01f6-46ff-a9bb-d3cf766669ed", + "id": "326466d4-ac69-44b1-89e5-94eacfd4859b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -835,7 +835,7 @@ { "listen": "test", "script": { - "id": "fb6a7b1e-d13d-4182-ba7f-6093b7cdb7fd", + "id": "17f36d9c-5d97-41b3-a56c-a442f2034bb4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -935,7 +935,7 @@ { "listen": "test", "script": { - "id": "33f93076-8f9c-469f-960a-38899de1df3c", + "id": "28a47a6b-2d0b-41f1-9080-ec9c0f9c052a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -964,7 +964,7 @@ { "listen": "prerequest", "script": { - "id": "8f14c602-9fe9-4130-9c80-5470e8008ad8", + "id": "d91d41a2-8c4e-4c93-928f-0eb95e91f447", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -1014,7 +1014,7 @@ { "listen": "test", "script": { - "id": "8c8b6dbc-4290-456c-9809-7e79f5c95ed1", + "id": "785cb482-5adc-4954-9e48-b3b824766312", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1083,7 +1083,7 @@ { "listen": "test", "script": { - "id": "53b26750-3a98-42b8-b272-3f031483d223", + "id": "104903ed-c10f-4576-9097-2a6235b4e978", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1145,7 +1145,7 @@ { "listen": "test", "script": { - "id": "16f12e9b-1b7a-4acd-9f62-8e09b40388cd", + "id": "9cf86b6f-fe53-4666-b69d-eaa5ef42eb8c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1232,7 +1232,7 @@ { "listen": "test", "script": { - "id": "b6c65dd1-ffe7-43ef-b3dd-3cadb4654bc1", + "id": "932fe234-aef8-4779-84ea-e34720c53994", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1319,7 +1319,7 @@ { "listen": "test", "script": { - "id": "cbbb90b7-c73d-4e9d-8afc-346c93253059", + "id": "6ee06afa-add1-4b54-8120-5b70caa2ef60", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1351,7 +1351,7 @@ { "listen": "prerequest", "script": { - "id": "ba58b818-8af3-4d50-b551-c39080072d91", + "id": "054f2cd6-a325-4857-8405-88689608ec1f", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1398,7 +1398,7 @@ { "listen": "test", "script": { - "id": "3c4df8ea-cd99-4e4d-8b8d-be8c205cf613", + "id": "eee496b1-64c8-46a8-8330-13ac58ba87f8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1465,7 +1465,7 @@ { "listen": "test", "script": { - "id": "3c385836-4c0e-4dd7-ad41-ee6241c5ea38", + "id": "5423bd73-d161-480a-b5a9-6ad0c2fb9ffc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1526,7 +1526,7 @@ { "listen": "test", "script": { - "id": "6a60db7a-b67d-4daa-b1ad-58b768c1211f", + "id": "84163d09-72d7-40f5-8b43-5ce9fdab862e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1590,7 +1590,7 @@ { "listen": "test", "script": { - "id": "dd584fc4-f7cd-4e66-a868-e9bedc550e62", + "id": "347abd02-e3c0-4d6e-8581-49f9c71ea576", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1659,7 +1659,7 @@ { "listen": "test", "script": { - "id": "3046e342-6d62-46fe-93ac-39cb34ada637", + "id": "4966d7d8-22e6-4a33-b490-dcc7a5296517", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1717,7 +1717,7 @@ { "listen": "test", "script": { - "id": "d1cfcc23-041b-4535-98d2-63ed4de0030e", + "id": "9b6b7042-79d3-459c-82d2-a062eef1fa30", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1771,7 +1771,7 @@ { "listen": "test", "script": { - "id": "14ed7163-65f9-453d-a49a-ccd26412b84d", + "id": "c375b9c1-dea6-4e30-bfeb-c91552f30d51", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1832,7 +1832,7 @@ { "listen": "test", "script": { - "id": "a860d782-8838-4da2-8b1b-c28a9fefb918", + "id": "b3eb917c-bea0-4835-8b90-b876099f42f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -1905,7 +1905,7 @@ { "listen": "test", "script": { - "id": "4be54a78-b40f-4f5f-b84f-d080dae495f9", + "id": "b456040b-9c81-4d00-b141-50d2e7840aa5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -1978,7 +1978,7 @@ { "listen": "test", "script": { - "id": "164d845f-ac47-4c71-a75d-7a81f643ff71", + "id": "93b721c7-2bc9-4d7d-8376-254f79bf7b76", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2044,7 +2044,7 @@ { "listen": "test", "script": { - "id": "59ccdecc-65f3-4eee-ab1a-1de7a51d1cdf", + "id": "90d021fe-5ffe-4bc4-9067-377d5acbb179", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2103,7 +2103,7 @@ { "listen": "test", "script": { - "id": "ab55cc1e-dead-4167-b7e2-62397616fc15", + "id": "2fdf5cef-e02c-4284-b2f0-7a968680326f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2170,7 +2170,7 @@ { "listen": "test", "script": { - "id": "b50c15dc-de14-48f3-98c5-cafbd4db02ae", + "id": "174ae93d-a304-4754-bfca-4ec86eb9b5ba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2228,7 +2228,7 @@ { "listen": "test", "script": { - "id": "b579ad2c-d55d-48e5-988b-8fc00012760e", + "id": "8791eee1-c194-4e82-bf6a-8952196422f3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2307,7 +2307,7 @@ { "listen": "test", "script": { - "id": "c1c6f5a7-05d9-47e8-b212-3e85a135c203", + "id": "f3ddd045-4460-40d8-9f03-e64e11bc39dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2365,7 +2365,7 @@ { "listen": "test", "script": { - "id": "51fea22f-77e8-4dd5-ba04-f00c1ff5d72f", + "id": "ff3c4e46-5c4d-46df-a0b4-cc59c285d742", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2426,7 +2426,7 @@ { "listen": "test", "script": { - "id": "84fe99dd-396e-424e-b4ad-9e8fd687a7ce", + "id": "2922f61a-f3f1-4ad1-8470-d6bec0114f43", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2492,7 +2492,7 @@ { "listen": "test", "script": { - "id": "48d515e2-9750-4327-8b48-95e09938cdf9", + "id": "b10ff819-21d4-4cc4-96d5-9676cb647464", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2558,7 +2558,7 @@ { "listen": "test", "script": { - "id": "2bfcbae7-d289-4b24-8f8d-04c1d4648efe", + "id": "a00d91ea-1da1-43b7-99e0-c8e87da34647", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2603,7 +2603,7 @@ { "listen": "test", "script": { - "id": "8f04d4d6-1167-4456-b896-83aa864dd52d", + "id": "171dbda8-3b6b-46c9-a806-3397df69c2a6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2648,7 +2648,7 @@ { "listen": "test", "script": { - "id": "715b7b99-30c5-4da8-8349-165bf2b6dc3b", + "id": "34a0b14e-359d-42e5-a49d-3ab013de9ae0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2693,7 +2693,7 @@ { "listen": "test", "script": { - "id": "0155df6c-852e-45e5-8e9a-78298cd5d305", + "id": "d09ae77a-4cd3-410e-b0f1-6081f4dbc16f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2738,7 +2738,7 @@ { "listen": "test", "script": { - "id": "005f4a13-0173-4433-a8ad-748f1321fa50", + "id": "1014eb9b-f317-41a1-b927-f54491688208", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2783,7 +2783,7 @@ { "listen": "test", "script": { - "id": "2d8885c4-746e-4133-a16d-bb9d7a8aee3c", + "id": "13b3e46d-8035-4c46-bd28-993dbe604884", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2835,7 +2835,7 @@ { "listen": "test", "script": { - "id": "459f3aea-788a-4b68-87c1-99d034851e31", + "id": "5efb04a8-00ed-4a1c-8799-916e74702cc8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2886,7 +2886,7 @@ { "listen": "test", "script": { - "id": "9953cd22-1a66-4d81-9e9f-8f613640bf25", + "id": "db8afbeb-a854-4e66-93c1-5dcd3f7d11f9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2937,7 +2937,7 @@ { "listen": "test", "script": { - "id": "ed7f9f70-9064-47d2-b8df-b0f36b786632", + "id": "07bd8a91-fd85-4991-a593-101fac6a334b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2988,7 +2988,7 @@ { "listen": "test", "script": { - "id": "62eaa375-3e12-4dea-89c8-3a816957e178", + "id": "853fd460-2d17-4395-8299-14b73e106338", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3039,7 +3039,7 @@ { "listen": "test", "script": { - "id": "4a76d70a-0c0f-4a2f-a85a-aa8da1680a1d", + "id": "7ed01475-7a4a-4fb2-91f0-db47fa55c869", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3097,16 +3097,26 @@ { "listen": "test", "script": { - "id": "a6fed838-9156-4e3b-aa7d-19093a1a166a", + "id": "cce5b305-c4bd-4af7-acfa-892c865378a1", "exec": [ "var jsonData = pm.response.json();\r", "\r", "pm.environment.set(\"adminFileId\", jsonData.id)\r", "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", "pm.test(\"Response time is less than 800ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(800);\r", "});\r", "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", "" ], "type": "text/javascript" @@ -3151,17 +3161,22 @@ { "listen": "test", "script": { - "id": "b8e0c360-7259-4b41-a793-28a5dead87cf", + "id": "87bae7d8-2886-4784-8434-58c0c64875a7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", "});\r", "\r", "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" @@ -3192,6 +3207,30 @@ }, { "name": "File-Delete-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "cb25e787-d3ad-4a90-9f26-1592d0107b23", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], "request": { "method": "DELETE", "header": [ @@ -3235,7 +3274,7 @@ { "listen": "test", "script": { - "id": "1c49bb0f-a80a-4ec8-9b77-71c88c2a8ca9", + "id": "f9995483-087a-433d-896c-3310f298dd0c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3313,7 +3352,7 @@ { "listen": "test", "script": { - "id": "dabb1953-bb5c-4e5d-9ce7-9eb08aec92dd", + "id": "eb689a77-e011-4189-814f-b022d9241d0a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3342,7 +3381,7 @@ { "listen": "prerequest", "script": { - "id": "0016471e-2136-495e-ad70-946c4c84860e", + "id": "e2fe4371-efe6-487d-abb9-0c4bb9a49c6c", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3392,7 +3431,7 @@ { "listen": "test", "script": { - "id": "6429ef39-ec55-4c96-a0e4-57a3e54e0fe0", + "id": "027cd200-2dd8-433b-a656-af62a13fcdf0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3456,7 +3495,7 @@ { "listen": "prerequest", "script": { - "id": "1509eb25-47b0-4d62-ae18-3db195334a24", + "id": "7526e18a-0647-4457-bf63-4c430dbc196e", "type": "text/javascript", "exec": [ "" @@ -3466,7 +3505,7 @@ { "listen": "test", "script": { - "id": "671efc2b-31bf-433a-bfa9-17e14caf1c07", + "id": "f10afc21-6ad0-4bbc-84aa-b71e3161699a", "type": "text/javascript", "exec": [ "" @@ -3486,7 +3525,7 @@ { "listen": "test", "script": { - "id": "73b1dc2a-0974-481a-b56a-414564ac722c", + "id": "a5be345c-a705-40f6-b5a8-ac83577e7e53", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3544,7 +3583,7 @@ { "listen": "test", "script": { - "id": "018cda9a-c119-4008-b75a-65150360a0e6", + "id": "4dc0ed22-0a31-4d05-bb10-0de041f29e34", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3594,7 +3633,7 @@ { "listen": "test", "script": { - "id": "72f6f834-9853-4493-943d-a9994676197b", + "id": "c9485161-7393-428a-b37d-e7497e1f7ac2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3653,7 +3692,7 @@ { "listen": "test", "script": { - "id": "69c7c3cf-cce7-45ca-9bcc-99aad98b4961", + "id": "24b60ae4-c95b-43f1-8a9c-6f3327eea4a4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3702,7 +3741,7 @@ { "listen": "prerequest", "script": { - "id": "26427efc-c53a-4d85-8428-f82fec1c530a", + "id": "4b95a330-8fe3-4bec-b640-7810c751ec30", "type": "text/javascript", "exec": [ "" @@ -3712,7 +3751,7 @@ { "listen": "test", "script": { - "id": "0774a81a-c0a1-45dd-a8c7-c7cfaca99bce", + "id": "e8d92873-5732-4216-b7e5-8587e05910d2", "type": "text/javascript", "exec": [ "" @@ -3732,7 +3771,7 @@ { "listen": "test", "script": { - "id": "d6fe063b-42e8-469f-900e-50ae8d5eb018", + "id": "26a65063-4c84-4353-b8b3-ec7797f7383e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3792,7 +3831,7 @@ { "listen": "test", "script": { - "id": "dec994bf-4221-407a-8d63-de70fb2505cc", + "id": "44665555-caae-4292-9efe-3e6c38121547", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3862,7 +3901,7 @@ { "listen": "test", "script": { - "id": "8c385d5b-d36d-425e-9734-06799ea7ba9b", + "id": "c6999429-7f18-4a89-a7a3-8aaf42975fe6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3917,7 +3956,7 @@ { "listen": "test", "script": { - "id": "856d4987-2438-4774-9e83-8caa801b4921", + "id": "f854509d-155c-4ff5-bf11-4407201e0ceb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3974,7 +4013,7 @@ { "listen": "test", "script": { - "id": "bda2b8f6-48ef-48a3-a1df-b38e0240c4ad", + "id": "6861cfd9-a686-4436-bcca-fe6d8013ea15", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4023,7 +4062,7 @@ { "listen": "prerequest", "script": { - "id": "35d19ad1-25f5-4aec-9337-9da1cb491593", + "id": "f7e4079f-7ec3-4382-99c8-0781172014ac", "type": "text/javascript", "exec": [ "" @@ -4033,7 +4072,7 @@ { "listen": "test", "script": { - "id": "ef2e77fe-df74-4a3e-93fb-e0bd8744535d", + "id": "77138fc1-b01f-4c96-9137-484926758957", "type": "text/javascript", "exec": [ "" @@ -4053,7 +4092,7 @@ { "listen": "test", "script": { - "id": "ee5c73df-e992-43b1-bbad-b50cc4a7cc3d", + "id": "fa03f593-3aed-47a7-abc0-662a73aa8cac", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4080,7 +4119,7 @@ { "listen": "prerequest", "script": { - "id": "79055a16-e6aa-4d43-a82c-371920634186", + "id": "312a5a99-cdfb-4a6f-bb77-ff99038916af", "exec": [ "" ], @@ -4119,7 +4158,7 @@ { "listen": "test", "script": { - "id": "aae9c527-2524-4500-9d27-6049c78aa607", + "id": "10a07448-7322-410b-8356-48b4a15d984b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4164,7 +4203,7 @@ { "listen": "test", "script": { - "id": "d70a2f62-7be2-47c8-8720-1d7d62a2a675", + "id": "fb3973fb-4a33-406e-89a5-747234261fa2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4219,7 +4258,7 @@ { "listen": "test", "script": { - "id": "27061337-b57d-454d-bc69-65deace7e62c", + "id": "f82646d5-860f-498f-be9d-c677d82d6a10", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4268,7 +4307,7 @@ { "listen": "test", "script": { - "id": "75c010ff-0398-4e6b-8f69-4150f80523c4", + "id": "c0e3244f-aa09-47e2-bda1-175b8ec1eeed", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4295,7 +4334,7 @@ { "listen": "prerequest", "script": { - "id": "d4f00da8-260d-46da-8c72-fba87a20486b", + "id": "7f92731a-c851-4c44-aa46-3a2e4796e14f", "exec": [ "" ], @@ -4335,7 +4374,7 @@ { "listen": "test", "script": { - "id": "58b9eb9f-167d-4808-ac00-6d6a9f3fc438", + "id": "a63de592-db7d-4a99-b351-cb901c58c6b2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4384,7 +4423,7 @@ { "listen": "prerequest", "script": { - "id": "bb31940e-4904-4d79-b690-d124ad31de90", + "id": "0e094719-2b9f-4dd4-8b5c-0b50c96c7019", "type": "text/javascript", "exec": [ "" @@ -4394,7 +4433,7 @@ { "listen": "test", "script": { - "id": "f901351a-9d4e-47af-a28d-3165fb808de9", + "id": "97ea57e6-4fd2-4c89-8fa5-565a08f036b5", "type": "text/javascript", "exec": [ "" @@ -4414,7 +4453,7 @@ { "listen": "test", "script": { - "id": "ca321509-a235-438e-96cc-425a8859dcbf", + "id": "ecaedd00-4019-4b03-bdec-e92621013de6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4469,7 +4508,7 @@ { "listen": "test", "script": { - "id": "746d6887-2e9d-4160-a479-426733a2669b", + "id": "8c07b0a2-5ef9-4aa4-9252-d49b956f0627", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4515,7 +4554,7 @@ { "listen": "test", "script": { - "id": "2707a764-fa65-43a0-b12f-e4da537abc7f", + "id": "e5b785db-27b6-439d-b8de-406af9610144", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4562,7 +4601,7 @@ { "listen": "test", "script": { - "id": "a4f9a8a7-e3bc-4898-89d0-b3a14522b239", + "id": "5b8583ad-f684-4d80-883b-6695de5ec058", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4611,7 +4650,7 @@ { "listen": "prerequest", "script": { - "id": "f50f3d63-5d20-44c2-98e8-96fc6af33cc7", + "id": "5c4e1f20-5d94-44f8-b864-29c8b594a2e7", "type": "text/javascript", "exec": [ "" @@ -4621,7 +4660,7 @@ { "listen": "test", "script": { - "id": "73138c78-8c56-4d5f-b35f-9a9431dafd77", + "id": "c227126a-81ce-44d3-94e5-510ddb0bcab0", "type": "text/javascript", "exec": [ "" @@ -4641,7 +4680,7 @@ { "listen": "test", "script": { - "id": "26cab543-84e4-4341-9e81-c89c25b753e5", + "id": "a713d0c5-f97e-4f54-94e4-0c20377a8688", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4697,7 +4736,7 @@ { "listen": "test", "script": { - "id": "5e3b1bf6-97ec-4123-b713-75fbbb64ffa6", + "id": "568c0fe7-0c3e-4d44-92af-860d128198a1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4744,7 +4783,7 @@ { "listen": "test", "script": { - "id": "a6041d9c-185a-4308-8e6b-318ea67c6d0b", + "id": "fa7a408b-f2be-4c41-9be7-5c32a2d3c826", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4792,7 +4831,7 @@ { "listen": "test", "script": { - "id": "d39e2577-cecc-4062-b570-9f72693c6f0a", + "id": "478981ff-a581-4bb1-b26e-3b414eaded53", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4840,7 +4879,7 @@ { "listen": "test", "script": { - "id": "d6a209ba-5683-4498-9fdc-9d45e738e50c", + "id": "7b76878e-9636-417e-a77d-61837f59731b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4897,7 +4936,7 @@ { "listen": "test", "script": { - "id": "4648032e-899f-4190-bbf6-677fda89ef00", + "id": "13106f42-34be-47d1-bb8a-75abc8d9aeb6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4968,7 +5007,7 @@ { "listen": "prerequest", "script": { - "id": "897bda5e-f9d8-4b06-b378-b5569ed99596", + "id": "afc2214c-b284-4c40-ae51-63536ca393ea", "type": "text/javascript", "exec": [ "" @@ -4978,7 +5017,7 @@ { "listen": "test", "script": { - "id": "1912923b-7bd8-4e25-9e9e-d8ece09e8593", + "id": "a065eeb6-9bf2-41f1-9345-4762dc8462c9", "type": "text/javascript", "exec": [ "" @@ -4998,7 +5037,7 @@ { "listen": "test", "script": { - "id": "ed57f482-6eef-4d02-81f0-36ad6fee0d81", + "id": "9b919e9c-a446-474e-a25a-dfd67df13697", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5049,7 +5088,7 @@ { "listen": "prerequest", "script": { - "id": "8f8effd9-8638-4d5e-a2af-8fb448c84ee2", + "id": "e508c30c-b241-4dbf-a642-48edc32fbc59", "type": "text/javascript", "exec": [ "" @@ -5059,7 +5098,7 @@ { "listen": "test", "script": { - "id": "0b252cab-2396-40bd-99f2-e13b96d8792d", + "id": "f8fbddeb-1cad-4d10-8d3e-778616c2b813", "type": "text/javascript", "exec": [ "" @@ -5079,7 +5118,7 @@ { "listen": "test", "script": { - "id": "97b466a4-eace-474c-9765-d5406c6adb0e", + "id": "00e9770a-1867-48c8-8d49-187df039d513", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5135,7 +5174,7 @@ { "listen": "prerequest", "script": { - "id": "2b117980-2db2-4731-9db8-12fc6c2ffef7", + "id": "3aa7d701-4d96-4fc5-b321-99f19d270ece", "type": "text/javascript", "exec": [ "" @@ -5145,7 +5184,7 @@ { "listen": "test", "script": { - "id": "4321f7be-43ec-4394-9eb8-30d2d87f5286", + "id": "5182c3f1-ac3e-4e27-b6b8-e021b24c7487", "type": "text/javascript", "exec": [ "" @@ -5160,19 +5199,73 @@ "name": "File", "item": [ { - "name": "Get-Files-Guest", + "name": "Post-File-Guest", "event": [ { "listen": "test", "script": { - "id": "bda204f3-9483-4fe7-9bae-fa5030dc6a67", + "id": "a82c9c2c-5e38-41bf-94fd-a34fd8696c3f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "var fileId = pm.environment.get(\"fileId\");\r", "\r", "var jsonData = pm.response.json();\r", "\r", - "var foundAt;\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "/C:/Users/Niray/Desktop/angular-226066.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "2d751eee-3c4a-4f30-bd7f-633eec2a267a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", "pm.test(\"Status code is 401\", function () {\r", " pm.response.to.have.status(401);\r", @@ -5206,12 +5299,12 @@ "response": [] }, { - "name": "Post-File-Guest", + "name": "File-Delete-Guest", "event": [ { "listen": "test", "script": { - "id": "2d226309-550b-4c77-8463-9ee68b9184f6", + "id": "050f6049-4c47-4b98-9143-efb1888332db", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -5226,9 +5319,9 @@ "});\r", "\r", "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.unauthorized;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" @@ -5239,26 +5332,17 @@ "auth": { "type": "noauth" }, - "method": "POST", + "method": "DELETE", "header": [], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "/C:/Users/Niray/Desktop/angular-226066.png" - } - ] - }, "url": { - "raw": "{{apiUrl}}/api/File", + "raw": "{{apiUrl}}/api/File/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "File" + "File", + "1" ] } }, @@ -5273,7 +5357,7 @@ { "listen": "prerequest", "script": { - "id": "79000e1c-060b-497c-b9bd-aac4c56b030b", + "id": "2458d018-ef4e-4c95-b924-5689e23899f0", "type": "text/javascript", "exec": [ "" @@ -5283,7 +5367,7 @@ { "listen": "test", "script": { - "id": "e524f41a-075d-4e0d-b185-b7c683a2a91c", + "id": "bed362b2-19fd-4612-8e0f-cddb39aec70d", "type": "text/javascript", "exec": [ "" @@ -5306,7 +5390,7 @@ { "listen": "test", "script": { - "id": "6a4fefa1-1981-4deb-9304-f4f24bf74449", + "id": "7c5ed658-dac3-4eb4-8bfd-79c6f3d2d7c5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5375,7 +5459,7 @@ { "listen": "test", "script": { - "id": "86da24b0-429d-4e19-8d74-8f718da42337", + "id": "f9ac4414-c453-48d0-97f5-12ca7de73507", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5454,7 +5538,7 @@ { "listen": "test", "script": { - "id": "bdf226c6-3f35-4c02-9af1-1e57c2f63615", + "id": "6af95dd1-9f26-4c4f-a96f-4f6bf9149374", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5483,7 +5567,7 @@ { "listen": "prerequest", "script": { - "id": "ba84a929-a4d9-4da9-b98f-18167bb72a91", + "id": "70361920-a2bc-4549-909f-396a6567f19c", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5533,7 +5617,7 @@ { "listen": "test", "script": { - "id": "243b9b85-4e59-4256-81a1-b08d862349e4", + "id": "1331cab4-16ee-4636-9519-13db0cde8a00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5598,7 +5682,7 @@ { "listen": "test", "script": { - "id": "538019fd-aca1-4831-8b01-9a8bff2f9b36", + "id": "5204aca1-54c0-47fd-8047-f2a6390b7262", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5671,7 +5755,7 @@ { "listen": "prerequest", "script": { - "id": "e8773fce-296c-43a6-9507-a07f6599441f", + "id": "46865ead-58cd-4d0d-9fff-c88d8260e283", "type": "text/javascript", "exec": [ "" @@ -5681,7 +5765,7 @@ { "listen": "test", "script": { - "id": "05adf8cc-4736-4904-987d-c3e48fa2e709", + "id": "064f3f61-03d0-47c5-a8e0-2d79040fa019", "type": "text/javascript", "exec": [ "" @@ -5701,7 +5785,7 @@ { "listen": "test", "script": { - "id": "02fe2189-5a20-4f19-90b8-629b88fced33", + "id": "6e746c36-a843-4cbe-89eb-6c3f20b79e59", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -5761,7 +5845,7 @@ { "listen": "test", "script": { - "id": "08c84fca-7087-4d72-8615-66c4675da916", + "id": "001c29c9-ca90-4e58-835f-8b0d24bb80a0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5814,7 +5898,7 @@ { "listen": "test", "script": { - "id": "feb2e309-5778-4c0f-a95e-9fb0b85d155a", + "id": "844197db-dfa8-4d65-a51f-7fdc62e1c730", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -5872,7 +5956,7 @@ { "listen": "test", "script": { - "id": "f8b48cf5-0669-497d-9d89-62aed3614e0f", + "id": "6e288797-2b9c-4b5e-aa4d-69365535890a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -5939,7 +6023,7 @@ { "listen": "test", "script": { - "id": "b3548720-cd28-434f-b7e0-d81e9b669f8a", + "id": "308464d0-cc57-4f7f-8f28-22a9abbb604f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6001,7 +6085,7 @@ { "listen": "prerequest", "script": { - "id": "5ce85a14-947e-4d7f-9535-45bc0953b092", + "id": "8e0f982f-c069-49c1-bdf6-b33f2fc03a5c", "type": "text/javascript", "exec": [ "" @@ -6011,7 +6095,7 @@ { "listen": "test", "script": { - "id": "c01dcfd5-e421-49d4-9806-c5017ddfd833", + "id": "18d75f41-62fe-4ae8-8b7e-e69e02f1f0ab", "type": "text/javascript", "exec": [ "" @@ -6031,7 +6115,7 @@ { "listen": "test", "script": { - "id": "96b37a8e-1c03-4488-bf5e-528827de332f", + "id": "80f1a934-6202-443b-be02-2732369533fe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6097,7 +6181,7 @@ { "listen": "test", "script": { - "id": "3dd9de87-c988-4597-a5aa-2f8df30614b2", + "id": "ce6680cc-cc2e-461e-98c4-7772a05d294e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6170,7 +6254,7 @@ { "listen": "test", "script": { - "id": "5991b9e0-4422-4c3b-a7fd-e70fd43c6616", + "id": "9fcb2869-0ee1-4325-9523-71ba51f030e2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6228,7 +6312,7 @@ { "listen": "test", "script": { - "id": "3636c57c-5eb6-4af2-ac8e-0cd7a309b3d0", + "id": "cca21f15-6e3a-43c3-a0c1-3939a590769d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6278,7 +6362,7 @@ { "listen": "test", "script": { - "id": "2316752d-f40a-4290-9c36-26a25d564e59", + "id": "89def25a-d837-472b-997c-544cdf94fca2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -6345,7 +6429,7 @@ { "listen": "test", "script": { - "id": "1b8af729-0630-496e-853d-14b8f5e71670", + "id": "7419b9c9-59f4-438f-9873-6281493a0a28", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6412,7 +6496,7 @@ { "listen": "test", "script": { - "id": "c5c91adb-5c0c-4122-b77c-fa97beac99c6", + "id": "b0491970-03ef-467f-bcce-746002d676de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6476,7 +6560,7 @@ { "listen": "test", "script": { - "id": "fd73158c-b3d3-483e-b95e-e00ea26a86ee", + "id": "60f576d2-85d7-4b55-b984-426932920fe9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6537,7 +6621,7 @@ { "listen": "test", "script": { - "id": "61bd239a-80c2-4e45-8056-2a46dccabda0", + "id": "8b1988a8-3fc5-47b3-a249-bec5c17c2cfe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6589,7 +6673,7 @@ { "listen": "test", "script": { - "id": "29253423-467c-489c-8b02-fe4a07c580ad", + "id": "08dc6d28-54eb-4a1b-8b42-454f5f025feb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -6654,7 +6738,7 @@ { "listen": "test", "script": { - "id": "fe3d183f-a6bd-494b-91ce-0c752a1a6844", + "id": "af7b7629-6df2-4782-980e-809bd804c1ef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6680,7 +6764,7 @@ { "listen": "prerequest", "script": { - "id": "a1887e51-b588-451f-8c1e-b625e4ac7696", + "id": "fff31a27-550c-41d9-aa07-f5a82dbdd35c", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -6730,7 +6814,7 @@ { "listen": "test", "script": { - "id": "34ae4cd0-a79c-4883-8ada-9fbc912b1a17", + "id": "15bbb853-7cdb-4689-862e-8f5401b3d190", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -6799,7 +6883,7 @@ { "listen": "test", "script": { - "id": "7ea7c06e-7d28-49bb-aed7-6c08a4699a92", + "id": "9308e8e3-bd24-410d-a2d3-f43d061fe691", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -6861,7 +6945,7 @@ { "listen": "test", "script": { - "id": "8408b6a6-bbea-4026-a4b3-c056d8cef972", + "id": "a10729ed-3663-4f65-a69c-4059cffb3300", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6916,7 +7000,7 @@ { "listen": "test", "script": { - "id": "66479555-e648-4132-a1f1-8470cae3df9c", + "id": "34a30305-b1ef-401e-9c96-ac0d641b0697", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6985,7 +7069,7 @@ { "listen": "test", "script": { - "id": "394fd4c8-af49-406c-b87a-05e439c98418", + "id": "72c6d96f-1b9a-4cd9-894d-561f51cb9493", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7046,7 +7130,7 @@ { "listen": "test", "script": { - "id": "24b6be10-28bc-4f4b-a723-a16cee55b22e", + "id": "959676c4-0b54-4df9-b094-58c5a0887780", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7098,7 +7182,7 @@ { "listen": "test", "script": { - "id": "c04efc10-8344-4b5e-958d-be2c780602ec", + "id": "f16c7eee-2ce2-47f5-aa30-088f75633d01", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7151,7 +7235,7 @@ { "listen": "test", "script": { - "id": "f2648a4d-ff48-4784-a648-fb6b1639c5f0", + "id": "9d154ed3-c8f1-4848-b650-1b0463681a22", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7204,7 +7288,7 @@ { "listen": "test", "script": { - "id": "2152fc44-7d8d-4a98-819b-2d799f64b2c1", + "id": "b23a073f-d179-462c-9fcd-3667ef4e5c99", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7266,7 +7350,7 @@ { "listen": "test", "script": { - "id": "0dc1165c-211a-4a5c-8008-c5ed1427ed23", + "id": "4477891c-7e3b-4f29-a86b-4efed071ae84", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7347,7 +7431,7 @@ { "listen": "test", "script": { - "id": "8a2f9eb2-881f-4220-b387-fc80eeee962a", + "id": "1d984807-9a06-45f3-b12a-d879685e50b1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7406,7 +7490,7 @@ { "listen": "test", "script": { - "id": "6bfcc70d-8d15-4d1c-bf50-1318eb6ee7d1", + "id": "83dba95e-c057-4ef7-9d9d-6aa90e47a295", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -7472,7 +7556,7 @@ { "listen": "test", "script": { - "id": "ea5f0b58-5de6-43c9-9e19-56165c4a2c11", + "id": "a05c7bf3-f53d-4592-adbf-5f861d6241af", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7521,7 +7605,7 @@ { "listen": "test", "script": { - "id": "169e65dc-c0ab-4a21-ba29-105639fb2dac", + "id": "d90920cd-4cba-46af-9d8e-b3b306abdd67", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7572,7 +7656,7 @@ { "listen": "test", "script": { - "id": "87cf585a-27e7-4bfc-a49c-7ea1fd34933d", + "id": "3e334484-3ae4-49a1-880a-672583fcfe87", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7623,7 +7707,7 @@ { "listen": "test", "script": { - "id": "44752391-c239-4efb-85b4-0272e0b8c57a", + "id": "fb355d27-e327-4cd5-8b54-31eabaef921c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7668,7 +7752,7 @@ { "listen": "test", "script": { - "id": "5b58f2cd-4f45-472b-954e-9e44dc146e02", + "id": "91a53380-e37d-455c-812b-6acbef693880", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7719,7 +7803,7 @@ { "listen": "test", "script": { - "id": "778700eb-8d15-4a20-be05-4d80bfd602da", + "id": "0958f36c-e814-4f56-9ebe-69da3c2d99a9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7770,7 +7854,7 @@ { "listen": "test", "script": { - "id": "d94c496e-e311-4bac-8b88-09e4b10e0ae3", + "id": "0db71748-ad77-4ade-a214-d90600b8ddd6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7828,16 +7912,25 @@ { "listen": "test", "script": { - "id": "88185be2-ef36-4b69-b029-978de18c4730", + "id": "fcd9e64b-7f83-4392-888d-10dbbd787bdd", "exec": [ "var jsonData = pm.response.json();\r", "\r", "pm.environment.set(\"registeredFileId\", jsonData.id)\r", "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", "pm.test(\"Response time is less than 800ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(800);\r", "});\r", - "" + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" ], "type": "text/javascript" } @@ -7848,7 +7941,7 @@ "header": [ { "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", + "value": "{{registeredUserIdentityId}}", "type": "text" } ], @@ -7881,7 +7974,7 @@ { "listen": "test", "script": { - "id": "948f3a85-70d9-434e-b044-ca69d0bde753", + "id": "6420b3d6-c6d9-4062-89b9-b9406e903309", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -7924,9 +8017,39 @@ }, { "name": "Delete-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "2542e69e-5932-46b6-ba88-05b23571ba13", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], "request": { "method": "DELETE", - "header": [], + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], "url": { "raw": "{{apiUrl}}/api/File/{{registeredFileId}}", "host": [ @@ -7961,7 +8084,7 @@ { "listen": "test", "script": { - "id": "e12a86a5-e2ed-400f-a316-23535ee6a691", + "id": "b169a452-99ac-4a80-9267-ebc33576195e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8030,7 +8153,7 @@ { "listen": "test", "script": { - "id": "b99dcd01-5d91-4c32-9a75-f63bb2d7f5c2", + "id": "a043e333-3f9a-422c-8e59-65ca5dcf5cb9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8109,7 +8232,7 @@ { "listen": "test", "script": { - "id": "f896adb5-6499-434e-acae-2bac22df1418", + "id": "ff9717e7-5768-43a2-bedc-df0ce7a118eb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8138,7 +8261,7 @@ { "listen": "prerequest", "script": { - "id": "cd45030e-f268-4a72-bc2f-e76e9fcc2b54", + "id": "d35ec241-382b-4f87-804b-bc8280fa3f9c", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8188,7 +8311,7 @@ { "listen": "test", "script": { - "id": "2383872b-e42e-40f0-b391-8c513156d470", + "id": "bb16ca95-521e-4c1e-a4e7-f7a31f9aa097", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8252,7 +8375,7 @@ { "listen": "test", "script": { - "id": "f2c9c6d1-a9b9-4ec8-886b-a1b8bf25019c", + "id": "0442c601-89ea-4e4e-932f-a99eaa7e1a4f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8325,7 +8448,7 @@ { "listen": "prerequest", "script": { - "id": "7d19da17-56a4-4025-9e72-bd62d9632e83", + "id": "2aa18a39-1ae2-417c-b6a2-19e33db6eb48", "type": "text/javascript", "exec": [ "" @@ -8335,7 +8458,7 @@ { "listen": "test", "script": { - "id": "3418de5e-690b-47af-8f31-922465bf321b", + "id": "c4218e58-b9f1-4116-9823-e021fe25faca", "type": "text/javascript", "exec": [ "" @@ -8355,7 +8478,7 @@ { "listen": "test", "script": { - "id": "3f76e672-e3e7-405a-9645-3e04021f5e4b", + "id": "71f71182-5a59-424e-a73c-9b3c036d5105", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -8415,7 +8538,7 @@ { "listen": "test", "script": { - "id": "238c139c-0dfc-4fd2-a0e7-ac5f5a8d8593", + "id": "a1accd44-70ee-44ec-a6a1-01ffdab039a9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8468,7 +8591,7 @@ { "listen": "test", "script": { - "id": "1e357f48-3461-4f08-8483-9cdb76a40912", + "id": "0b3e4444-9f53-4816-8637-bac93d9433d7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -8526,7 +8649,7 @@ { "listen": "test", "script": { - "id": "8002f97e-7c2c-4d97-9ed5-2dfbff32cfed", + "id": "709b04e1-8ba3-4fc5-bed0-431095bf9101", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -8593,7 +8716,7 @@ { "listen": "test", "script": { - "id": "9dff6b94-e746-4745-a93f-530ceaa9fbd4", + "id": "5fb4a144-7367-4440-85eb-50de8607fcc8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8655,7 +8778,7 @@ { "listen": "prerequest", "script": { - "id": "9a2cadcf-fe74-4db4-948f-37cad5e0145f", + "id": "26b93ac6-c18e-4ed5-9607-f1bd384dad92", "type": "text/javascript", "exec": [ "" @@ -8665,7 +8788,7 @@ { "listen": "test", "script": { - "id": "7ded2f08-b954-4456-817c-89a4bf25987f", + "id": "8767e003-e4c9-4bb9-aac9-58e3e03ae334", "type": "text/javascript", "exec": [ "" @@ -8685,7 +8808,7 @@ { "listen": "test", "script": { - "id": "d716c27a-c9b1-4dd6-95ec-8e0bfe415608", + "id": "f4e89290-7f16-4f96-a7dd-449b474e5e34", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -8751,7 +8874,7 @@ { "listen": "test", "script": { - "id": "10a8fa62-4f31-4c27-a740-88e4c10ed5ff", + "id": "b9bbaced-5115-4fff-b44f-7bd358b0c6cf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8824,7 +8947,7 @@ { "listen": "test", "script": { - "id": "6db65780-3baa-4159-bbf2-44260a1a13db", + "id": "ab26c1e3-07f2-42b0-8cc2-6e537bace17c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8882,7 +9005,7 @@ { "listen": "test", "script": { - "id": "894e4dc8-8a00-4b1a-8b65-6c115bd4851c", + "id": "ceb8c81c-602d-44a0-aa89-b65b8f21092b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -8932,7 +9055,7 @@ { "listen": "test", "script": { - "id": "49b2a3a6-19dc-41c4-9727-d9e41d4d134b", + "id": "f7869cbe-eb8d-42e6-9d53-420b16a4cb24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -8999,7 +9122,7 @@ { "listen": "test", "script": { - "id": "258d622e-4541-4365-bbe9-3403d3e84a6c", + "id": "e0e9fbf5-4491-4cab-b532-8f3cb68c0dee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9066,7 +9189,7 @@ { "listen": "test", "script": { - "id": "877d92ec-4a31-4764-8a5f-bb797ec37ecb", + "id": "0f44e558-896e-41a5-821d-8e47f76b69e0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9130,7 +9253,7 @@ { "listen": "test", "script": { - "id": "83377c69-3a90-44ca-9d7f-03abd18b5af2", + "id": "8f28ddb0-dc64-42fd-bb4a-8e9d604b2bdc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9194,7 +9317,7 @@ { "listen": "test", "script": { - "id": "c735c7b8-988b-45fa-8117-f38db3dc5414", + "id": "5a46191c-6f56-49fb-bab6-56ae8bb748d2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9246,7 +9369,7 @@ { "listen": "test", "script": { - "id": "fcba375a-7ba8-43a8-84f7-9589081fe5f4", + "id": "860c6ad3-a700-402d-bbea-e7e9134ff6b1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -9304,7 +9427,7 @@ { "listen": "test", "script": { - "id": "2ee8c4c1-d852-4761-b1e2-3128d1587936", + "id": "9a51456b-e0ed-4ce8-80e6-bbcfaba23a76", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -9369,7 +9492,7 @@ { "listen": "test", "script": { - "id": "e71ace0c-8144-4be6-a81c-3fbefe4d9999", + "id": "a07d03e3-e428-48c4-8782-fdfe6df4adb7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9397,7 +9520,7 @@ { "listen": "prerequest", "script": { - "id": "3196284c-29db-4212-9965-c69958c46af6", + "id": "1b1f4f93-0700-4aa8-81d3-9629d2302b24", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9447,7 +9570,7 @@ { "listen": "test", "script": { - "id": "621f51ee-1cb2-42be-a182-9fc3788210bb", + "id": "7ce7a9ec-5505-4be5-b196-f027612f2caa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9509,7 +9632,7 @@ { "listen": "test", "script": { - "id": "d62fd082-0ba7-48db-a0df-4ec2b4d30cd9", + "id": "bc0cc017-fc11-4342-b8f4-38d8a78c6132", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9596,7 +9719,7 @@ { "listen": "test", "script": { - "id": "853e709a-07a4-42f5-a0da-2cf17fa9840b", + "id": "2387dfdf-168a-4924-818f-3d9d413fcc22", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9622,7 +9745,7 @@ { "listen": "prerequest", "script": { - "id": "9173a117-50e3-4403-aa18-009e63a458f5", + "id": "7b45e6c0-c13b-4446-8e5a-b2746a956962", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9669,7 +9792,7 @@ { "listen": "test", "script": { - "id": "6f0dee03-d88a-4d79-bbde-bb8af27fd4fc", + "id": "db35f394-6e0c-487e-afcd-5cf5b0474c34", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9696,7 +9819,7 @@ { "listen": "prerequest", "script": { - "id": "68a576c3-f2ac-416d-8f09-53f2297d7338", + "id": "e6f02e64-377a-4c49-8849-ec5f24bcf0ae", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9746,7 +9869,7 @@ { "listen": "test", "script": { - "id": "35840ca5-0967-43d1-b825-a316b8a7926f", + "id": "a1caaca9-d7f3-4125-84d6-b00501f076be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9808,7 +9931,7 @@ { "listen": "test", "script": { - "id": "467a55aa-1b3e-4600-8d2b-cfbd053328e6", + "id": "770e3445-b3be-442b-9fc4-885d5d00c391", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9895,7 +10018,7 @@ { "listen": "test", "script": { - "id": "b35fd0b2-305a-43d9-8a01-a57d1005ae30", + "id": "2ff291cf-8fc7-4232-8d9a-656249874818", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9921,7 +10044,7 @@ { "listen": "prerequest", "script": { - "id": "f28b0b8a-6327-441a-8997-ec31e8ba8800", + "id": "1acb04b5-f103-40aa-bc85-9ccc8fd13195", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9968,7 +10091,7 @@ { "listen": "test", "script": { - "id": "a9e2aa25-edd3-4a70-983d-2aa7ab7d26b1", + "id": "37802e2f-c4c9-48be-af4c-43eb02764f4b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10044,7 +10167,7 @@ { "listen": "test", "script": { - "id": "52a9fea3-1e46-498d-8633-3ce516efe091", + "id": "7eaa4f9b-923a-49e1-a883-6049f9de787b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10105,7 +10228,7 @@ { "listen": "test", "script": { - "id": "20ef741e-4858-4f00-8784-0e6ae0b2fc3a", + "id": "f5dd4791-91f1-44f1-8501-3807914d6650", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10157,7 +10280,7 @@ { "listen": "test", "script": { - "id": "301a6dbc-bd69-45f5-8967-5cb797d355c1", + "id": "ae44170d-6f86-4a03-b05b-5b0502a0d2c7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10210,7 +10333,7 @@ { "listen": "test", "script": { - "id": "e74d7127-a975-40ca-a8d6-131e06711cab", + "id": "be136538-a304-4423-8dbb-71e216b1f96a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10263,7 +10386,7 @@ { "listen": "test", "script": { - "id": "9dd11f58-4136-4a5e-ae9f-cbc0ee317f22", + "id": "21ca596b-17dd-43f2-94ed-4ab9a661d4aa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10325,7 +10448,7 @@ { "listen": "test", "script": { - "id": "8ed5ab50-4097-48b2-9e1d-e36d6c76709a", + "id": "4a147f5b-e5fb-45d9-9e61-eed7a9c8cb6f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10406,7 +10529,7 @@ { "listen": "test", "script": { - "id": "6cbcb199-af63-4429-8317-6c8d66dd1221", + "id": "53913f62-b306-49b1-92de-a36041f10eca", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10465,7 +10588,7 @@ { "listen": "test", "script": { - "id": "e8ec61b8-ea91-4dfc-809a-0bf96b6e6e9c", + "id": "2bfc6f7a-f393-4773-9537-cb30b0d6469c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -10531,7 +10654,7 @@ { "listen": "test", "script": { - "id": "361e8a38-d34c-46a9-bb83-1f181dd27bc2", + "id": "a30b5c36-4e59-4414-b750-fa90776156fd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10580,7 +10703,7 @@ { "listen": "test", "script": { - "id": "32c9611e-b97e-4a3f-932f-0587f3016753", + "id": "af52ce7b-3a2f-4fa5-837f-4b00330698d3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10629,7 +10752,7 @@ { "listen": "test", "script": { - "id": "36291d9c-81c0-4891-afb1-9fd54657e3d6", + "id": "87b1ad6d-29ef-4207-a341-fb10a3d231b5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10674,7 +10797,7 @@ { "listen": "test", "script": { - "id": "c432acf7-4dbd-4ca2-ba6e-030fdad805f1", + "id": "d5e44c9e-51bb-482d-a887-54188c69ff19", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10719,7 +10842,7 @@ { "listen": "test", "script": { - "id": "f6cca7b1-2f69-416e-9c84-d65620eca53a", + "id": "22dc922f-a8a7-4ac4-95be-3ae32d3c1d9f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10764,7 +10887,7 @@ { "listen": "test", "script": { - "id": "c4695129-6ef3-4cd9-9833-3a1b47a20849", + "id": "2f8fbde2-bbf5-439f-a671-e2014d7381ce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10817,7 +10940,7 @@ { "listen": "test", "script": { - "id": "b533e04e-224e-4fde-9c76-db5febaac2c7", + "id": "be82389d-3049-4f4e-8b42-f83cb5f24edd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10870,7 +10993,7 @@ { "listen": "test", "script": { - "id": "8b7943b3-1f1d-4298-a4f4-86db61b7ea85", + "id": "d711aa1d-dc70-43d7-9e7b-59880f5ee959", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10930,16 +11053,25 @@ { "listen": "test", "script": { - "id": "dcdb326d-fa8b-4a52-90b5-643452aec0fe", + "id": "56c5fa0b-618f-46d0-ae3d-ccb3a38a48b7", "exec": [ "var jsonData = pm.response.json();\r", "\r", "pm.environment.set(\"prFileId\", jsonData.id)\r", "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", "pm.test(\"Response time is less than 800ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(800);\r", "});\r", - "" + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" ], "type": "text/javascript" } @@ -10950,7 +11082,7 @@ "header": [ { "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", + "value": "{{prUserIdentityId}}", "type": "text" } ], @@ -10983,10 +11115,15 @@ { "listen": "test", "script": { - "id": "98ab479b-8107-4489-9363-ea6307658246", + "id": "7ecae597-6a7d-4f73-8d52-f148fc07b72a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", "});\r", @@ -11024,9 +11161,39 @@ }, { "name": "Delete-File-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "86056755-ca0c-4b74-856b-e1568813789c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], "request": { "method": "DELETE", - "header": [], + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], "url": { "raw": "{{apiUrl}}/api/File/{{prFileId}}", "host": [ @@ -11077,7 +11244,7 @@ { "listen": "prerequest", "script": { - "id": "16096042-d8ba-420a-b43d-d4ef971fb73e", + "id": "98d99c07-2ed8-4653-81a6-a296d2493dec", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11121,7 +11288,7 @@ { "listen": "test", "script": { - "id": "0ae5945b-7504-4611-bff4-94a931427ba8", + "id": "2e5986ab-5640-493e-8d59-ce2f22726d36", "type": "text/javascript", "exec": [ "" diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 691eac49..1519078f 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "3e14f5b7-5105-4893-8e8a-242ee7641e35", + "id": "4110dfac-6304-4aab-bd29-2ef362921acc", "name": "Local", "values": [ { @@ -59,7 +59,7 @@ }, { "key": "accessToken", - "value": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ik10LXVfZ0VuSUw1TzlxM1lJVU5lemciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MDA2ODgxOTUsImV4cCI6MTYwMDY5MTc5NSwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwNSIsImF1ZCI6ImRleC1hcGkiLCJjbGllbnRfaWQiOiJkZXgtYXBpLWNsaWVudCIsImNsaWVudF9yb2xlIjoiQmFja2VuZEFwcGxpY2F0aW9uIiwic2NvcGUiOlsiRW1iZWRSZWFkIiwiRW1iZWRXcml0ZSIsIkhpZ2hsaWdodFJlYWQiLCJIaWdobGlnaHRXcml0ZSIsIlByb2plY3RSZWFkIiwiUHJvamVjdFdyaXRlIiwiVXNlclJlYWQiLCJVc2VyV3JpdGUiXX0.TwqMmQXNMShypaoqwX6yXnazHkoPr1zFXejJWWjqjZhZahym8yZPekLCLABfUCECpuxDTfsGy0dy9SLhDIunplJUDbfFexG9VHu4LR8iMlDvWmoPlbzl6LhYSPZbSaxcjJkWz0CzTWYI7xddvZqrGyJdYhpseuYXKkjDx8dh89DmHqeMFpEb3eyy4WnD1Ie22NDjEt1Ou5u4AtbWqIL-ZOPzKRpnIaWdUoAJR3xNEYaRVYRRfSQyV1S1xvNizbV6y4Map4YPQB_PqxG4khi0VGSEgDQ9OmxyvuA_oSPorLmFgRHR1fmYGieVaMQG9HJHxXqv_o4MUnl-MG0Y1Jkvpg", + "value": "eyJhbGciOiJSUzI1NiIsImtpZCI6Inp1TmZhU2x0UHFsN1RRQlEwa21FQkEiLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MDEzNjY5NjQsImV4cCI6MTYwMTM3MDU2NCwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwNSIsImF1ZCI6ImRleC1hcGkiLCJjbGllbnRfaWQiOiJkZXgtYXBpLWNsaWVudCIsImNsaWVudF9yb2xlIjoiQmFja2VuZEFwcGxpY2F0aW9uIiwic2NvcGUiOlsiRW1iZWRSZWFkIiwiRW1iZWRXcml0ZSIsIkhpZ2hsaWdodFJlYWQiLCJIaWdobGlnaHRXcml0ZSIsIlByb2plY3RSZWFkIiwiUHJvamVjdFdyaXRlIiwiVXNlclJlYWQiLCJVc2VyV3JpdGUiXX0.CQw0TalYOB2hUX6b8jC8AQMI4whkomjYJFBJd0FmUti40KAWApRshHlk-lBTv0FvbTCgs0JyA8qqPUqge4PEdvKtC2Fv93FlLptGrVED4Hy7I_yNEQFQvFSwybrc0x2-X_J8x1Wh-y01JzioUh_n7Aw3DCUZPcJyLvRmXhUwjm-f3EnFvN86W2IEdH6MlZL5wsiIo2hc35TInRdjGg4-4npXIBBlyJ7_VIQ7rngoqkxW7Y2xAQ8yEo_AzkAtFQAopc8yrgrJcoyl42IQa5K7GV49bLgyBqb_rNQDI1bWXdncS7BeNWbUCtitmmj6q37CR4KAZB8fXYe8O6uDe_2Kig", "enabled": true }, { @@ -211,9 +211,19 @@ "key": "fileId", "value": "1", "enabled": true + }, + { + "key": "prFileId", + "value": null, + "enabled": true + }, + { + "key": "adminFileId", + "value": 92, + "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-09-21T13:32:42.589Z", - "_postman_exported_using": "Postman/7.32.0" + "_postman_exported_at": "2020-09-29T08:18:13.470Z", + "_postman_exported_using": "Postman/7.33.1" } \ No newline at end of file From 1ed82c1b54ddd2d543858420c4d41853fdace4eb Mon Sep 17 00:00:00 2001 From: I380210 Date: Tue, 29 Sep 2020 15:38:15 +0200 Subject: [PATCH 029/157] Change to delete entire row instead of ProjectId on table --- API/Controllers/UserController.cs | 3 ++- Data/4_Data.csproj | 5 +++++ Repositories/UserProjectRepository.cs | 23 +++++++++++++++++++++-- Services/Services/UserProjectService.cs | 5 +++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 569569e1..6421b4f1 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -318,7 +318,8 @@ public async Task UnfollowProject(int projectId) return NotFound(problem); } UserProject userProject = new UserProject(project, user); - userProjectService.Remove(userProject); + //userProjectService.Remove(userProject); + userProjectService.RemoveAsync(userProject.Id); userProjectService.Save(); return Ok(); diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index 5a43bd33..b3226fc8 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -5,6 +5,11 @@ 8 + + + + + diff --git a/Repositories/UserProjectRepository.cs b/Repositories/UserProjectRepository.cs index 9e49ad50..4dccbc69 100644 --- a/Repositories/UserProjectRepository.cs +++ b/Repositories/UserProjectRepository.cs @@ -51,7 +51,10 @@ Task> SearchAsync( ); Task SearchCountAsync(string query, bool? highlighted = null); - void Remove(UserProject userProject); + // void Remove(UserProject userProject); + + Task RemoveUserProjectAsync(int id); + Task FindWithUserAndCollaboratorsAsync(int id); @@ -106,10 +109,26 @@ bool IUserProjectRepository.CheckIfUserFollows(int userId, int projectId) return false; } - void IUserProjectRepository.Remove(UserProject userProject) + // void IUserProjectRepository.re(UserProject userProject) + //{ + // GetDbSet() + // .Remove(userProject); + //} + + async Task IUserProjectRepository.RemoveUserProjectAsync(int id) { + UserProject userProject = GetDbSet() + .Where(s => s.Id == id) + .SingleOrDefault(); + + if(userProject != null) + { GetDbSet() .Remove(userProject); + return true; + } + return false; + } } diff --git a/Services/Services/UserProjectService.cs b/Services/Services/UserProjectService.cs index c5a92387..0ff6ee0d 100644 --- a/Services/Services/UserProjectService.cs +++ b/Services/Services/UserProjectService.cs @@ -101,9 +101,10 @@ public Task ProjectsCount(ProjectFilterParams projectFilterParams) throw new NotImplementedException(); } - public override void Remove(UserProject entity) + public void Remove(int id) { - Repository.Remove(entity); + //Repository.Remove(entity); + Repository.RemoveUserProjectAsync(id); } public void SaveFollowedProjectAsync(int userId, int projectId) From bba83a0f02796e176c446d211a3451ec6eb660bc Mon Sep 17 00:00:00 2001 From: I380210 Date: Tue, 29 Sep 2020 16:38:36 +0200 Subject: [PATCH 030/157] Function to follow projects and unfollow project works, also some cleanup in code --- API/Configuration/MappingProfile.cs | 2 +- API/Controllers/UserController.cs | 3 +- API/Resources/UserProjectResourceResult.cs | 15 + Data/4_Data.csproj | 4 + ...UserProjectsTableToUserProject.Designer.cs | 302 ------------------ ...52_ChangeUserProjectsTableToUserProject.cs | 107 ------- .../ApplicationDbContextModelSnapshot.cs | 8 +- Models/User.cs | 4 +- Repositories/UserProjectRepository.cs | 93 +----- Repositories/UserRepository.cs | 10 +- Services/Services/UserProjectService.cs | 86 +---- 11 files changed, 45 insertions(+), 589 deletions(-) delete mode 100644 Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs delete mode 100644 Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 7d04097b..6bac6027 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -32,7 +32,7 @@ public class MappingProfile : Profile public MappingProfile() { CreateMap() - .ForMember(q => q.UserProjects, options => options.MapFrom(q => q.Project.Name)) + .ForMember(q => q.UserProject, options => options.MapFrom(q => q.Project.Name)) .ForAllOtherMembers(o => o.Ignore()); CreateMap(); diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 6421b4f1..569569e1 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -318,8 +318,7 @@ public async Task UnfollowProject(int projectId) return NotFound(problem); } UserProject userProject = new UserProject(project, user); - //userProjectService.Remove(userProject); - userProjectService.RemoveAsync(userProject.Id); + userProjectService.Remove(userProject); userProjectService.Save(); return Ok(); diff --git a/API/Resources/UserProjectResourceResult.cs b/API/Resources/UserProjectResourceResult.cs index 2ddee1a2..6758a779 100644 --- a/API/Resources/UserProjectResourceResult.cs +++ b/API/Resources/UserProjectResourceResult.cs @@ -6,11 +6,26 @@ namespace API.Resources { + /// + /// Object to return to frontend with the UserProject + /// public class UserProjectResourceResult { + /// + /// PK of UserProject + /// public int Id { get; set; } + /// + /// Set or get Project + /// public Project Project { get; set; } + /// + /// set or get User + /// public User User { get; set; } + /// + /// set or get userId + /// public int UserId { get; set; } } } diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index b3226fc8..4689afe1 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -6,8 +6,12 @@ + + + + diff --git a/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs b/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs deleted file mode 100644 index b1962fca..00000000 --- a/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.Designer.cs +++ /dev/null @@ -1,302 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200925083952_ChangeUserProjectsTableToUserProject")] - partial class ChangeUserProjectsTableToUserProject - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserProject"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserProjects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs b/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs deleted file mode 100644 index 453ab937..00000000 --- a/Data/Migrations/20200925083952_ChangeUserProjectsTableToUserProject.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class ChangeUserProjectsTableToUserProject : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserProjects_Project_ProjectId", - table: "UserProjects"); - - migrationBuilder.DropForeignKey( - name: "FK_UserProjects_User_UserId", - table: "UserProjects"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserProjects", - table: "UserProjects"); - - migrationBuilder.RenameTable( - name: "UserProjects", - newName: "UserProject"); - - migrationBuilder.RenameIndex( - name: "IX_UserProjects_UserId", - table: "UserProject", - newName: "IX_UserProject_UserId"); - - migrationBuilder.RenameIndex( - name: "IX_UserProjects_ProjectId", - table: "UserProject", - newName: "IX_UserProject_ProjectId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserProject", - table: "UserProject", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_UserProject_Project_ProjectId", - table: "UserProject", - column: "ProjectId", - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_UserProject_User_UserId", - table: "UserProject", - column: "UserId", - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserProject_Project_ProjectId", - table: "UserProject"); - - migrationBuilder.DropForeignKey( - name: "FK_UserProject_User_UserId", - table: "UserProject"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserProject", - table: "UserProject"); - - migrationBuilder.RenameTable( - name: "UserProject", - newName: "UserProjects"); - - migrationBuilder.RenameIndex( - name: "IX_UserProject_UserId", - table: "UserProjects", - newName: "IX_UserProjects_UserId"); - - migrationBuilder.RenameIndex( - name: "IX_UserProject_ProjectId", - table: "UserProjects", - newName: "IX_UserProjects_ProjectId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserProjects", - table: "UserProjects", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_UserProjects_Project_ProjectId", - table: "UserProjects", - column: "ProjectId", - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_UserProjects_User_UserId", - table: "UserProjects", - column: "UserId", - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 652ff6d5..08d73d79 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -202,7 +202,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("User"); }); - modelBuilder.Entity("Models.UserProject", b => + modelBuilder.Entity("Models.UserFollowedProject", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -221,7 +221,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("UserProject"); + b.ToTable("UserFollowedProjects"); }); modelBuilder.Entity("Models.Collaborator", b => @@ -282,14 +282,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("RoleId"); }); - modelBuilder.Entity("Models.UserProject", b => + modelBuilder.Entity("Models.UserFollowedProject", b => { b.HasOne("Models.Project", "Project") .WithMany() .HasForeignKey("ProjectId"); b.HasOne("Models.User", "User") - .WithMany("UserProjects") + .WithMany("UserFollowedProjects") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); diff --git a/Models/User.cs b/Models/User.cs index e1380d2a..cafe47b4 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -28,7 +28,7 @@ public User() { Projects = new List(); Services = new List(); - UserProjects = new List(); + UserProject = new List(); } public int Id { get; set; } @@ -48,7 +48,7 @@ public User() public List Services { get; set; } - public List UserProjects { get; set; } + public List UserProject { get; set; } public string ProfileUrl { get; set; } diff --git a/Repositories/UserProjectRepository.cs b/Repositories/UserProjectRepository.cs index 4dccbc69..5c3c5f50 100644 --- a/Repositories/UserProjectRepository.cs +++ b/Repositories/UserProjectRepository.cs @@ -17,119 +17,50 @@ using Microsoft.EntityFrameworkCore; using Models; -using Models.Defaults; using Repositories.Base; -using System; -using System.Collections.Generic; using System.Linq; -using System.Linq.Expressions; -using System.Threading.Tasks; namespace Repositories { public interface IUserProjectRepository : IRepository { - - Task> GetAllWithUsersAsync( - int? skip = null, - int? take = null, - Expression> orderBy = null, - bool orderByAsc = true, - bool? highlighted = null - ); - - Task CountAsync(bool? highlighted = null); - - Task> SearchAsync( - string query, - int? skip = null, - int? take = null, - Expression> orderBy = null, - bool orderByAsc = true, - bool? highlighted = null - ); - - Task SearchCountAsync(string query, bool? highlighted = null); - // void Remove(UserProject userProject); - - Task RemoveUserProjectAsync(int id); - - - Task FindWithUserAndCollaboratorsAsync(int id); - bool CheckIfUserFollows(int userId,int projectId); - } public class UserProjectRepository : Repository, IUserProjectRepository { - public UserProjectRepository(DbContext dbContext) : base(dbContext) { } - public override void Add(UserProject entity) - { - DbContext.Add(entity); - } - - public Task CountAsync(bool? highlighted = null) - { - throw new NotImplementedException(); - } - - public Task FindWithUserAndCollaboratorsAsync(int id) - { - throw new NotImplementedException(); - } - - public Task> GetAllWithUsersAsync(int? skip = null, int? take = null, Expression> orderBy = null, bool orderByAsc = true, bool? highlighted = null) + public override void Add(UserProject userProject) { - throw new NotImplementedException(); + DbContext.Add(userProject); } - public Task> SearchAsync(string query, int? skip = null, int? take = null, Expression> orderBy = null, bool orderByAsc = true, bool? highlighted = null) + public override void Remove(UserProject userProject) { - throw new NotImplementedException(); - } + UserProject projectToRemove = GetDbSet() + .Where + (s => s.UserId == userProject.User.Id + && s.Project.Id == userProject.Project.Id) + .SingleOrDefault(); - public Task SearchCountAsync(string query, bool? highlighted = null) - { - throw new NotImplementedException(); + GetDbSet() + .Remove(projectToRemove); } bool IUserProjectRepository.CheckIfUserFollows(int userId, int projectId) { UserProject userProject = GetDbSet() - .Where(s => (s.UserId == userId) && s.Project.Id == projectId) + .Where(s => (s.UserId == userId) + && s.Project.Id == projectId) .SingleOrDefault(); - if(userProject != null) - { - return true; - } - return false; - } - - // void IUserProjectRepository.re(UserProject userProject) - //{ - // GetDbSet() - // .Remove(userProject); - //} - - async Task IUserProjectRepository.RemoveUserProjectAsync(int id) - { - UserProject userProject = GetDbSet() - .Where(s => s.Id == id) - .SingleOrDefault(); if(userProject != null) { - GetDbSet() - .Remove(userProject); return true; } return false; - } } - } diff --git a/Repositories/UserRepository.cs b/Repositories/UserRepository.cs index bf726bb9..2b7de1ec 100644 --- a/Repositories/UserRepository.cs +++ b/Repositories/UserRepository.cs @@ -18,7 +18,6 @@ using Microsoft.EntityFrameworkCore; using Models; using Repositories.Base; -using System; using System.Linq; using System.Threading.Tasks; @@ -88,7 +87,7 @@ public override async Task FindAsync(int userId) .Where(s => s.Id == userId) .Include(s => s.Role) .ThenInclude(s => s.Scopes) - .Include(f => f.UserProjects) + .Include(f => f.UserProject) .SingleOrDefaultAsync(); } /// @@ -102,7 +101,7 @@ public async Task GetUserAsync(int userId) .Where(s => s.Id == userId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) - .Include(f => f.UserProjects) + .Include(f => f.UserProject) .SingleOrDefaultAsync(); } /// @@ -116,7 +115,7 @@ public async Task GetUserByIdentityIdAsync(string identityId) .Where(s => s.IdentityId == identityId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) - .Include(f => f.UserProjects) + .Include(f => f.UserProject) .SingleOrDefaultAsync(); } @@ -179,8 +178,5 @@ public bool UserWithRoleExists(Role role) .Include(s => s.Role) .SingleOrDefault(r => r.Role.Id == role.Id) != null; } - - } - } diff --git a/Services/Services/UserProjectService.cs b/Services/Services/UserProjectService.cs index 0ff6ee0d..9952785d 100644 --- a/Services/Services/UserProjectService.cs +++ b/Services/Services/UserProjectService.cs @@ -29,92 +29,23 @@ namespace Services.Services public interface IUserProjectService : IService { - void SaveFollowedProjectAsync(int userId, int projectId); - - - /// - /// Get a list of all the projects - /// - /// The parameters to filter, sort and paginate the projects - /// A list of all the projects - Task> GetAllWithUsersAsync(ProjectFilterParams projectFilterParams); - - Task FindWithUserAndCollaboratorsAsync(int id); - - /// - /// Get the number of projects - /// - /// The parameters to filter, sort and paginate the projects - /// The number of projects - Task ProjectsCount(ProjectFilterParams projectFilterParams); - - /// - /// Get the total number of pages for the results - /// - /// The parameters to filter, sort and paginate the projects - /// The total number of pages for the results - Task GetProjectsTotalPages(ProjectFilterParams projectFilterParams); - bool CheckIfUserFollows(int userId,int projectId); - } public class UserProjectService : Service, IUserProjectService { - public UserProjectService(IUserProjectRepository repository) : base(repository) { } protected new IUserProjectRepository Repository => (IUserProjectRepository) base.Repository; - public void Add(UserProject entity) + public override void Add(UserProject entity) { Repository.Add(entity); } - public Task AddAsync(UserProject entity) - { - throw new NotImplementedException(); - } - - public void AddRange(IEnumerable entities) - { - throw new NotImplementedException(); - } - - public Task FindWithUserAndCollaboratorsAsync(int id) - { - throw new NotImplementedException(); - } - - public Task> GetAllWithUsersAsync(ProjectFilterParams projectFilterParams) - { - throw new NotImplementedException(); - } - - public Task GetProjectsTotalPages(ProjectFilterParams projectFilterParams) + public void Remove(UserProject userProject) { - throw new NotImplementedException(); - } - - public Task ProjectsCount(ProjectFilterParams projectFilterParams) - { - throw new NotImplementedException(); - } - - public void Remove(int id) - { - //Repository.Remove(entity); - Repository.RemoveUserProjectAsync(id); - } - - public void SaveFollowedProjectAsync(int userId, int projectId) - { - throw new NotImplementedException(); - } - - public void Update(UserProject entity) - { - throw new NotImplementedException(); + Repository.Remove(userProject); } bool IUserProjectService.CheckIfUserFollows(int userId, int projectId) @@ -125,16 +56,5 @@ bool IUserProjectService.CheckIfUserFollows(int userId, int projectId) } return false; } - - Task IService.FindAsync(int id) - { - throw new NotImplementedException(); - } - - Task> IService.GetAll() - { - throw new NotImplementedException(); - } } - } From de8b4dd74317679eadadd7a7940296c9b51ed55b Mon Sep 17 00:00:00 2001 From: I380210 Date: Tue, 29 Sep 2020 16:46:39 +0200 Subject: [PATCH 031/157] Dropped table UserFolledProjects --- Data/4_Data.csproj | 2 + ...20200929144427_InitUserProject.Designer.cs | 302 ++++++++++++++++++ .../20200929144427_InitUserProject.cs | 89 ++++++ .../ApplicationDbContextModelSnapshot.cs | 8 +- 4 files changed, 397 insertions(+), 4 deletions(-) create mode 100644 Data/Migrations/20200929144427_InitUserProject.Designer.cs create mode 100644 Data/Migrations/20200929144427_InitUserProject.cs diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index 4689afe1..626748a0 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -12,6 +12,8 @@ + + diff --git a/Data/Migrations/20200929144427_InitUserProject.Designer.cs b/Data/Migrations/20200929144427_InitUserProject.Designer.cs new file mode 100644 index 00000000..0a9d98ae --- /dev/null +++ b/Data/Migrations/20200929144427_InitUserProject.Designer.cs @@ -0,0 +1,302 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200929144427_InitUserProject")] + partial class InitUserProject + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProject") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200929144427_InitUserProject.cs b/Data/Migrations/20200929144427_InitUserProject.cs new file mode 100644 index 00000000..31a58752 --- /dev/null +++ b/Data/Migrations/20200929144427_InitUserProject.cs @@ -0,0 +1,89 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class InitUserProject : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + migrationBuilder.CreateTable( + name: "UserProject", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProjectId = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserProject", x => x.Id); + table.ForeignKey( + name: "FK_UserProject_Project_ProjectId", + column: x => x.ProjectId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_UserProject_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_UserProject_ProjectId", + table: "UserProject", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_UserProject_UserId", + table: "UserProject", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "UserProject"); + + migrationBuilder.CreateTable( + name: "UserFollowedProjects", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProjectId = table.Column(type: "int", nullable: true), + UserId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserFollowedProjects", x => x.Id); + table.ForeignKey( + name: "FK_UserFollowedProjects_Project_ProjectId", + column: x => x.ProjectId, + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_UserFollowedProjects_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_UserFollowedProjects_ProjectId", + table: "UserFollowedProjects", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_UserFollowedProjects_UserId", + table: "UserFollowedProjects", + column: "UserId"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 08d73d79..97c72f1c 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -202,7 +202,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("User"); }); - modelBuilder.Entity("Models.UserFollowedProject", b => + modelBuilder.Entity("Models.UserProject", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -221,7 +221,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("UserFollowedProjects"); + b.ToTable("UserProject"); }); modelBuilder.Entity("Models.Collaborator", b => @@ -282,14 +282,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("RoleId"); }); - modelBuilder.Entity("Models.UserFollowedProject", b => + modelBuilder.Entity("Models.UserProject", b => { b.HasOne("Models.Project", "Project") .WithMany() .HasForeignKey("ProjectId"); b.HasOne("Models.User", "User") - .WithMany("UserFollowedProjects") + .WithMany("UserProject") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); From 7b7290c2a48f7125b40b85ec5e40a2e6e04f1c68 Mon Sep 17 00:00:00 2001 From: I380210 Date: Wed, 30 Sep 2020 10:50:55 +0200 Subject: [PATCH 032/157] Models,resources,repository for UserUser linking table This commit makes it possible to follow other users. This commit includes the model,repository,service,dbset needed for following a user. Co-Authored-By: Dave Bouman <49709450+DaveBouman@users.noreply.github.com> --- API/Controllers/UserController.cs | 56 +++++++++++++++- .../DependencyInjectionExtensions.cs | 3 + API/Resources/UserUserResource.cs | 27 ++++++++ API/Resources/UserUserResourceResult.cs | 32 +++++++++ Data/ApplicationDbContext.cs | 1 + Models/User.cs | 2 + Models/UserUser.cs | 22 +++++++ Repositories/UserUserRepository.cs | 66 +++++++++++++++++++ Services/Services/UserUserService.cs | 59 +++++++++++++++++ 9 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 API/Resources/UserUserResource.cs create mode 100644 API/Resources/UserUserResourceResult.cs create mode 100644 Models/UserUser.cs create mode 100644 Repositories/UserUserRepository.cs create mode 100644 Services/Services/UserUserService.cs diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 569569e1..ef3d234c 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -43,6 +43,7 @@ public class UserController : ControllerBase private readonly IRoleService roleService; private readonly IProjectService projectService; private readonly IUserProjectService userProjectService; + private readonly IUserUserService userUserService; /// /// Initializes a new instance of the class. @@ -50,13 +51,14 @@ public class UserController : ControllerBase /// The user service. /// The mapper. /// The role service. - public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserProjectService userProjectService, IProjectService projectService) + public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserProjectService userProjectService, IProjectService projectService,IUserUserService userUserService) { this.userService = userService; this.mapper = mapper; this.roleService = roleService; this.projectService = projectService; this.userProjectService = userProjectService; + this.userUserService = userUserService; } /// @@ -361,5 +363,57 @@ public async Task DeleteAccount(int userId) userService.Save(); return Ok(); } + + /// + /// Follows user + /// + /// + /// + [HttpPost("follow/{userId}")] + [Authorize] + public async Task FollowUser(int followedUserId) + { + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + if(await userService.FindAsync(user.Id) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the user account.", + Detail = "The database does not contain a user with this user id.", + Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" + }; + return NotFound(problem); + } + + if(userUserService.CheckIfUserFollows(user.Id, followedUserId)) + { + ProblemDetails problem = new ProblemDetails + { + Title = "You are already following this user", + Detail = "You are already following this user.", + Instance = "6B4D9745-4A18-4516-86A3-466678A3F891" + }; + return Conflict(problem); + } + + User followedUser = await userService.FindAsync(followedUserId); + + if(await userService.FindAsync(followedUserId) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the user", + Detail = "Unable to find user to follow", + Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" + }; + return NotFound(problem); + } + UserUser userUser = new UserUser(user, followedUser); + userUserService.Add(userUser); + + userUserService.Save(); + return Ok(); + } } } diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 63087a97..900dd38b 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -67,6 +67,9 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + return services; } } diff --git a/API/Resources/UserUserResource.cs b/API/Resources/UserUserResource.cs new file mode 100644 index 00000000..22012b1a --- /dev/null +++ b/API/Resources/UserUserResource.cs @@ -0,0 +1,27 @@ +using Models; + +namespace API.Resources +{ + /// + /// The view model result of UserUser + /// + public class UserUserResource + { + /// + /// Get or Set Id of a useruser + /// + public int Id { get; set; } + /// + /// This gets or sets the user + /// + public User User { get; set; } + /// + /// user id + /// + public int UserId { get; set; } + /// + /// This gets or sets the followed user + /// + public User Followeduser { get; set; } + } +} diff --git a/API/Resources/UserUserResourceResult.cs b/API/Resources/UserUserResourceResult.cs new file mode 100644 index 00000000..743fc73a --- /dev/null +++ b/API/Resources/UserUserResourceResult.cs @@ -0,0 +1,32 @@ +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + /// + /// Object to return to frontend with the UserUser + /// + public class UserUserResourceResult + { + /// + /// PK of UserUser + /// + public int Id { get; set; } + /// + /// Set or get user + /// + public User User{ get; set; } + /// + /// set or get User + /// + public int UserId { get; set; } + + /// + /// User object to follow + /// + public User Followeduser { get; set; } + } +} diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index 87223e45..ea509549 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -77,6 +77,7 @@ public ApplicationDbContext(DbContextOptions options) : ba public DbSet Role { get; set; } public DbSet UserProject { get; set; } + public DbSet UserUser { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { diff --git a/Models/User.cs b/Models/User.cs index cafe47b4..59441b68 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -29,6 +29,7 @@ public User() Projects = new List(); Services = new List(); UserProject = new List(); + UserUser = new List(); } public int Id { get; set; } @@ -49,6 +50,7 @@ public User() public List Services { get; set; } public List UserProject { get; set; } + public List UserUser { get; set; } public string ProfileUrl { get; set; } diff --git a/Models/UserUser.cs b/Models/UserUser.cs new file mode 100644 index 00000000..9a6ecd62 --- /dev/null +++ b/Models/UserUser.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Models +{ + public class UserUser + { + public UserUser(User user, User followedUser) + { + User = user; + FollowedUser = followedUser; + } + + public int Id { get; set; } + + public User User { get; set; } + public int Userid { get; set; } + + public User FollowedUser { get; set; } + } +} diff --git a/Repositories/UserUserRepository.cs b/Repositories/UserUserRepository.cs new file mode 100644 index 00000000..9105981e --- /dev/null +++ b/Repositories/UserUserRepository.cs @@ -0,0 +1,66 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Microsoft.EntityFrameworkCore; +using Models; +using Repositories.Base; +using System.Linq; + +namespace Repositories +{ + + public interface IUserUserRepository : IRepository + { + bool CheckIfUserFollows(int userId,int followedUserId); + } + + public class UserUserRepository : Repository, IUserUserRepository + { + public UserUserRepository(DbContext dbContext) : base(dbContext) { } + + public override void Add(UserUser userUser) + { + DbContext.Add(userUser); + } + + public override void Remove(UserUser userUser) + { + UserUser userUnfollow = GetDbSet() + .Where + (s => s.Userid == userUser.Id + && s.FollowedUser.Id == userUser.FollowedUser.Id) + .SingleOrDefault(); + + GetDbSet() + .Remove(userUnfollow); + } + + bool IUserUserRepository.CheckIfUserFollows(int userId, int followedUserId) + { + UserUser userUser = GetDbSet() + .Where(s => (s.Userid == userId) + && s.FollowedUser.Id == followedUserId) + .SingleOrDefault(); + + if(userUser != null) + { + return true; + } + return false; + } + } +} diff --git a/Services/Services/UserUserService.cs b/Services/Services/UserUserService.cs new file mode 100644 index 00000000..0edd7488 --- /dev/null +++ b/Services/Services/UserUserService.cs @@ -0,0 +1,59 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Ganss.XSS; +using Models; +using Repositories; +using Services.Base; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; + +namespace Services.Services +{ + public interface IUserUserService : IService + { + bool CheckIfUserFollows(int userId,int follwedUserId); + } + + public class UserUserService : Service, IUserUserService + { + public UserUserService(IUserUserRepository repository) : base(repository) { } + + protected new IUserUserRepository Repository => (IUserUserRepository) base.Repository; + + public override void Add(UserUser entity) + { + Repository.Add(entity); + } + + public override void Remove(UserUser userUser) + { + Repository.Remove(userUser); + } + + bool IUserUserService.CheckIfUserFollows(int userId, int follwedUserId) + { + if(Repository.CheckIfUserFollows(userId, follwedUserId)) + { + return true; + } + return false; + } + } +} From 543456d3b8697dc7939c1054dbae62f9295f55d6 Mon Sep 17 00:00:00 2001 From: I380210 Date: Wed, 30 Sep 2020 13:28:56 +0200 Subject: [PATCH 033/157] Changed end points in user controller for following users or projects Added inversed props for linking table --- API/Configuration/MappingProfile.cs | 3 + API/Controllers/UserController.cs | 60 +++- Data/4_Data.csproj | 2 + Data/ApplicationDbContext.cs | 1 - ...200930110730_InitUserUserTable.Designer.cs | 337 ++++++++++++++++++ .../20200930110730_InitUserUserTable.cs | 52 +++ .../ApplicationDbContextModelSnapshot.cs | 35 ++ Models/User.cs | 6 +- Models/UserUser.cs | 7 +- Repositories/UserUserRepository.cs | 4 +- 10 files changed, 494 insertions(+), 13 deletions(-) create mode 100644 Data/Migrations/20200930110730_InitUserUserTable.Designer.cs create mode 100644 Data/Migrations/20200930110730_InitUserUserTable.cs diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 6bac6027..78d73fdb 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -35,6 +35,9 @@ public MappingProfile() .ForMember(q => q.UserProject, options => options.MapFrom(q => q.Project.Name)) .ForAllOtherMembers(o => o.Ignore()); + CreateMap(); + CreateMap(); + CreateMap(); CreateMap(); diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index ef3d234c..cca7e38c 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -227,7 +227,7 @@ public async Task DeleteAccount() /// /// /// 200 if success 409 if user already follows project - [HttpPost("follow/{projectId}")] + [HttpPost("follow/project/{projectId}")] [Authorize] public async Task FollowProject(int projectId) { @@ -279,7 +279,7 @@ public async Task FollowProject(int projectId) /// /// /// - [HttpDelete("follow/{projectId}")] + [HttpDelete("follow/project/{projectId}")] [Authorize] public async Task UnfollowProject(int projectId) { @@ -369,7 +369,7 @@ public async Task DeleteAccount(int userId) /// /// /// - [HttpPost("follow/{userId}")] + [HttpPost("follow/user/{followedUserId}")] [Authorize] public async Task FollowUser(int followedUserId) { @@ -409,11 +409,63 @@ public async Task FollowUser(int followedUserId) }; return NotFound(problem); } - UserUser userUser = new UserUser(user, followedUser); + UserUser userUser = new UserUser(user,followedUser); userUserService.Add(userUser); userUserService.Save(); return Ok(); } + + /// + /// Unfollow user + /// + /// + /// + [HttpDelete("follow/user/{followedUserId}")] + [Authorize] + public async Task UnfollowUser(int followedUserId) + { + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + if(await userService.FindAsync(user.Id) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the user account.", + Detail = "The database does not contain a user with this user id.", + Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" + }; + return NotFound(problem); + } + + if(userUserService.CheckIfUserFollows(user.Id, followedUserId) == false) + { + ProblemDetails problem = new ProblemDetails + { + Title = "User is not following this user", + Detail = "You are not following this user.", + Instance = "103E6317-4546-4985-8E39-7D9FD3E14E35" + }; + return Conflict(problem); + } + + User followedUser= await userService.FindAsync(followedUserId); + + if(await userService.FindAsync(followedUserId) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the project.", + Detail = "The database does not contain a project with this project id.", + Instance = "ED4E8B26-7D7B-4F5E-BA04-983B5F114FB5" + }; + return NotFound(problem); + } + UserUser userToUnfollow = new UserUser(user, followedUser); + userUserService.Remove(userToUnfollow); + + userUserService.Save(); + return Ok(); + } } } diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index 626748a0..296ba1ec 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -14,6 +14,8 @@ + + diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index ea509549..01bbb5ce 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -87,7 +87,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.ApplyConfiguration(new UserConfiguration()); modelBuilder.ApplyConfiguration(new ProjectConfiguration()); } - } } diff --git a/Data/Migrations/20200930110730_InitUserUserTable.Designer.cs b/Data/Migrations/20200930110730_InitUserUserTable.Designer.cs new file mode 100644 index 00000000..79543ecc --- /dev/null +++ b/Data/Migrations/20200930110730_InitUserUserTable.Designer.cs @@ -0,0 +1,337 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200930110730_InitUserUserTable")] + partial class InitUserUserTable + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FollowedUserId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FollowedUserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserUser"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProject") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.HasOne("Models.User", "FollowedUser") + .WithMany("FollowedUsers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20200930110730_InitUserUserTable.cs b/Data/Migrations/20200930110730_InitUserUserTable.cs new file mode 100644 index 00000000..5bd854e0 --- /dev/null +++ b/Data/Migrations/20200930110730_InitUserUserTable.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class InitUserUserTable : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "UserUser", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + UserId = table.Column(nullable: true), + FollowedUserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserUser", x => x.Id); + table.ForeignKey( + name: "FK_UserUser_User_FollowedUserId", + column: x => x.FollowedUserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_UserUser_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_UserUser_FollowedUserId", + table: "UserUser", + column: "FollowedUserId"); + + migrationBuilder.CreateIndex( + name: "IX_UserUser_UserId", + table: "UserUser", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "UserUser"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 97c72f1c..6acb4937 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -224,6 +224,28 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("UserProject"); }); + modelBuilder.Entity("Models.UserUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FollowedUserId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FollowedUserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserUser"); + }); + modelBuilder.Entity("Models.Collaborator", b => { b.HasOne("Models.Project", null) @@ -294,6 +316,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.HasOne("Models.User", "FollowedUser") + .WithMany("FollowedUsers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); #pragma warning restore 612, 618 } } diff --git a/Models/User.cs b/Models/User.cs index 59441b68..93116460 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -17,6 +17,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace Models { @@ -29,7 +30,7 @@ public User() Projects = new List(); Services = new List(); UserProject = new List(); - UserUser = new List(); + FollowedUsers = new List(); } public int Id { get; set; } @@ -50,7 +51,8 @@ public User() public List Services { get; set; } public List UserProject { get; set; } - public List UserUser { get; set; } + [InverseProperty("FollowedUser")] + public List FollowedUsers { get; set; } public string ProfileUrl { get; set; } diff --git a/Models/UserUser.cs b/Models/UserUser.cs index 9a6ecd62..b46fea91 100644 --- a/Models/UserUser.cs +++ b/Models/UserUser.cs @@ -11,12 +11,11 @@ public UserUser(User user, User followedUser) User = user; FollowedUser = followedUser; } + public UserUser() { } public int Id { get; set; } - - public User User { get; set; } - public int Userid { get; set; } - + public User User{ get; set; } public User FollowedUser { get; set; } + public int FollowedUserId { get; set; } } } diff --git a/Repositories/UserUserRepository.cs b/Repositories/UserUserRepository.cs index 9105981e..40e44385 100644 --- a/Repositories/UserUserRepository.cs +++ b/Repositories/UserUserRepository.cs @@ -41,7 +41,7 @@ public override void Remove(UserUser userUser) { UserUser userUnfollow = GetDbSet() .Where - (s => s.Userid == userUser.Id + (s => s.User.Id == userUser.User.Id && s.FollowedUser.Id == userUser.FollowedUser.Id) .SingleOrDefault(); @@ -52,7 +52,7 @@ public override void Remove(UserUser userUser) bool IUserUserRepository.CheckIfUserFollows(int userId, int followedUserId) { UserUser userUser = GetDbSet() - .Where(s => (s.Userid == userId) + .Where(s => (s.User.Id == userId) && s.FollowedUser.Id == followedUserId) .SingleOrDefault(); From 8a0d8f272007f6a7c82c0018bd9c3fed1ec97c43 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Wed, 30 Sep 2020 15:57:06 +0200 Subject: [PATCH 034/157] added attributes for validation of file extension and max file size to FileResource --- API/Extensions/AllowedExtensionsAttribute.cs | 40 ++++++++++++++++++++ API/Extensions/MaxFileSizeAttribute.cs | 38 +++++++++++++++++++ API/Resources/FileResource.cs | 5 +++ 3 files changed, 83 insertions(+) create mode 100644 API/Extensions/AllowedExtensionsAttribute.cs create mode 100644 API/Extensions/MaxFileSizeAttribute.cs diff --git a/API/Extensions/AllowedExtensionsAttribute.cs b/API/Extensions/AllowedExtensionsAttribute.cs new file mode 100644 index 00000000..9365e620 --- /dev/null +++ b/API/Extensions/AllowedExtensionsAttribute.cs @@ -0,0 +1,40 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Extensions +{ + public class AllowedExtensionsAttribute : ValidationAttribute + { + private readonly string[] _extensions; + public AllowedExtensionsAttribute(string[] extensions) + { + _extensions = extensions; + } + + protected override ValidationResult IsValid( + object value, ValidationContext validationContext) + { + var file = value as IFormFile; + var extension = Path.GetExtension(file.FileName); + if(file != null) + { + if(!_extensions.Contains(extension.ToLower())) + { + return new ValidationResult(GetErrorMessage()); + } + } + + return ValidationResult.Success; + } + + public string GetErrorMessage() + { + return $"This photo extension is not allowed!"; + } + } +} diff --git a/API/Extensions/MaxFileSizeAttribute.cs b/API/Extensions/MaxFileSizeAttribute.cs new file mode 100644 index 00000000..41bfd974 --- /dev/null +++ b/API/Extensions/MaxFileSizeAttribute.cs @@ -0,0 +1,38 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Extensions +{ + public class MaxFileSizeAttribute : ValidationAttribute + { + private readonly int _maxFileSize; + public MaxFileSizeAttribute(int maxFileSize) + { + _maxFileSize = maxFileSize; + } + + protected override ValidationResult IsValid( + object value, ValidationContext validationContext) + { + var file = value as IFormFile; + if(file != null) + { + if(file.Length > _maxFileSize) + { + return new ValidationResult(GetErrorMessage()); + } + } + + return ValidationResult.Success; + } + + public string GetErrorMessage() + { + return $"Maximum allowed file size is { _maxFileSize} bytes."; + } + } +} diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs index 5ecdc59c..fd634bb7 100644 --- a/API/Resources/FileResource.cs +++ b/API/Resources/FileResource.cs @@ -15,10 +15,12 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.Extensions; using Microsoft.AspNetCore.Http; using Models; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; @@ -34,6 +36,9 @@ public class FileResource /// /// IFormFile /// + [Required(ErrorMessage = "Please add a file")] + [AllowedExtensions(new [] { ".jpg", ".png", ".jpeg"})] + [MaxFileSize(2097152)] public IFormFile File { get; set; } /// /// Date and time of uploading From 965eeda70a52776a7747b3e2d84b728bb7b73c00 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Mon, 5 Oct 2020 13:40:05 +0200 Subject: [PATCH 035/157] added public resources folder --- API/Controllers/FileController.cs | 2 +- API/Controllers/ProjectController.cs | 4 +- API/Extensions/FileUploader.cs | 16 ++++- API/Startup.cs | 104 ++++++++++++++++----------- API/files/.gitkeep | 1 - API/wwwroot/Resources/.gitkeep | 1 + 6 files changed, 80 insertions(+), 48 deletions(-) delete mode 100644 API/files/.gitkeep create mode 100644 API/wwwroot/Resources/.gitkeep diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index ca001131..6369ae10 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -108,7 +108,7 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe DateTime uploadDateTime = DateTime.Now; int fileExtPos = fileResource.File.FileName.LastIndexOf("."); string extension = fileResource.File.FileName.Substring(fileExtPos); - string newFileName = fileUploader.RemoveSpecialCharacters(fileResource.File.FileName.Remove(fileExtPos) + uploadDateTime + extension); + string newFileName = fileUploader.RemoveSpecialCharacters(fileResource.File.FileName.Remove(fileExtPos) + Guid.NewGuid() + extension); string path = await fileUploader.UploadSingleFile(fileResource.File, newFileName); User user = await HttpContext.GetContextUser(userService) .ConfigureAwait(false); diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index d4c85530..0a6a801e 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -43,7 +43,6 @@ public class ProjectController : ControllerBase private readonly IProjectService projectService; private readonly IUserService userService; private readonly IFileService fileService; - private readonly IFileUploader fileUploader; /// /// Initializes a new instance of the class. @@ -53,12 +52,11 @@ public class ProjectController : ControllerBase /// The fileservice. /// The fileuploader. /// The mapper. - public ProjectController(IProjectService projectService, IUserService userService, IFileService fileService, IFileUploader fileUploader, IMapper mapper) + public ProjectController(IProjectService projectService, IUserService userService, IFileService fileService, IMapper mapper) { this.projectService = projectService; this.userService = userService; this.fileService = fileService; - this.fileUploader = fileUploader; this.mapper = mapper; } diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index 124c41f0..dfcb8e08 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -1,5 +1,10 @@ +using AngleSharp; +using AngleSharp.Io; using API.Resources; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Routing; using Microsoft.CodeAnalysis.CSharp.Syntax; using Serilog; using System; @@ -63,7 +68,14 @@ public interface IFileUploader public class FileUploader : IFileUploader { - private static readonly string UploadPath = Directory.GetCurrentDirectory() + "\\files\\"; + private readonly string UploadPath; + private readonly string ServerRoot; + + public FileUploader(IWebHostEnvironment env) + { + UploadPath = Path.Combine(env.WebRootPath, "Resources\\"); + ServerRoot = Path.Combine("https://localhost:5001/Resources/"); + } /// /// Removes special characters for string to avoid problems @@ -104,7 +116,7 @@ public async Task UploadSingleFile(IFormFile file, string fileName) } } - return UploadPath + fileName; + return ServerRoot + fileName; } throw new FileExistException(fileName); diff --git a/API/Startup.cs b/API/Startup.cs index c0a50b38..ad0215c6 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -24,9 +24,11 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Logging; using Microsoft.OpenApi.Models; @@ -38,6 +40,7 @@ using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; +using System.IO; using System.Linq; using System.Threading.Tasks; @@ -189,7 +192,7 @@ public void ConfigureServices(IServiceCollection services) /// The env. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { - UpdateDatabase(app,env); + UpdateDatabase(app, env); if(env.IsDevelopment()) { //app.UseBrowserLink(); @@ -226,52 +229,61 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthentication(); app.UseAuthorization(); + + //UserInfo app.UseWhen(context => - context.User.Identities.Any(i => i.IsAuthenticated), appBuilder => - { - appBuilder.Use(async (context, next) => - { - DbContext dbContext = context.RequestServices.GetService(); - IUserService userService = - context.RequestServices.GetService(); - string identityId = ""; - try - { - identityId = context.User.GetIdentityId(context); - } catch(UnauthorizedAccessException e) + context.User.Identities.Any(i => i.IsAuthenticated), + appBuilder => { - Log.Logger.Error(e, "User is not authorized."); - await next(); - } - if(await userService.GetUserByIdentityIdAsync(identityId).ConfigureAwait(false) == null) - { - IRoleService roleService = context.RequestServices.GetService(); - Role registeredUserRole = (await roleService.GetAll()).FirstOrDefault(i => i.Name == nameof(Defaults.Roles.RegisteredUser)); - - User newUser = context.GetUserInformation(Config); - if(newUser == null) + appBuilder.Use(async (context, next) => { - // Then it probably belongs swagger so we set the username as developer. - newUser = new User() + DbContext dbContext = context.RequestServices.GetService(); + IUserService userService = + context.RequestServices.GetService(); + string identityId = ""; + try { - Name = "Developer", - Email = "Developer@DEX.com", - IdentityId = identityId, - Role = registeredUserRole - }; - userService.Add(newUser); - } else - { - newUser.Role = registeredUserRole; - userService.Add(newUser); - } - await dbContext.SaveChangesAsync().ConfigureAwait(false); - } + identityId = context.User.GetIdentityId(context); + } catch(UnauthorizedAccessException e) + { + Log.Logger.Error(e, "User is not authorized."); + await next(); + } + if(await userService.GetUserByIdentityIdAsync(identityId) + .ConfigureAwait(false) == + null) + { + IRoleService roleService = context.RequestServices.GetService(); + Role registeredUserRole = + (await roleService.GetAll()).FirstOrDefault( + i => i.Name == nameof(Defaults.Roles.RegisteredUser)); - await next().ConfigureAwait(false); - }); - }); + User newUser = context.GetUserInformation(Config); + if(newUser == null) + { + // Then it probably belongs swagger so we set the username as developer. + newUser = new User() + { + Name = "Developer", + Email = "Developer@DEX.com", + IdentityId = identityId, + Role = registeredUserRole + }; + userService.Add(newUser); + } else + { + newUser.Role = registeredUserRole; + userService.Add(newUser); + } + await dbContext.SaveChangesAsync() + .ConfigureAwait(false); + } + + await next() + .ConfigureAwait(false); + }); + }); app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute()); @@ -285,7 +297,17 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) o.OAuthClientId(Config.Swagger.ClientId); }); + // using Microsoft.Extensions.FileProviders; + // using System.IO; app.UseStaticFiles(); + + app.UseFileServer(new FileServerOptions + { + FileProvider = new PhysicalFileProvider( + Path.Combine(env.WebRootPath, "Resources")), + RequestPath = "/Resources", + EnableDirectoryBrowsing = true + }); } /// diff --git a/API/files/.gitkeep b/API/files/.gitkeep deleted file mode 100644 index 5f282702..00000000 --- a/API/files/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/API/wwwroot/Resources/.gitkeep b/API/wwwroot/Resources/.gitkeep new file mode 100644 index 00000000..e02abfc9 --- /dev/null +++ b/API/wwwroot/Resources/.gitkeep @@ -0,0 +1 @@ + From 66ade0c9785616f8644afcacdf9f1b6a5cafdebf Mon Sep 17 00:00:00 2001 From: I380210 Date: Tue, 6 Oct 2020 09:21:10 +0200 Subject: [PATCH 036/157] Update dex.postman_collection.json --- Postman/dex.postman_collection.json | 824 +++++++++++++++++++++------- 1 file changed, 619 insertions(+), 205 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index ef7aa50d..47c3dbee 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "87bcd92b-930f-4092-aee5-59f6a37737c1", + "_postman_id": "4c6d78aa-2bbc-4505-93d1-c1846ab50b11", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "3415efeb-08b1-44a9-8340-238db3c6120e", + "id": "1a66471b-1e40-4815-b5f6-c3fb2b2e8fd8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "529a2b71-6558-4305-b9cf-047fc3ac6dbd", + "id": "877f7f20-3b0c-447f-948b-092f40cede71", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -128,13 +128,68 @@ { "name": "User", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "User-FollowUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "94f54dfd-89dd-45a8-ac76-35c00e370aba", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "var userName = pm.environment.get(\"userName\");\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"createdUserId\", jsonData.id);\r", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Check if created Username matches: \" + userName, function () {\r", + " pm.expect(jsonData.name).to.eql(userName);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "url": { + "raw": "" + }, + "description": "follow a user" + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "User-CreateUser-Administrator", "event": [ { "listen": "test", "script": { - "id": "9ae54e26-f32f-4e93-9ca2-f0046952b3ab", + "id": "39a57a69-a92b-45eb-84e8-4b6773e67c57", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -203,7 +258,7 @@ { "listen": "test", "script": { - "id": "7ab5f5ae-8d87-4092-8e14-ef664094da3e", + "id": "3f97d1ff-21c0-4d6e-8521-2f22cf5049cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -271,7 +326,7 @@ { "listen": "test", "script": { - "id": "7ee1bd20-dd09-4f12-a414-df18d91967dc", + "id": "38406795-99dd-4e5a-a8f2-b95f96868388", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -339,7 +394,7 @@ { "listen": "test", "script": { - "id": "0ae34c24-10b2-4c98-8521-2531967cdde1", + "id": "4113b3dc-eac1-4b89-a21b-9d3929cbf399", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -414,7 +469,7 @@ { "listen": "test", "script": { - "id": "dc34176a-f766-4622-b7fb-489d9257ab3a", + "id": "b2235654-c18d-4b7d-939b-602924f01da8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -445,7 +500,7 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [ { "key": "IdentityId", @@ -479,7 +534,7 @@ { "listen": "test", "script": { - "id": "6f6ffe45-f584-48d2-b36b-63bb5d22dc93", + "id": "d61393e3-8548-41e7-bcc9-82828fea65ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -557,7 +612,7 @@ { "listen": "test", "script": { - "id": "692a4bef-ba4d-40c4-88db-599b546e614b", + "id": "2c863cf6-a428-4359-9f9e-548d78446f87", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -630,7 +685,7 @@ { "listen": "test", "script": { - "id": "243b137c-9c9d-4c76-a62f-ff97e45bc4da", + "id": "fe9eda6f-c02b-41d4-a2cc-07b30e54ddcb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -699,7 +754,7 @@ { "listen": "test", "script": { - "id": "38fafdfc-6fa1-4eda-b75c-63bbfad94687", + "id": "c4c1a16c-c1a3-4136-8a53-6fd0be5431b4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -767,7 +822,7 @@ { "listen": "test", "script": { - "id": "6e881525-5aec-4544-89fd-b6c2bd2578ed", + "id": "54725aa6-72bd-4c23-a6df-5d6b1e60cabe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -835,7 +890,7 @@ { "listen": "test", "script": { - "id": "c25fafdf-d646-4931-9d6c-8c3169bb5bad", + "id": "e4c8b9cb-1fa4-408b-8c16-04961dde95d2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -895,7 +950,7 @@ { "listen": "test", "script": { - "id": "99b117cd-ec8a-4c09-aa1b-e83a9bad5c20", + "id": "e97c451d-4366-4c6d-9ceb-cd8c5e4a8684", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -924,7 +979,7 @@ { "listen": "prerequest", "script": { - "id": "6ce4d831-9f1c-4d38-8fed-9db80d720c28", + "id": "2851e3e3-e4d0-4839-87c2-d9d3340404ca", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -974,7 +1029,7 @@ { "listen": "test", "script": { - "id": "06de7116-ef01-45b6-b11c-f7aa2378ef30", + "id": "2cfe31e9-7fc9-467d-b676-6790f1e54dad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1043,7 +1098,7 @@ { "listen": "test", "script": { - "id": "9ce218a2-1db9-47b6-82e1-721e4852ea06", + "id": "019f2d15-3d25-418c-860c-1917145fc59c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1105,7 +1160,7 @@ { "listen": "test", "script": { - "id": "7620b4e0-46e5-417f-9f0a-38f70a2a27d8", + "id": "271e79a5-ddc3-44d8-ab01-b5a967540077", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1192,7 +1247,7 @@ { "listen": "test", "script": { - "id": "6fb79dd8-0d96-45ca-a6e6-c68f6c08aed6", + "id": "67f60ae3-5548-4109-a4df-52d5e1868c61", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1224,7 +1279,7 @@ { "listen": "prerequest", "script": { - "id": "6d9a50d2-ce3d-489b-969f-a2fef5c9117b", + "id": "2b9f6333-d10f-49c0-81cf-52231cfbad56", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1271,7 +1326,7 @@ { "listen": "test", "script": { - "id": "58a90678-3a2a-4eb4-800c-27a7274ac14c", + "id": "457b9fc9-fcca-450c-8c1e-7e9127b9688b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1338,7 +1393,7 @@ { "listen": "test", "script": { - "id": "43688dbf-597e-4439-a1ed-ae00851cbc02", + "id": "9782026b-8f7e-40a7-b050-411d25f0eef9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1399,7 +1454,7 @@ { "listen": "test", "script": { - "id": "d2d1fbd9-c0c9-401b-a86d-0c9c6bd94899", + "id": "ed85d1d2-b21b-4072-89dc-fa5de22e296d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1463,7 +1518,7 @@ { "listen": "test", "script": { - "id": "cc59531f-b92f-4cff-82d3-fc0a2a17b4c7", + "id": "1690e619-382d-45aa-b88d-8b9e795a792d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1532,7 +1587,7 @@ { "listen": "test", "script": { - "id": "186b9cb8-7125-4b08-b316-dab397482f0c", + "id": "fefd4466-3278-46db-9db5-61847e44f5e0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1590,7 +1645,7 @@ { "listen": "test", "script": { - "id": "126613ae-0354-4881-8138-93075187cecd", + "id": "e8da1a0e-329c-4826-b2cd-6c5dad774d5a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1644,7 +1699,7 @@ { "listen": "test", "script": { - "id": "e26cf186-056e-40bd-ac3a-c4f2ec56e8d2", + "id": "1f055dca-69b8-4297-99a1-c5321398e464", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1705,7 +1760,7 @@ { "listen": "test", "script": { - "id": "70355788-9a5f-4e33-b285-b1bdf43be5ab", + "id": "0b2a1f2c-fec9-488c-888b-573b921c960f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -1778,7 +1833,7 @@ { "listen": "test", "script": { - "id": "a42659a0-b745-4e81-b433-192af0538ff4", + "id": "e39513c3-a147-437f-a1b5-4c03e76a1437", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -1851,7 +1906,7 @@ { "listen": "test", "script": { - "id": "fa83070e-6ed3-4781-be62-1a5175245e23", + "id": "1c7ea11e-7201-4a24-b257-6bc0d17a8a8e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1917,7 +1972,7 @@ { "listen": "test", "script": { - "id": "b744ac3b-0d32-46a1-8c70-40d6c753f2b5", + "id": "d795bd97-87f7-4d8c-ab20-d3031e1d2d10", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -1976,7 +2031,7 @@ { "listen": "test", "script": { - "id": "557b8d8d-0a68-4e2d-b770-2b8ac1b6fd07", + "id": "c7f0497c-cbe6-43cf-98a0-7a9ca23ce83d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2043,7 +2098,7 @@ { "listen": "test", "script": { - "id": "97c83fc2-a1be-4586-9ab5-f5f670236cb8", + "id": "f1ae0b8e-54ad-4355-b9f9-c49af8676795", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2101,7 +2156,7 @@ { "listen": "test", "script": { - "id": "cee7fcfc-dd5d-4f5a-8b02-7d50ccd0a3cd", + "id": "527f91d5-ad8d-46ce-8069-540188368e15", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2180,7 +2235,7 @@ { "listen": "test", "script": { - "id": "290c4e77-17a1-407d-b27b-d66d50df9b0a", + "id": "604583d4-3ef0-4f82-9f63-3299393322d0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2238,7 +2293,7 @@ { "listen": "test", "script": { - "id": "28e97f5d-4d0c-462e-a1e3-604fd26d7d6c", + "id": "3d393be2-6c48-43c8-9321-1178421b017a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2299,7 +2354,7 @@ { "listen": "test", "script": { - "id": "e06d65ca-6bdd-4e00-8dfb-b0de09a1312b", + "id": "35ff002f-0a1c-4ba9-8f32-fc076a9df016", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2365,7 +2420,7 @@ { "listen": "test", "script": { - "id": "ec4acf5f-6c92-423c-af3b-8dbcd1bbdf81", + "id": "ab7fc434-1e94-4314-ba61-510622ed8109", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2431,7 +2486,7 @@ { "listen": "test", "script": { - "id": "960c6cf7-93ab-450c-bb81-04d3f447c184", + "id": "f9441b5e-6468-402c-9050-1f2ed2cd7eb2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2476,7 +2531,7 @@ { "listen": "test", "script": { - "id": "ccaee888-6fdc-4f95-9037-7c6e8c4cda65", + "id": "519d324d-2050-48fc-8fe0-5f3db727443d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2521,7 +2576,7 @@ { "listen": "test", "script": { - "id": "339fc299-a932-4e93-85dc-92b3003f5444", + "id": "122d06e3-da11-4a10-a8a2-13b5f55aff4e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2566,7 +2621,7 @@ { "listen": "test", "script": { - "id": "37e25c5d-45bb-4728-b863-0a03352f07cf", + "id": "5d07534a-c7b2-4bae-a1a4-be5a1f83e1b0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2611,7 +2666,7 @@ { "listen": "test", "script": { - "id": "a74e4e22-18c1-44cf-b0cd-5109a00622d2", + "id": "bd435066-2722-44b0-9a2c-ac6ea5e487e3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2656,7 +2711,7 @@ { "listen": "test", "script": { - "id": "bf62a4ee-1f18-4975-a19f-404211635efe", + "id": "eac8340a-8d68-45cd-8ad8-5a0922681e69", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2708,7 +2763,7 @@ { "listen": "test", "script": { - "id": "669fd359-8297-4cd7-8f51-f2064aae60fb", + "id": "1bc6d1c9-c7bc-4c78-97a5-9070d46de4a2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2759,7 +2814,7 @@ { "listen": "test", "script": { - "id": "8def5c38-80f8-4ee0-b941-d74197db5104", + "id": "da84d71f-908e-4898-83f9-a898ce10cd5a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2810,7 +2865,7 @@ { "listen": "test", "script": { - "id": "bd3137e6-09e0-458b-a89c-b6eb523a2b90", + "id": "4138c470-08ac-4206-a387-8163c1df0da4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2861,7 +2916,7 @@ { "listen": "test", "script": { - "id": "6ffe6def-a448-46fd-a733-db362f81db95", + "id": "f842c6a4-1a66-4307-9040-6655f27f2850", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2912,7 +2967,7 @@ { "listen": "test", "script": { - "id": "86608f26-8e4f-44cd-b1be-5a5f3f3f8170", + "id": "d8c1d940-c3d6-4581-b266-cc116a0fa4b1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2977,7 +3032,7 @@ { "listen": "test", "script": { - "id": "e7c99083-8bf1-48b1-9d0d-1c77c0f0a22c", + "id": "0c6968b3-5428-45c1-87f4-38526d9c6fb8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3055,7 +3110,7 @@ { "listen": "test", "script": { - "id": "98bbcffa-0abf-4112-81e4-76f6f46c22d1", + "id": "75deb1d3-1c6e-4207-86f4-b96144908cd6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3084,7 +3139,7 @@ { "listen": "prerequest", "script": { - "id": "43fe1d19-fa88-4b79-8dc5-29da48f30794", + "id": "36f4ee88-cb32-479a-a102-e67e71dad85b", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3134,7 +3189,7 @@ { "listen": "test", "script": { - "id": "fd8d86d1-228b-48e5-b212-33cb49e13a8c", + "id": "ae663b53-9e1c-4377-bc32-e63b3e398673", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3198,7 +3253,7 @@ { "listen": "prerequest", "script": { - "id": "889aafe2-90a3-4391-81fe-2044f8db97ed", + "id": "7e3a5b84-6845-41a8-aff2-21b10364fd31", "type": "text/javascript", "exec": [ "" @@ -3208,7 +3263,7 @@ { "listen": "test", "script": { - "id": "4d2f90a8-9f8d-4b40-b408-92b5d446e8a0", + "id": "fa2b34bb-9f3a-4894-96a3-6bf90cb5e1a7", "type": "text/javascript", "exec": [ "" @@ -3228,7 +3283,123 @@ { "listen": "test", "script": { - "id": "f569ba9a-6aca-417c-986d-2cd5add7f5a7", + "id": "4942ccb1-9408-4924-b16b-54dfffb38ce4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-FollowUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "3975ec96-369f-46b0-b497-452ecbc9ea9f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-FollowProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "089e8a95-d3df-4ac7-acc4-67408697854c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3286,7 +3457,7 @@ { "listen": "test", "script": { - "id": "aeb80cf2-6b1d-48a4-aef2-58666f80ee41", + "id": "3b8d73ce-9d75-4e1e-9cdb-e33e26fff397", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3336,7 +3507,7 @@ { "listen": "test", "script": { - "id": "e84179f0-d219-450a-94ea-b8435f7e304c", + "id": "b94ec53e-4628-4cfe-b7fb-7c0ed100e92c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3395,7 +3566,7 @@ { "listen": "test", "script": { - "id": "275a316a-bc58-4237-b451-59181b708141", + "id": "9b01cdbf-1112-4885-84ef-5a44ad7a8e08", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3444,7 +3615,7 @@ { "listen": "prerequest", "script": { - "id": "1d59a311-70a5-41b4-8c7c-ec8e3970fc70", + "id": "d4dd4897-4d7a-48de-bc80-d5606ab80503", "type": "text/javascript", "exec": [ "" @@ -3454,7 +3625,7 @@ { "listen": "test", "script": { - "id": "3a6c58f3-ec2e-431f-ae7d-be0c45b78228", + "id": "76c9fba7-fe09-4b16-b40e-fe89a49be6d0", "type": "text/javascript", "exec": [ "" @@ -3474,7 +3645,7 @@ { "listen": "test", "script": { - "id": "f31eecf3-101e-45d8-896c-93b6829ef997", + "id": "3e462c07-e508-4306-8b95-7557a94f615e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3534,7 +3705,7 @@ { "listen": "test", "script": { - "id": "ed928136-0f9f-4517-a165-88278771235e", + "id": "236f3f80-f62e-4511-b6d0-a4b3993a5b6c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3604,7 +3775,7 @@ { "listen": "test", "script": { - "id": "de8abdfd-be95-41ee-a438-880a78ed9e57", + "id": "58ab0e79-fe53-4681-b341-34afe2642378", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3659,7 +3830,7 @@ { "listen": "test", "script": { - "id": "956adc17-e4e2-481d-a319-fc563430356a", + "id": "2f9e208b-5a8f-4cc8-903b-bc2cc7e29d92", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3716,7 +3887,7 @@ { "listen": "test", "script": { - "id": "4940a995-6afd-4045-a20f-714037ba0df7", + "id": "6f18a740-5476-4be8-bf16-42fcfb1039c4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3765,7 +3936,7 @@ { "listen": "prerequest", "script": { - "id": "9cdb4743-ed03-4229-9b63-994a17209b2a", + "id": "5332822c-ddf6-4ce9-8b20-0481daaa8a26", "type": "text/javascript", "exec": [ "" @@ -3775,7 +3946,7 @@ { "listen": "test", "script": { - "id": "94317dc8-4595-49eb-8ef1-4d7846c54298", + "id": "ec54b55e-b850-440d-9fc7-fefa181c621d", "type": "text/javascript", "exec": [ "" @@ -3795,7 +3966,7 @@ { "listen": "test", "script": { - "id": "d4d0d510-5377-4273-b398-4d9669311a85", + "id": "b6e95ced-1911-46c8-8055-a9193cc92f85", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3822,7 +3993,7 @@ { "listen": "prerequest", "script": { - "id": "b456dde9-2a41-4384-b450-4e88819292ce", + "id": "b28a827f-e5dc-4803-98de-4479d8cb49ad", "exec": [ "" ], @@ -3861,7 +4032,7 @@ { "listen": "test", "script": { - "id": "9f205e7c-a6a0-4141-80ab-31561476a4c0", + "id": "9d2a102d-f73c-46ad-8a97-517668618507", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -3906,7 +4077,7 @@ { "listen": "test", "script": { - "id": "0b25d214-e133-4301-9d50-ddb80d04e8c0", + "id": "2557b49b-0fb6-436f-a106-c2b7b70e9b82", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -3961,7 +4132,7 @@ { "listen": "test", "script": { - "id": "8a56b167-bf41-4b17-be1c-58082dec9824", + "id": "ee616ea3-7ada-47c4-8d89-8c6771ea0a91", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4010,7 +4181,7 @@ { "listen": "test", "script": { - "id": "a9124968-82c1-4d18-a433-9e9a7eefa06c", + "id": "d65c21c4-d620-420e-9686-99925b45a379", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4037,7 +4208,7 @@ { "listen": "prerequest", "script": { - "id": "c44a8d2d-cfde-44c5-91c0-f78ce1011a55", + "id": "afccfc7c-e898-49de-8c85-48025ffab8c2", "exec": [ "" ], @@ -4077,7 +4248,7 @@ { "listen": "test", "script": { - "id": "348f6246-fa7c-4959-90c9-73833a2506b1", + "id": "b416083f-571d-4198-839c-3fac30df8cbe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4126,7 +4297,7 @@ { "listen": "prerequest", "script": { - "id": "d70f8336-aab5-41c5-86c9-21afb9b280e8", + "id": "ace2271a-1cf8-441c-97f9-745ecc7f4dfc", "type": "text/javascript", "exec": [ "" @@ -4136,7 +4307,7 @@ { "listen": "test", "script": { - "id": "e75b3c22-ec2d-4e82-97ed-16158c27a16e", + "id": "9a540bec-5d16-4586-92e7-6dd0c7bd9ad1", "type": "text/javascript", "exec": [ "" @@ -4156,7 +4327,7 @@ { "listen": "test", "script": { - "id": "2ad1d526-a72e-4d0f-b45a-4dc92340f58e", + "id": "8afb37b6-e751-439c-95b4-4948c97fba13", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4211,7 +4382,7 @@ { "listen": "test", "script": { - "id": "32fe3e45-3ac4-47f2-bac2-30334702a3c6", + "id": "6fac0ea0-97bd-4270-88ea-8d4abadd30ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4257,7 +4428,7 @@ { "listen": "test", "script": { - "id": "dcd2885d-69b0-4e2a-a5f0-38b146880df5", + "id": "049f545c-6501-48e4-88ad-436e1e3ad52c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4304,7 +4475,7 @@ { "listen": "test", "script": { - "id": "af38008a-4aff-475f-89e6-7d93aac608ff", + "id": "6b2c0c4d-e8d8-40bb-96e3-8e39d97dbf86", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4353,7 +4524,7 @@ { "listen": "prerequest", "script": { - "id": "d3fb6133-8b0e-4b96-a0ba-06ea6fd7b479", + "id": "974fe5e0-8faa-48e7-8283-bf3d74ade01b", "type": "text/javascript", "exec": [ "" @@ -4363,7 +4534,7 @@ { "listen": "test", "script": { - "id": "f4dd093b-d580-4dff-9a84-a69dc44e8d1a", + "id": "9c7ce2dc-0cb6-41c9-a4e3-a5f9d042905c", "type": "text/javascript", "exec": [ "" @@ -4383,7 +4554,7 @@ { "listen": "test", "script": { - "id": "2e37d845-1719-4f49-a395-b4ea2bc33353", + "id": "5b366383-0215-4ef8-bd31-ae24bccdadb3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4439,7 +4610,7 @@ { "listen": "test", "script": { - "id": "123a115d-e03e-4ac3-9cfb-15a1c236406a", + "id": "d5ff7b7a-d816-4013-abf5-ccd7abdc645b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4486,7 +4657,7 @@ { "listen": "test", "script": { - "id": "f8d87263-342b-4d32-bdde-08d3351d7813", + "id": "c4b0517b-d251-4c51-81ea-dccbb2497469", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4534,7 +4705,7 @@ { "listen": "test", "script": { - "id": "788ed43b-c45a-46ec-bcf3-3ec5ac30e1b5", + "id": "9c013aa9-fdf3-4882-952e-f380dc67c033", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4582,7 +4753,7 @@ { "listen": "test", "script": { - "id": "223451e7-b0d5-4a05-b030-66ec1003c39c", + "id": "d5e45691-05ef-488b-a0f2-b85bc78c8159", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4639,7 +4810,7 @@ { "listen": "test", "script": { - "id": "210efb08-e192-4b27-8d2d-6cc881c952f9", + "id": "058da24c-ff03-4e2d-a209-ab0fe546f23a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4710,7 +4881,7 @@ { "listen": "prerequest", "script": { - "id": "927376a6-7594-4cbc-8939-fb23d6347d29", + "id": "ea089996-0384-4ff0-918b-9d702a487aa0", "type": "text/javascript", "exec": [ "" @@ -4720,7 +4891,7 @@ { "listen": "test", "script": { - "id": "cfd7cc0e-ae53-4786-8684-1cb0890e017a", + "id": "18d829ae-ecba-46bb-938a-04631a5f60b4", "type": "text/javascript", "exec": [ "" @@ -4740,7 +4911,7 @@ { "listen": "test", "script": { - "id": "18549450-5d4c-4ff9-8a5e-ca147880c54b", + "id": "2037afa0-45dd-4446-ba30-5d7722c9110e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4791,7 +4962,7 @@ { "listen": "prerequest", "script": { - "id": "83cfd939-a951-40c5-afda-552f50ccf153", + "id": "b8061e8c-27bc-42d2-8db0-273cfef13eaf", "type": "text/javascript", "exec": [ "" @@ -4801,7 +4972,7 @@ { "listen": "test", "script": { - "id": "76a652ca-8fb0-4b77-833f-145bd5160cce", + "id": "adc06546-acbc-46c2-b1b2-887e037da1db", "type": "text/javascript", "exec": [ "" @@ -4821,7 +4992,7 @@ { "listen": "test", "script": { - "id": "2aae1abf-408d-4f0d-a3b4-9df1ca861910", + "id": "5ab936d6-a3af-49ec-b9b2-bf4ad61d9051", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4877,7 +5048,7 @@ { "listen": "prerequest", "script": { - "id": "fbacf122-a3f1-4525-a1e8-88f6e29824bf", + "id": "4175d156-de80-48b0-9d2f-fa430b8fce3c", "type": "text/javascript", "exec": [ "" @@ -4887,7 +5058,7 @@ { "listen": "test", "script": { - "id": "724686a9-00cc-47cd-a5ed-f778fd7c5c95", + "id": "3902d157-5c56-4155-b143-795149f25549", "type": "text/javascript", "exec": [ "" @@ -4903,7 +5074,7 @@ { "listen": "prerequest", "script": { - "id": "64a0f5f6-404f-4443-89ce-b7c470b929c3", + "id": "41e1ddcd-f7cf-4ba9-b197-a053c0db5ab6", "type": "text/javascript", "exec": [ "" @@ -4913,7 +5084,7 @@ { "listen": "test", "script": { - "id": "d89ae775-f38f-4630-9fc1-5ac76dbab80f", + "id": "336416e8-70f4-4e6f-b815-59c1a8f9d8c2", "type": "text/javascript", "exec": [ "" @@ -4936,7 +5107,7 @@ { "listen": "test", "script": { - "id": "ebb10d5b-77eb-415b-b38e-00cb24d8e3fe", + "id": "37390962-11bb-4481-8ff6-6a262fdbbfb9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5005,7 +5176,7 @@ { "listen": "test", "script": { - "id": "2305df9c-9028-43ce-b1cc-5c8ed744b53a", + "id": "841a6755-d58d-44bd-a843-9a6f8cea1c1c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5084,7 +5255,7 @@ { "listen": "test", "script": { - "id": "bfe9e171-309b-441a-8b3f-1daa3263bdd1", + "id": "09cb57b5-8dd8-4c1f-ad89-19a1d9448867", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5113,7 +5284,7 @@ { "listen": "prerequest", "script": { - "id": "f623e1cd-0607-48c5-8568-d2475682543e", + "id": "8bcd0405-0a24-4c0e-b86a-18ec8ca810f4", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5163,7 +5334,7 @@ { "listen": "test", "script": { - "id": "7f5b764b-0540-4a90-8297-441445fa4b99", + "id": "062857b0-45f0-48c1-9bbe-875ddd2e77ef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5228,7 +5399,7 @@ { "listen": "test", "script": { - "id": "f41e6068-3325-4603-8e8e-cbefab149620", + "id": "640e670c-ee8c-4060-838a-71b2448049aa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5301,7 +5472,7 @@ { "listen": "prerequest", "script": { - "id": "1bc765df-497e-4b29-9f9e-a9005bf5e6b0", + "id": "b4a8e825-5968-49ee-a637-87a3041ee206", "type": "text/javascript", "exec": [ "" @@ -5311,7 +5482,7 @@ { "listen": "test", "script": { - "id": "902d672a-ef19-4744-9150-fef0718faee6", + "id": "44cfdd99-f456-427e-b9ce-c5bca735ddae", "type": "text/javascript", "exec": [ "" @@ -5331,7 +5502,7 @@ { "listen": "test", "script": { - "id": "91ea27d9-0be0-4e2a-8338-8b79f3d3b999", + "id": "8c17f208-acb1-4093-8f96-6777e7f1873f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -5385,13 +5556,196 @@ }, "response": [] }, + { + "name": "User-FollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "08718303-940b-4fe3-b1d6-5e0bad5717f8", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/user/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "user", + "1" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "a14d4009-fb13-4a72-a3ba-92e085e63ca5", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/user/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "user", + "1" + ] + } + }, + "response": [] + }, + { + "name": "User-FollowProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "64ad21ec-65c1-4fb5-a049-1359bd7ef974", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/project/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "project", + "1" + ] + } + }, + "response": [] + }, { "name": "User-GetUser-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "874176a4-8f81-4bc4-98ea-aa7513bfedaf", + "id": "9b2bc0ad-c52d-425d-9b92-ac0d533d3da6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5444,7 +5798,7 @@ { "listen": "test", "script": { - "id": "bd897fe3-0e30-484f-bc29-d8320ed4d0da", + "id": "9f26698d-f2ae-4ac6-b1b7-50c1210073f0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -5502,7 +5856,7 @@ { "listen": "test", "script": { - "id": "0715648b-54ac-4979-8fa2-5217680038bf", + "id": "cb64f4c6-eafa-4467-8aea-48d6f89eaa1b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -5569,7 +5923,7 @@ { "listen": "test", "script": { - "id": "ccd36a14-6440-4757-81e5-792edc95c859", + "id": "de09312d-cd71-44c8-a67e-f33d8d97611e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5631,7 +5985,7 @@ { "listen": "prerequest", "script": { - "id": "99373590-b848-4271-80fe-9614ce90b4d1", + "id": "78e80d2d-cfa0-4ef8-80ac-61576263dcc6", "type": "text/javascript", "exec": [ "" @@ -5641,7 +5995,7 @@ { "listen": "test", "script": { - "id": "3a4e309f-1ff8-4e19-9800-469c5b31a755", + "id": "164e4639-9aae-4276-a94c-c17de5a6acf3", "type": "text/javascript", "exec": [ "" @@ -5661,7 +6015,7 @@ { "listen": "test", "script": { - "id": "da27776b-00ab-4e24-81c2-3d9005c7c766", + "id": "1c032e5f-34c9-48ab-b787-32a42cb22ad3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -5727,7 +6081,7 @@ { "listen": "test", "script": { - "id": "70a289b4-2136-4521-9ed7-f3f5d3c16e6b", + "id": "6d9a6718-f202-46b8-91f5-3a5038ece212", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -5800,7 +6154,7 @@ { "listen": "test", "script": { - "id": "7d78523e-e636-4cb0-b65c-2f2b71a339e4", + "id": "fbaf4624-82cc-422a-ab25-8ae346aefe6b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -5858,7 +6212,7 @@ { "listen": "test", "script": { - "id": "6f1e9d16-dba9-484e-b3dd-9c8b6bc85a36", + "id": "0f0987a9-a9e2-43ee-b04e-82cc81400cb4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -5908,7 +6262,7 @@ { "listen": "test", "script": { - "id": "88436bbe-4b0f-4893-bc32-7adc6abd3e60", + "id": "9c741cad-37f6-44b8-8bce-583b2c3b5121", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -5975,7 +6329,7 @@ { "listen": "test", "script": { - "id": "dbec3f69-9895-4a36-a768-de9011126769", + "id": "4884b2bb-386a-4146-a5bf-d60e9e23a761", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6042,7 +6396,7 @@ { "listen": "test", "script": { - "id": "0de8a2b0-618d-4727-9dfc-9c1774dc9d4e", + "id": "d8f5857d-e7a9-4562-acb0-d79f13f97dc9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6106,7 +6460,7 @@ { "listen": "test", "script": { - "id": "298f55fa-20ae-4c0a-92de-a3aba255250f", + "id": "a8704e86-b968-4a1a-a115-bb42c1abd901", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6167,7 +6521,7 @@ { "listen": "test", "script": { - "id": "598e788e-0a2b-4878-beca-e91776535040", + "id": "50da69f4-51af-425e-b3b5-679833b093a3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6219,7 +6573,7 @@ { "listen": "test", "script": { - "id": "df306696-978d-4cd3-acd1-adfed80be4cf", + "id": "54224f90-08a3-41d9-956d-e5f3b59dad78", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -6284,7 +6638,7 @@ { "listen": "test", "script": { - "id": "a51481bd-e084-4e02-91b4-0f1fac1ea5d7", + "id": "be2bbe3c-ef1c-4009-92f0-0677a98bd699", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6310,7 +6664,7 @@ { "listen": "prerequest", "script": { - "id": "049169a7-0260-4cf4-875d-213c39f8da39", + "id": "69985e3d-b872-4019-bf58-fea7e0dd4017", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -6360,7 +6714,7 @@ { "listen": "test", "script": { - "id": "3358c856-c92c-441f-8f0d-ba566c7d7960", + "id": "96d1d50d-6690-4d93-a15b-8b832849f24e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -6429,7 +6783,7 @@ { "listen": "test", "script": { - "id": "e610ffdd-f207-4e52-9611-7064eec1c536", + "id": "877cbb1e-c498-46e0-b01c-57945b28e4f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -6491,7 +6845,7 @@ { "listen": "test", "script": { - "id": "de8f304d-d695-409c-9e66-715252b8bc10", + "id": "62414f21-5bf5-4d24-baa6-bf6449dbae80", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6546,7 +6900,7 @@ { "listen": "test", "script": { - "id": "19a444c3-d12d-4231-8782-4b66f605688a", + "id": "d7fe4641-7fc6-451e-b9f2-7667ce7fdbbb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6615,7 +6969,7 @@ { "listen": "test", "script": { - "id": "13d4e71b-c891-4808-9e6f-3212f7077cb0", + "id": "b388bf7f-5916-4038-9fbd-2aad609aff61", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6676,7 +7030,7 @@ { "listen": "test", "script": { - "id": "ab6b88f5-f7cd-41a6-9214-146b77507ed4", + "id": "c825a04e-4755-435a-babf-b2c5b35a8411", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6728,7 +7082,7 @@ { "listen": "test", "script": { - "id": "67b24c11-d444-4a05-9322-a3cadfba54c5", + "id": "406f0f19-9584-4a48-a16a-243e0c776d53", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6781,7 +7135,7 @@ { "listen": "test", "script": { - "id": "1ad43cc3-177c-414c-a8a2-b20b12b56d73", + "id": "4e973ecb-358e-4822-a755-1f840d24a537", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6834,7 +7188,7 @@ { "listen": "test", "script": { - "id": "99426315-de87-4ae4-a0ad-955e357c04f3", + "id": "957e049b-e852-4add-9c98-99f7d53018b4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6896,7 +7250,7 @@ { "listen": "test", "script": { - "id": "73e8d65c-73fd-406e-852c-1de0268991df", + "id": "b9ee11c5-3ab1-439c-bfca-ebdc24c37a97", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6977,7 +7331,7 @@ { "listen": "test", "script": { - "id": "3f6441c9-b36a-4722-a2d8-5f5cd57dc49f", + "id": "e4c53361-76fa-420e-a96d-51553bd28e36", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7036,7 +7390,7 @@ { "listen": "test", "script": { - "id": "3cd95667-559d-4c69-ad32-90c664b290e0", + "id": "7ee13813-ee65-4e70-a4b6-cadf3a9643f8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -7102,7 +7456,7 @@ { "listen": "test", "script": { - "id": "f4574f79-0fd2-4c66-beb2-18518b3e3be0", + "id": "ff110cc1-e561-4946-a576-29c78a67f84e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7151,7 +7505,7 @@ { "listen": "test", "script": { - "id": "69b175b0-45c4-4036-add9-2632f98869c6", + "id": "ee37ff4e-7621-4704-801e-fb77d7e2a532", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7202,7 +7556,7 @@ { "listen": "test", "script": { - "id": "f5dbb78e-bff0-44e6-952b-471c8c1fbe04", + "id": "821bf299-4745-47f4-a85e-b3703c8cc427", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7253,7 +7607,7 @@ { "listen": "test", "script": { - "id": "14192d70-5ab7-46fb-a5e7-e5ed0bedc424", + "id": "5c29ffca-aece-4dbf-ad79-c0df35474f00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7298,7 +7652,7 @@ { "listen": "test", "script": { - "id": "1cee0e3a-ac3b-455b-8701-d2747a121bd4", + "id": "3b0faf63-9482-47af-bb14-05f1e8c72fe8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7349,7 +7703,7 @@ { "listen": "test", "script": { - "id": "73060625-c1e1-4a96-ba30-b307d75a308a", + "id": "7dfb434e-df3a-45a3-a688-c70d0ac6bcfb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7400,7 +7754,7 @@ { "listen": "test", "script": { - "id": "6cb284d4-7a70-4942-950b-ce7f243b2882", + "id": "ea2b80d1-3a0d-46a6-96ee-a36507b4958d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7465,7 +7819,7 @@ { "listen": "test", "script": { - "id": "86d75a7e-2ba4-4313-b4c1-a876fe24eb32", + "id": "276bd88c-9e4a-4a67-a68a-87b294292f7b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -7534,7 +7888,7 @@ { "listen": "test", "script": { - "id": "a7c80da4-0c6b-461a-a50b-6c58a4edebfa", + "id": "1916c432-a17f-4bf2-ba4c-d127f1b7eb61", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -7613,7 +7967,7 @@ { "listen": "test", "script": { - "id": "d1681d9f-d9eb-400d-9a6d-fd8ecca7c79e", + "id": "858bd459-551e-4ae6-a02a-81717839d7ef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -7642,7 +7996,7 @@ { "listen": "prerequest", "script": { - "id": "3fab5196-9963-4a65-9b97-cb12e74f1fd8", + "id": "8ce9640a-0b5a-43c2-b1fb-6de12e14b804", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -7692,7 +8046,7 @@ { "listen": "test", "script": { - "id": "4bd15b0e-9b23-4e37-9557-c74f94052c5a", + "id": "c9b33945-4099-499d-b76c-ab26a5003c0e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7756,7 +8110,7 @@ { "listen": "test", "script": { - "id": "a1a717be-5b52-4c13-b130-74532a5562e8", + "id": "71be5a9d-0e56-44a1-95f8-9d51b87ad33d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -7829,7 +8183,7 @@ { "listen": "prerequest", "script": { - "id": "3073b7ea-cdc2-46fe-bdd7-8fccd41d9c16", + "id": "3577cb8f-ec54-4681-abf4-d079de9df68f", "type": "text/javascript", "exec": [ "" @@ -7839,7 +8193,7 @@ { "listen": "test", "script": { - "id": "9962391e-6a04-4b9d-b2ea-28a93844e89f", + "id": "f69c81ab-26d1-40bb-b61d-763f347c481b", "type": "text/javascript", "exec": [ "" @@ -7859,7 +8213,67 @@ { "listen": "test", "script": { - "id": "e4564fe6-7891-489b-a24d-1ba47346d128", + "id": "8a5de292-f8fe-4364-88dd-ce801423c894", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-FollowUser-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "4832f5c1-34bc-46e5-a183-b8c0e6da4b73", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -7919,7 +8333,7 @@ { "listen": "test", "script": { - "id": "d45e0960-0000-4056-98a0-c28087fcc4b4", + "id": "f76adf10-5d5d-438d-a25f-06bafaac67cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7972,7 +8386,7 @@ { "listen": "test", "script": { - "id": "9cf3cc38-154e-4839-bb34-8b765e865793", + "id": "fc9b9959-958c-4220-90af-f5cdbd54a462", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -8030,7 +8444,7 @@ { "listen": "test", "script": { - "id": "a53ccfcf-83b7-4a54-8ff2-9fd47fdbf207", + "id": "2503be33-b38a-485e-9343-b908fd5d5376", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -8097,7 +8511,7 @@ { "listen": "test", "script": { - "id": "aa729705-c6f9-48a2-9fc2-e75d48b7bb39", + "id": "783bc2e1-55de-4d85-9b38-b310c5b36455", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8159,7 +8573,7 @@ { "listen": "prerequest", "script": { - "id": "0eb4be27-3b1e-4140-af7e-8aa76f42e299", + "id": "2241cc60-029d-4ea8-bfb4-823a78229b5e", "type": "text/javascript", "exec": [ "" @@ -8169,7 +8583,7 @@ { "listen": "test", "script": { - "id": "32db062f-6a84-4131-a715-7d63bc2feb13", + "id": "fa9713b6-08c5-4fed-b895-43d23e6cc4bb", "type": "text/javascript", "exec": [ "" @@ -8189,7 +8603,7 @@ { "listen": "test", "script": { - "id": "626162f1-0517-4f7d-b5c7-7d718f65bc2f", + "id": "873d39b1-5d77-4e8c-81bb-8cd34c0b18b8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -8255,7 +8669,7 @@ { "listen": "test", "script": { - "id": "4041da04-18c8-42be-badf-512516b7fa53", + "id": "8ac6d8f8-a9ca-4e8f-91ca-32b1746e9b0e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8328,7 +8742,7 @@ { "listen": "test", "script": { - "id": "f8b70da0-78ca-4b7d-820d-00f609531e0e", + "id": "fe50be45-03da-4d44-b16c-ff57d01c2290", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8386,7 +8800,7 @@ { "listen": "test", "script": { - "id": "c5c011bc-40db-41d4-9222-6a246956826d", + "id": "d50e0434-5bc5-4838-8cde-5983878b40cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -8436,7 +8850,7 @@ { "listen": "test", "script": { - "id": "b900bf7d-099e-4ae5-935b-173e6e04612a", + "id": "1536f62b-6328-490d-a89a-4fa7c93808d3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -8503,7 +8917,7 @@ { "listen": "test", "script": { - "id": "0f35f244-ac36-44d3-8913-7a5b017ed57f", + "id": "a022dace-9a2e-4088-90eb-cb6d1ba13cb3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8570,7 +8984,7 @@ { "listen": "test", "script": { - "id": "078e1158-12d7-48cf-a5c7-201fb5a1deb5", + "id": "49ca32af-af00-42ab-8103-a3615ecc8e0d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8634,7 +9048,7 @@ { "listen": "test", "script": { - "id": "b0c4ed4b-f882-41d9-b17a-e59ded461fbe", + "id": "b764313c-6aa5-418d-80a4-810bfcb3893a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8698,7 +9112,7 @@ { "listen": "test", "script": { - "id": "92efd26c-c091-4972-851f-509e94753019", + "id": "b0f6f5fe-9cfe-4eb4-afd1-c0f261f50831", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8750,7 +9164,7 @@ { "listen": "test", "script": { - "id": "45eb84a1-ddcf-4bfc-bd2f-7f845d99452f", + "id": "4301a870-38a9-4569-a654-a2a17fa506d5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -8808,7 +9222,7 @@ { "listen": "test", "script": { - "id": "10ad0812-48d9-488f-b60d-2238169c981d", + "id": "a44c8b53-8712-4ade-820e-1e7b25be11a4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -8873,7 +9287,7 @@ { "listen": "test", "script": { - "id": "e6cc5d02-3b27-47a5-9a7b-ffbfbb5716cf", + "id": "aafa55b8-8fe1-41d8-9f7f-fb8f05db5948", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8901,7 +9315,7 @@ { "listen": "prerequest", "script": { - "id": "e73d5684-8a33-421c-a298-5a679635136e", + "id": "9b21b58f-75c7-4af2-bee6-47d44e1c58c2", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8951,7 +9365,7 @@ { "listen": "test", "script": { - "id": "78e143b3-fa97-417a-a77f-aa69bd1b89a9", + "id": "0d710855-d971-41bd-8d27-fade2a7b372e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9013,7 +9427,7 @@ { "listen": "test", "script": { - "id": "2870f74a-1eb4-4c5f-9873-29d0deacae94", + "id": "0a94ca2d-e983-47a7-a761-14d0fda401b5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9100,7 +9514,7 @@ { "listen": "test", "script": { - "id": "95833f0f-c9ec-43db-9554-58875a6b860f", + "id": "a55882d9-b71b-428d-9fc6-90b03c2b7cb4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9126,7 +9540,7 @@ { "listen": "prerequest", "script": { - "id": "5e62987a-59d2-49a4-8fbe-70773a257969", + "id": "c3a4192d-3a10-414b-be16-f5aaf5586f77", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9173,7 +9587,7 @@ { "listen": "test", "script": { - "id": "3ac7cacd-fd54-4259-9f64-91ce1ef8d0c7", + "id": "452abed7-0837-4678-86af-2b1561d74580", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9200,7 +9614,7 @@ { "listen": "prerequest", "script": { - "id": "2672a24f-9794-45ac-960c-c2642b8f79f5", + "id": "07e369ec-21f0-48c1-a7d1-4b78b36d764f", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9250,7 +9664,7 @@ { "listen": "test", "script": { - "id": "41c18b70-27f3-4cba-9577-d4b032fe3d6d", + "id": "cec31933-5f54-4dc0-8bb6-ad7a7eb62062", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9312,7 +9726,7 @@ { "listen": "test", "script": { - "id": "c267e17a-ca35-4ec9-8829-b37fcbedb421", + "id": "b382bf14-534e-4767-b311-830712c54b0d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9399,7 +9813,7 @@ { "listen": "test", "script": { - "id": "4b24201b-fd5b-4fb7-803c-67d6b038ad7b", + "id": "1cae5ed2-a085-46d8-9207-9896a68f2e51", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9425,7 +9839,7 @@ { "listen": "prerequest", "script": { - "id": "2198fd5a-c82b-4f40-bcf1-446422e89706", + "id": "da3df4c2-f9ac-4728-9e5f-69a9e8353c95", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9472,7 +9886,7 @@ { "listen": "test", "script": { - "id": "f88bc669-dfb4-4981-b62d-77260e639d70", + "id": "7a95bdbf-2a79-440b-a248-4453ab6ade0b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -9548,7 +9962,7 @@ { "listen": "test", "script": { - "id": "6ca1d0dc-3f40-48dc-b9f2-562995303c27", + "id": "2dd415c9-d29b-4b9b-aa15-cfe16f3b0827", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9609,7 +10023,7 @@ { "listen": "test", "script": { - "id": "5deee44c-c2c2-4fa1-8577-038884b39f8e", + "id": "79295a5a-ea10-453b-8200-7557ceab73f2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9661,7 +10075,7 @@ { "listen": "test", "script": { - "id": "dfb8591c-ef03-4d0d-9a4e-f497e2ef0e8f", + "id": "b6cc6c3e-45fc-48ad-8ef9-ebfcde11f4b4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9714,7 +10128,7 @@ { "listen": "test", "script": { - "id": "49933d24-e3b5-4a0a-ab4c-cba2aacafea9", + "id": "c1bd1964-ea17-414c-98ab-18232a942352", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9767,7 +10181,7 @@ { "listen": "test", "script": { - "id": "5cca3606-27e6-4fd2-a914-508c74712e83", + "id": "99d71c3d-11d9-4589-a1a6-7e6ac0e413d1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9829,7 +10243,7 @@ { "listen": "test", "script": { - "id": "1cc59e35-94f1-41d2-bab6-0afea72309d0", + "id": "2d6a11c2-f1cd-4863-8ea3-aaff7b496d37", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9910,7 +10324,7 @@ { "listen": "test", "script": { - "id": "e79fea6d-d632-4af4-9365-93efde82c9e1", + "id": "8c879a0a-9f3d-44d7-935f-9700ea075a4a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9969,7 +10383,7 @@ { "listen": "test", "script": { - "id": "f3788638-93cc-458c-bdb0-882321ea2475", + "id": "78cc0209-bf5c-40e4-8812-2ed8705ea952", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -10035,7 +10449,7 @@ { "listen": "test", "script": { - "id": "8074834b-c21b-4c02-bd49-a21fc1597e4a", + "id": "d4b82be0-b7f7-4724-839e-0167d8254be3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10084,7 +10498,7 @@ { "listen": "test", "script": { - "id": "c8e0d889-e8d3-4d7a-b3dd-fc24d8662ff8", + "id": "deaeb677-41fd-46a8-878e-026659b33b85", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10133,7 +10547,7 @@ { "listen": "test", "script": { - "id": "58a882b6-ef2a-454d-be84-e405e7312d76", + "id": "5a30750f-e358-42bc-81d5-650c493c1f99", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10178,7 +10592,7 @@ { "listen": "test", "script": { - "id": "bc19e128-cec0-4fdb-a7ca-8607181df075", + "id": "64032e5f-d79e-4947-b055-7e021e238a07", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10223,7 +10637,7 @@ { "listen": "test", "script": { - "id": "a0da056f-24ff-4c9d-a012-e1493a4094e7", + "id": "cbf023ee-44d3-4bd4-83b6-5571062f9509", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10268,7 +10682,7 @@ { "listen": "test", "script": { - "id": "b5cd2c3e-1e1f-466d-9dba-d94d901114d5", + "id": "6ebd58c6-3a21-48d1-9549-7f81ab51c932", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10321,7 +10735,7 @@ { "listen": "test", "script": { - "id": "8ddc5b02-3443-4c34-bcef-3bf76205d7d3", + "id": "b95ac45b-cdee-4482-84d2-f0c844649b6c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10374,7 +10788,7 @@ { "listen": "test", "script": { - "id": "3b1e1f73-6bb8-406d-9e0a-e179d4ab869e", + "id": "2bacc554-84be-4825-8307-d4f4b7c10b1c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10457,7 +10871,7 @@ { "listen": "prerequest", "script": { - "id": "65f53329-1549-483c-8c7b-513f37c1ca29", + "id": "7f712054-0215-4224-87bf-cacb473a73c5", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -10501,7 +10915,7 @@ { "listen": "test", "script": { - "id": "cac65308-248d-4c31-be9f-b1186e7b3b72", + "id": "40e6f6a8-bbb4-4210-9fb1-d5f55131cbb5", "type": "text/javascript", "exec": [ "" From aff57fef337476dbaaa864c0e69b67d3fd9044e3 Mon Sep 17 00:00:00 2001 From: I380210 Date: Tue, 6 Oct 2020 09:25:08 +0200 Subject: [PATCH 037/157] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09894fe6..6d6699e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added descriptions for Project Highlights - [#219](https://github.com/DigitalExcellence/dex-backend/issues/219) +- Added function to follow users and let users follow projects [#228](https://github.com/DigitalExcellence/dex-backend/pull/258) ### Changed From faa0081f80043db3e5b185e8fdc8c84b72aa0981 Mon Sep 17 00:00:00 2001 From: Niray Mak Date: Tue, 6 Oct 2020 13:50:50 +0200 Subject: [PATCH 038/157] changed .gitignore. changed attributes for fileuploading. changed tests. Fixed warnings. --- .gitignore | 5 +- API/Controllers/FileController.cs | 19 +- API/Controllers/ProjectController.cs | 1 - API/Controllers/RoleController.cs | 4 +- API/Extensions/AllowedExtensionsAttribute.cs | 53 ++- API/Extensions/FileUploader.cs | 22 +- API/Extensions/MaxFileSizeAttribute.cs | 47 +- Postman/dex.postman_collection.json | 436 +++++++++---------- Services.Tests/RoleServiceTest.cs | 4 +- Services/Services/RoleService.cs | 4 +- 10 files changed, 331 insertions(+), 264 deletions(-) diff --git a/.gitignore b/.gitignore index 1d169dd3..4f389a83 100644 --- a/.gitignore +++ b/.gitignore @@ -334,6 +334,5 @@ profile IdentityServer/tempkey.rsa -/API/files/* -!/API/files/.gitkeep -/API/filesangular-226066.png +/API/wwwroot/Resources/* +!/API/wwwroot/Resources/.gitkeep diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 6369ae10..765f63ac 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -177,15 +177,18 @@ public async Task DeleteSingleFile(int fileId) return NotFound(problem); } - if(file.Uploader != user && !userService.UserHasScope(user.IdentityId, Defaults.Roles.Administrator)) + if(!file.Uploader.Id.Equals(user.Id)) { - ProblemDetails problem = new ProblemDetails - { - Title = "Not authorized.", - Detail = "You are not the uploader of this file.", - Instance = "88967A6F-B168-44E2-A8E7-E9EBD555940E" - }; - return Unauthorized(problem); + if(!userService.UserHasScope(user.IdentityId, Defaults.Roles.Administrator)) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Not authorized.", + Detail = "You are not the uploader of this file.", + Instance = "88967A6F-B168-44E2-A8E7-E9EBD555940E" + }; + return Unauthorized(problem); + } } try diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 0a6a801e..37f000a3 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -50,7 +50,6 @@ public class ProjectController : ControllerBase /// The project service. /// The user service. /// The fileservice. - /// The fileuploader. /// The mapper. public ProjectController(IProjectService projectService, IUserService userService, IFileService fileService, IMapper mapper) { diff --git a/API/Controllers/RoleController.cs b/API/Controllers/RoleController.cs index b0c761c7..281235b5 100644 --- a/API/Controllers/RoleController.cs +++ b/API/Controllers/RoleController.cs @@ -140,7 +140,7 @@ public async Task CreateRoleAsync([FromBody]RoleResource roleReso foreach(RoleScope roleScope in role.Scopes) { - if(!roleService.isValidScope(roleScope.Scope)) + if(!roleService.IsValidScope(roleScope.Scope)) { ProblemDetails problem = new ProblemDetails { @@ -196,7 +196,7 @@ public async Task UpdateRole(int roleId, RoleResource roleResourc mapper.Map(roleResource,currentRole); foreach(RoleScope roleScope in currentRole.Scopes) { - if(!roleService.isValidScope(roleScope.Scope)) + if(!roleService.IsValidScope(roleScope.Scope)) { ProblemDetails problem = new ProblemDetails { diff --git a/API/Extensions/AllowedExtensionsAttribute.cs b/API/Extensions/AllowedExtensionsAttribute.cs index 9365e620..31e35604 100644 --- a/API/Extensions/AllowedExtensionsAttribute.cs +++ b/API/Extensions/AllowedExtensionsAttribute.cs @@ -8,33 +8,66 @@ namespace API.Extensions { + /// + /// Attribute for allowed file extensions + /// public class AllowedExtensionsAttribute : ValidationAttribute { - private readonly string[] _extensions; + private readonly string[] extensions; + + /// + /// Constructor for allowed extensions + /// + /// array of extensions public AllowedExtensionsAttribute(string[] extensions) { - _extensions = extensions; + this.extensions = extensions; } + /// + /// Method which checks if extensions are allowed + /// + /// + /// + /// protected override ValidationResult IsValid( object value, ValidationContext validationContext) { - var file = value as IFormFile; - var extension = Path.GetExtension(file.FileName); - if(file != null) + IFormFile file = value as IFormFile; + if(file == null) + { + return new ValidationResult(FileIsNullError()); + } + + string extension = Path.GetExtension(file.FileName); + + if(!extensions.Contains(extension.ToLower())) { - if(!_extensions.Contains(extension.ToLower())) - { - return new ValidationResult(GetErrorMessage()); - } + return new ValidationResult(GetErrorMessage()); } + return ValidationResult.Success; } + /// + /// Error message + /// + /// public string GetErrorMessage() { - return $"This photo extension is not allowed!"; + return $"This file extension is not allowed!"; } + + /// + /// Error message + /// + /// + public string FileIsNullError() + { + return "File is null"; + } + + } } diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index dfcb8e08..ad097c5f 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -68,13 +68,17 @@ public interface IFileUploader public class FileUploader : IFileUploader { - private readonly string UploadPath; - private readonly string ServerRoot; + private readonly string uploadPath; + private readonly string serverRoot; + /// + /// File Uploader + /// + /// public FileUploader(IWebHostEnvironment env) { - UploadPath = Path.Combine(env.WebRootPath, "Resources\\"); - ServerRoot = Path.Combine("https://localhost:5001/Resources/"); + uploadPath = Path.Combine(env.WebRootPath, "Resources\\"); + serverRoot = Path.Combine("https://localhost:5001/Resources/"); } /// @@ -106,17 +110,17 @@ public async Task UploadSingleFile(IFormFile file, string fileName) { try { - if(!System.IO.File.Exists(UploadPath + fileName)) + if(!System.IO.File.Exists(uploadPath + fileName)) { await using(Stream sourceStream = file.OpenReadStream()) { - await using(FileStream destinationStream = System.IO.File.Create(UploadPath + fileName)) + await using(FileStream destinationStream = System.IO.File.Create(uploadPath + fileName)) { await sourceStream.CopyToAsync(destinationStream); } } - return ServerRoot + fileName; + return serverRoot + fileName; } throw new FileExistException(fileName); @@ -134,9 +138,9 @@ public async Task UploadSingleFile(IFormFile file, string fileName) /// Bool which tells if file is deleted succesfully or not public void DeleteFile(File file) { - if(System.IO.File.Exists(Path.Combine(UploadPath, file.Name))) + if(System.IO.File.Exists(Path.Combine(uploadPath, file.Name))) { - System.IO.File.Delete(Path.Combine(UploadPath, file.Name)); + System.IO.File.Delete(Path.Combine(uploadPath, file.Name)); return; } throw new FileNotFoundException(file.Name); diff --git a/API/Extensions/MaxFileSizeAttribute.cs b/API/Extensions/MaxFileSizeAttribute.cs index 41bfd974..ddb28380 100644 --- a/API/Extensions/MaxFileSizeAttribute.cs +++ b/API/Extensions/MaxFileSizeAttribute.cs @@ -7,32 +7,61 @@ namespace API.Extensions { + /// + /// Attribute fort maximum file size + /// public class MaxFileSizeAttribute : ValidationAttribute { - private readonly int _maxFileSize; + private readonly int maxFileSize; + + /// + /// Constructor for maximum filesize attribute + /// + /// public MaxFileSizeAttribute(int maxFileSize) { - _maxFileSize = maxFileSize; + this.maxFileSize = maxFileSize; } + /// + /// Methods which checks if file is not larger than allowed size + /// + /// + /// + /// protected override ValidationResult IsValid( object value, ValidationContext validationContext) { - var file = value as IFormFile; - if(file != null) + IFormFile file = value as IFormFile; + if(file == null) { - if(file.Length > _maxFileSize) - { - return new ValidationResult(GetErrorMessage()); - } + return new ValidationResult(FileIsNullError()); } + if(file.Length > maxFileSize) + { + return new ValidationResult(GetErrorMessage()); + } + return ValidationResult.Success; } + /// + /// Error messsage + /// + /// public string GetErrorMessage() { - return $"Maximum allowed file size is { _maxFileSize} bytes."; + return $"Maximum allowed file size is { maxFileSize} bytes."; + } + + /// + /// Error message + /// + /// + public string FileIsNullError() + { + return "File is null"; } } } diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index c7335d4f..9f115faa 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "7a49f632-3a1a-425b-8193-8f5ff064e277", + "_postman_id": "3bbf7564-b6ef-4e2f-829a-ce90ab82189a", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "6f2e6c0c-c9f6-45d2-ac7c-510471ff6a13", + "id": "bceec86c-3995-4a9b-aeb9-6428ea57a450", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "c565aed3-c829-4bc5-b34b-a03ad538f1cb", + "id": "568a93ad-ad44-426a-9ec7-cada536ce986", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -134,7 +134,7 @@ { "listen": "test", "script": { - "id": "cf37d4ad-8780-4c78-9399-240af9fe0447", + "id": "903e996a-372b-4ca2-ad10-a13847e71ee7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -203,7 +203,7 @@ { "listen": "test", "script": { - "id": "f0490b63-0a3b-4d32-aeeb-1519062e83fb", + "id": "1e3816e9-8970-457e-a23b-1dc2a78f92d8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -271,7 +271,7 @@ { "listen": "test", "script": { - "id": "bd055a94-87b7-4c1d-879c-6bef4a79eb95", + "id": "21672287-a260-4c29-845b-50c0aaa46bd2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -339,7 +339,7 @@ { "listen": "test", "script": { - "id": "79eb2350-5e30-46e1-84f1-a9860c3a0b35", + "id": "b1ff2985-537b-4c89-9182-7c0a76581de4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -414,7 +414,7 @@ { "listen": "test", "script": { - "id": "48fc3e2b-d59f-45f8-968f-7f4c6876b312", + "id": "5911ccc9-6ec6-4f3d-bf8a-92c47eec911c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -479,7 +479,7 @@ { "listen": "test", "script": { - "id": "54a28d1d-7d74-44d8-bbf5-30d2c380eafd", + "id": "ae13808d-38f7-4bd6-b555-d8d8ead6fe09", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -557,7 +557,7 @@ { "listen": "test", "script": { - "id": "c92d762d-3c8a-4c04-bd86-6fea64d1a484", + "id": "cc464320-aa2e-4a49-9228-41404a9791c7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -630,7 +630,7 @@ { "listen": "test", "script": { - "id": "23684c74-e061-4408-9cf7-8482116b5ed3", + "id": "7bd19e65-e3fa-46a2-8461-44b046cc54e4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -699,7 +699,7 @@ { "listen": "test", "script": { - "id": "1c8f3a6b-c6cf-495e-aa6d-1f49f7486241", + "id": "8c19d52c-1b05-4a57-a5fb-638bceb1be5d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -767,7 +767,7 @@ { "listen": "test", "script": { - "id": "326466d4-ac69-44b1-89e5-94eacfd4859b", + "id": "ef07c9cd-b280-415e-8b40-c31c125f687a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -835,7 +835,7 @@ { "listen": "test", "script": { - "id": "17f36d9c-5d97-41b3-a56c-a442f2034bb4", + "id": "f45655ad-3bf6-4eaf-9a11-838ec3d761fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -935,7 +935,7 @@ { "listen": "test", "script": { - "id": "28a47a6b-2d0b-41f1-9080-ec9c0f9c052a", + "id": "2c725b4a-8c72-4021-a20e-6e02f2aa66b6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -964,7 +964,7 @@ { "listen": "prerequest", "script": { - "id": "d91d41a2-8c4e-4c93-928f-0eb95e91f447", + "id": "14d8fad6-a776-4dcd-942d-2fa754280dab", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -1014,7 +1014,7 @@ { "listen": "test", "script": { - "id": "785cb482-5adc-4954-9e48-b3b824766312", + "id": "4527265c-abb4-431f-9def-16935a28c970", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1083,7 +1083,7 @@ { "listen": "test", "script": { - "id": "104903ed-c10f-4576-9097-2a6235b4e978", + "id": "00b1d268-6e5c-4517-9afb-aeda5d9c932c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1145,7 +1145,7 @@ { "listen": "test", "script": { - "id": "9cf86b6f-fe53-4666-b69d-eaa5ef42eb8c", + "id": "902789c5-b63c-49cf-9aa3-7a11b6af7234", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1232,7 +1232,7 @@ { "listen": "test", "script": { - "id": "932fe234-aef8-4779-84ea-e34720c53994", + "id": "d401bb29-580a-4beb-bc14-b27deb40d675", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1319,7 +1319,7 @@ { "listen": "test", "script": { - "id": "6ee06afa-add1-4b54-8120-5b70caa2ef60", + "id": "cfccf539-d237-4973-a40f-125f5e70444f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1351,7 +1351,7 @@ { "listen": "prerequest", "script": { - "id": "054f2cd6-a325-4857-8405-88689608ec1f", + "id": "ab005e45-73c6-442b-82af-6df863b9b2fd", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1398,7 +1398,7 @@ { "listen": "test", "script": { - "id": "eee496b1-64c8-46a8-8330-13ac58ba87f8", + "id": "a4ed6685-293a-419f-9736-be17056a89fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1465,7 +1465,7 @@ { "listen": "test", "script": { - "id": "5423bd73-d161-480a-b5a9-6ad0c2fb9ffc", + "id": "59ae49a5-76b7-4c30-849b-3999eaf06eb6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1526,7 +1526,7 @@ { "listen": "test", "script": { - "id": "84163d09-72d7-40f5-8b43-5ce9fdab862e", + "id": "5cf77015-60bc-4ff7-96ba-1b053c8a40e1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1590,7 +1590,7 @@ { "listen": "test", "script": { - "id": "347abd02-e3c0-4d6e-8581-49f9c71ea576", + "id": "36c2e580-9293-4b14-9d0f-7631fd66fea8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1659,7 +1659,7 @@ { "listen": "test", "script": { - "id": "4966d7d8-22e6-4a33-b490-dcc7a5296517", + "id": "1fb446ce-df53-4d4b-b63f-7a69f7e65b47", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1717,7 +1717,7 @@ { "listen": "test", "script": { - "id": "9b6b7042-79d3-459c-82d2-a062eef1fa30", + "id": "7b80fb3a-3786-4e58-ba89-0ceb0005c9d2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1771,7 +1771,7 @@ { "listen": "test", "script": { - "id": "c375b9c1-dea6-4e30-bfeb-c91552f30d51", + "id": "24395546-7226-4991-ba19-0871c3a6bd4b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1832,7 +1832,7 @@ { "listen": "test", "script": { - "id": "b3eb917c-bea0-4835-8b90-b876099f42f4", + "id": "0c348f56-fa7d-42e9-831e-0dbffc96a818", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -1905,7 +1905,7 @@ { "listen": "test", "script": { - "id": "b456040b-9c81-4d00-b141-50d2e7840aa5", + "id": "a421dc4f-4c54-4928-b35c-5ccc1e3aeaca", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -1978,7 +1978,7 @@ { "listen": "test", "script": { - "id": "93b721c7-2bc9-4d7d-8376-254f79bf7b76", + "id": "3ed09881-3531-4576-b04e-ca81797a6aa3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2044,7 +2044,7 @@ { "listen": "test", "script": { - "id": "90d021fe-5ffe-4bc4-9067-377d5acbb179", + "id": "13d99a48-3c2b-47cb-b0af-ffda66fde75b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2103,7 +2103,7 @@ { "listen": "test", "script": { - "id": "2fdf5cef-e02c-4284-b2f0-7a968680326f", + "id": "f194daec-3271-4988-a8cb-482deaa2396c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2170,7 +2170,7 @@ { "listen": "test", "script": { - "id": "174ae93d-a304-4754-bfca-4ec86eb9b5ba", + "id": "ee00219d-cad7-4edc-95c0-c4a8d35fbf40", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2228,7 +2228,7 @@ { "listen": "test", "script": { - "id": "8791eee1-c194-4e82-bf6a-8952196422f3", + "id": "6ae98899-3325-4348-98d0-4dd30fa1b366", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2307,7 +2307,7 @@ { "listen": "test", "script": { - "id": "f3ddd045-4460-40d8-9f03-e64e11bc39dd", + "id": "2a86b412-f51d-42c0-afab-d73b72c81878", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2365,7 +2365,7 @@ { "listen": "test", "script": { - "id": "ff3c4e46-5c4d-46df-a0b4-cc59c285d742", + "id": "76f112de-3709-49d9-af07-8c38a6ac825a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2426,7 +2426,7 @@ { "listen": "test", "script": { - "id": "2922f61a-f3f1-4ad1-8470-d6bec0114f43", + "id": "cb54ff0b-7bb7-4a1b-a658-c542d40ad77d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2492,7 +2492,7 @@ { "listen": "test", "script": { - "id": "b10ff819-21d4-4cc4-96d5-9676cb647464", + "id": "73739e2e-7315-4a81-9df3-0c73c1df0227", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2558,7 +2558,7 @@ { "listen": "test", "script": { - "id": "a00d91ea-1da1-43b7-99e0-c8e87da34647", + "id": "261b4b9f-c8e4-4777-9b6f-80602f4d5a1f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2603,7 +2603,7 @@ { "listen": "test", "script": { - "id": "171dbda8-3b6b-46c9-a806-3397df69c2a6", + "id": "dfa579b6-cbec-4b51-b12f-bb8777708d59", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2648,7 +2648,7 @@ { "listen": "test", "script": { - "id": "34a0b14e-359d-42e5-a49d-3ab013de9ae0", + "id": "c907b871-fd80-4315-8179-a2d961efbb3d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2693,7 +2693,7 @@ { "listen": "test", "script": { - "id": "d09ae77a-4cd3-410e-b0f1-6081f4dbc16f", + "id": "5c348fbd-6a7e-4f11-8acd-255bbcce311e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2738,7 +2738,7 @@ { "listen": "test", "script": { - "id": "1014eb9b-f317-41a1-b927-f54491688208", + "id": "7a752236-df89-4989-b02a-cca649eb598a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2783,7 +2783,7 @@ { "listen": "test", "script": { - "id": "13b3e46d-8035-4c46-bd28-993dbe604884", + "id": "7cc9af07-4871-4a03-81a2-de5a7a1aeddc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2835,7 +2835,7 @@ { "listen": "test", "script": { - "id": "5efb04a8-00ed-4a1c-8799-916e74702cc8", + "id": "ea63efbe-30b6-4d67-a015-12323b701683", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2886,7 +2886,7 @@ { "listen": "test", "script": { - "id": "db8afbeb-a854-4e66-93c1-5dcd3f7d11f9", + "id": "d7f1f11c-66fd-4f3d-80af-e887e0035258", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2937,7 +2937,7 @@ { "listen": "test", "script": { - "id": "07bd8a91-fd85-4991-a593-101fac6a334b", + "id": "1914aef0-c951-4739-bfec-b5ca9c72f066", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2988,7 +2988,7 @@ { "listen": "test", "script": { - "id": "853fd460-2d17-4395-8299-14b73e106338", + "id": "4dc3eb3c-6bd7-46fb-b9de-046bfde6a4ba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3039,7 +3039,7 @@ { "listen": "test", "script": { - "id": "7ed01475-7a4a-4fb2-91f0-db47fa55c869", + "id": "fc2d3d67-9b5b-40dc-9a63-12bc86bb02d5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3097,7 +3097,7 @@ { "listen": "test", "script": { - "id": "cce5b305-c4bd-4af7-acfa-892c865378a1", + "id": "a1f784ae-d11b-4e07-960a-6161d391acc9", "exec": [ "var jsonData = pm.response.json();\r", "\r", @@ -3161,7 +3161,7 @@ { "listen": "test", "script": { - "id": "87bae7d8-2886-4784-8434-58c0c64875a7", + "id": "c14ed50a-4edb-4332-88a2-4499190aee61", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -3211,7 +3211,7 @@ { "listen": "test", "script": { - "id": "cb25e787-d3ad-4a90-9f26-1592d0107b23", + "id": "4653d5ee-a8d8-42ef-b320-70d69988042b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -3274,7 +3274,7 @@ { "listen": "test", "script": { - "id": "f9995483-087a-433d-896c-3310f298dd0c", + "id": "ffff829b-209d-4a33-a8bc-17ae46a03596", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3352,7 +3352,7 @@ { "listen": "test", "script": { - "id": "eb689a77-e011-4189-814f-b022d9241d0a", + "id": "a4c83cc2-d104-447a-b595-8c6b24ec8f11", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3381,7 +3381,7 @@ { "listen": "prerequest", "script": { - "id": "e2fe4371-efe6-487d-abb9-0c4bb9a49c6c", + "id": "64abde23-dbb3-48d4-a11d-8026b705367d", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3431,7 +3431,7 @@ { "listen": "test", "script": { - "id": "027cd200-2dd8-433b-a656-af62a13fcdf0", + "id": "1841d85a-db89-4c02-9be3-772b35087f35", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3495,7 +3495,7 @@ { "listen": "prerequest", "script": { - "id": "7526e18a-0647-4457-bf63-4c430dbc196e", + "id": "1b66350b-feee-4172-afcb-c5e2cd92547e", "type": "text/javascript", "exec": [ "" @@ -3505,7 +3505,7 @@ { "listen": "test", "script": { - "id": "f10afc21-6ad0-4bbc-84aa-b71e3161699a", + "id": "388411d7-bc82-4180-86a4-8c6d7dbdcd67", "type": "text/javascript", "exec": [ "" @@ -3525,7 +3525,7 @@ { "listen": "test", "script": { - "id": "a5be345c-a705-40f6-b5a8-ac83577e7e53", + "id": "9331a15b-39b4-4248-83eb-533b6fddbac2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3583,7 +3583,7 @@ { "listen": "test", "script": { - "id": "4dc0ed22-0a31-4d05-bb10-0de041f29e34", + "id": "c7d23939-fb7c-4d54-bd2d-fa856af5ce2b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3633,7 +3633,7 @@ { "listen": "test", "script": { - "id": "c9485161-7393-428a-b37d-e7497e1f7ac2", + "id": "db7798cc-7825-421c-bc50-660f470d2b95", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3692,7 +3692,7 @@ { "listen": "test", "script": { - "id": "24b60ae4-c95b-43f1-8a9c-6f3327eea4a4", + "id": "cc9a9172-9103-4535-bb64-fdfd7c0b1191", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3741,7 +3741,7 @@ { "listen": "prerequest", "script": { - "id": "4b95a330-8fe3-4bec-b640-7810c751ec30", + "id": "6693dae7-a6fb-4fd6-94a2-3da9be4ea4d2", "type": "text/javascript", "exec": [ "" @@ -3751,7 +3751,7 @@ { "listen": "test", "script": { - "id": "e8d92873-5732-4216-b7e5-8587e05910d2", + "id": "f2ccd3b4-ffee-4619-b627-8f08e1ad6585", "type": "text/javascript", "exec": [ "" @@ -3771,7 +3771,7 @@ { "listen": "test", "script": { - "id": "26a65063-4c84-4353-b8b3-ec7797f7383e", + "id": "dc3d54dc-c46c-4d4c-b1f1-d3a0f87ee4e4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3831,7 +3831,7 @@ { "listen": "test", "script": { - "id": "44665555-caae-4292-9efe-3e6c38121547", + "id": "a06b21c5-81aa-44ac-bb8c-1b2b5c394302", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3901,7 +3901,7 @@ { "listen": "test", "script": { - "id": "c6999429-7f18-4a89-a7a3-8aaf42975fe6", + "id": "28d36360-ffb7-4b01-8fe7-743801504dc0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3956,7 +3956,7 @@ { "listen": "test", "script": { - "id": "f854509d-155c-4ff5-bf11-4407201e0ceb", + "id": "bd6819c9-8ec3-4968-8cf2-0920979f1162", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4013,7 +4013,7 @@ { "listen": "test", "script": { - "id": "6861cfd9-a686-4436-bcca-fe6d8013ea15", + "id": "c69e10c8-3274-450f-88bb-d96ded107611", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4062,7 +4062,7 @@ { "listen": "prerequest", "script": { - "id": "f7e4079f-7ec3-4382-99c8-0781172014ac", + "id": "a50ffab3-8c6a-4726-a8fc-b7ce15f7acbc", "type": "text/javascript", "exec": [ "" @@ -4072,7 +4072,7 @@ { "listen": "test", "script": { - "id": "77138fc1-b01f-4c96-9137-484926758957", + "id": "eff72a46-6eb0-4ac9-80c9-fc81e493eb0e", "type": "text/javascript", "exec": [ "" @@ -4092,7 +4092,7 @@ { "listen": "test", "script": { - "id": "fa03f593-3aed-47a7-abc0-662a73aa8cac", + "id": "8c582001-36a4-407c-9fdc-32b93f48d93c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4119,7 +4119,7 @@ { "listen": "prerequest", "script": { - "id": "312a5a99-cdfb-4a6f-bb77-ff99038916af", + "id": "f24b69f2-d116-4107-bd84-70e733bfdbff", "exec": [ "" ], @@ -4158,7 +4158,7 @@ { "listen": "test", "script": { - "id": "10a07448-7322-410b-8356-48b4a15d984b", + "id": "7b4ff1ee-bece-4498-bd8d-570213114574", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4203,7 +4203,7 @@ { "listen": "test", "script": { - "id": "fb3973fb-4a33-406e-89a5-747234261fa2", + "id": "75e77bb5-bfe2-4108-b49a-a16e526f9048", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4258,7 +4258,7 @@ { "listen": "test", "script": { - "id": "f82646d5-860f-498f-be9d-c677d82d6a10", + "id": "2defe73e-8334-4fdf-9dc3-302baff0beb3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4307,7 +4307,7 @@ { "listen": "test", "script": { - "id": "c0e3244f-aa09-47e2-bda1-175b8ec1eeed", + "id": "25b7611e-c3eb-48f5-8c29-24b6f19c2348", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4334,7 +4334,7 @@ { "listen": "prerequest", "script": { - "id": "7f92731a-c851-4c44-aa46-3a2e4796e14f", + "id": "08ce62b5-57c8-40c8-af62-fcfff4b2a2ae", "exec": [ "" ], @@ -4374,7 +4374,7 @@ { "listen": "test", "script": { - "id": "a63de592-db7d-4a99-b351-cb901c58c6b2", + "id": "82151960-2bff-4cf6-8363-3ecbed777a0b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4423,7 +4423,7 @@ { "listen": "prerequest", "script": { - "id": "0e094719-2b9f-4dd4-8b5c-0b50c96c7019", + "id": "2d1fb80e-1641-42b1-a4a2-d834fc4441ff", "type": "text/javascript", "exec": [ "" @@ -4433,7 +4433,7 @@ { "listen": "test", "script": { - "id": "97ea57e6-4fd2-4c89-8fa5-565a08f036b5", + "id": "12476d23-fd7a-4aae-a505-fee8180d87d3", "type": "text/javascript", "exec": [ "" @@ -4453,7 +4453,7 @@ { "listen": "test", "script": { - "id": "ecaedd00-4019-4b03-bdec-e92621013de6", + "id": "2060f93a-13d4-4aa7-bdc8-a2144ad9c2c2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4508,7 +4508,7 @@ { "listen": "test", "script": { - "id": "8c07b0a2-5ef9-4aa4-9252-d49b956f0627", + "id": "38fac606-a6b7-476a-9fed-1279526766d1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4554,7 +4554,7 @@ { "listen": "test", "script": { - "id": "e5b785db-27b6-439d-b8de-406af9610144", + "id": "a654e378-8627-44ca-9753-cf4351b40dea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4601,7 +4601,7 @@ { "listen": "test", "script": { - "id": "5b8583ad-f684-4d80-883b-6695de5ec058", + "id": "4537e1c0-628e-4839-93e5-fababbabff6e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4650,7 +4650,7 @@ { "listen": "prerequest", "script": { - "id": "5c4e1f20-5d94-44f8-b864-29c8b594a2e7", + "id": "1177af0d-7335-4bc0-a2bc-dd7e81ed9ac3", "type": "text/javascript", "exec": [ "" @@ -4660,7 +4660,7 @@ { "listen": "test", "script": { - "id": "c227126a-81ce-44d3-94e5-510ddb0bcab0", + "id": "9f518746-55a8-44a7-8640-15ed96848809", "type": "text/javascript", "exec": [ "" @@ -4680,7 +4680,7 @@ { "listen": "test", "script": { - "id": "a713d0c5-f97e-4f54-94e4-0c20377a8688", + "id": "405febf6-9332-45a2-8d02-00eef7b50afa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4736,7 +4736,7 @@ { "listen": "test", "script": { - "id": "568c0fe7-0c3e-4d44-92af-860d128198a1", + "id": "91de5c9d-b57a-45ae-92a1-f0818682b2c6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4783,7 +4783,7 @@ { "listen": "test", "script": { - "id": "fa7a408b-f2be-4c41-9be7-5c32a2d3c826", + "id": "99be39d4-72d4-4ebb-aeab-1ebf8c60d4aa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4831,7 +4831,7 @@ { "listen": "test", "script": { - "id": "478981ff-a581-4bb1-b26e-3b414eaded53", + "id": "9fab32e8-d27e-44ff-a2c3-f290d4b13b27", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4879,7 +4879,7 @@ { "listen": "test", "script": { - "id": "7b76878e-9636-417e-a77d-61837f59731b", + "id": "9c6f637a-5cb3-41fd-9cac-e224e0601e8b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4936,7 +4936,7 @@ { "listen": "test", "script": { - "id": "13106f42-34be-47d1-bb8a-75abc8d9aeb6", + "id": "82776114-2d37-42e9-8cdc-2e24aa985213", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5007,7 +5007,7 @@ { "listen": "prerequest", "script": { - "id": "afc2214c-b284-4c40-ae51-63536ca393ea", + "id": "1e9237c1-20bc-4912-8c3c-f88293d36baa", "type": "text/javascript", "exec": [ "" @@ -5017,7 +5017,7 @@ { "listen": "test", "script": { - "id": "a065eeb6-9bf2-41f1-9345-4762dc8462c9", + "id": "c917e58f-55c1-47e2-8a59-3206d9e764e3", "type": "text/javascript", "exec": [ "" @@ -5037,7 +5037,7 @@ { "listen": "test", "script": { - "id": "9b919e9c-a446-474e-a25a-dfd67df13697", + "id": "3055f99a-2505-4ee6-90a0-05882ca98af8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5088,7 +5088,7 @@ { "listen": "prerequest", "script": { - "id": "e508c30c-b241-4dbf-a642-48edc32fbc59", + "id": "776103c1-6551-4816-ad04-f75f3171672f", "type": "text/javascript", "exec": [ "" @@ -5098,7 +5098,7 @@ { "listen": "test", "script": { - "id": "f8fbddeb-1cad-4d10-8d3e-778616c2b813", + "id": "3e0d4979-fd33-430f-b80d-5226fc06ace8", "type": "text/javascript", "exec": [ "" @@ -5118,7 +5118,7 @@ { "listen": "test", "script": { - "id": "00e9770a-1867-48c8-8d49-187df039d513", + "id": "2e35776a-71fc-460b-ad44-3968b57f7145", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5174,7 +5174,7 @@ { "listen": "prerequest", "script": { - "id": "3aa7d701-4d96-4fc5-b321-99f19d270ece", + "id": "dd3155fe-3af7-49db-914c-c728f4a9413b", "type": "text/javascript", "exec": [ "" @@ -5184,7 +5184,7 @@ { "listen": "test", "script": { - "id": "5182c3f1-ac3e-4e27-b6b8-e021b24c7487", + "id": "a539954f-5c70-40f3-9351-e5eda2235214", "type": "text/javascript", "exec": [ "" @@ -5204,7 +5204,7 @@ { "listen": "test", "script": { - "id": "a82c9c2c-5e38-41bf-94fd-a34fd8696c3f", + "id": "edbe59ed-f27c-4014-b67b-6838315fed96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -5263,7 +5263,7 @@ { "listen": "test", "script": { - "id": "2d751eee-3c4a-4f30-bd7f-633eec2a267a", + "id": "9d8bfb6e-7ddb-4ed4-a38d-53cdb8a7ab35", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -5304,7 +5304,7 @@ { "listen": "test", "script": { - "id": "050f6049-4c47-4b98-9143-efb1888332db", + "id": "b3e9e559-19a3-4aa8-9351-596b5403ee41", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -5357,7 +5357,7 @@ { "listen": "prerequest", "script": { - "id": "2458d018-ef4e-4c95-b924-5689e23899f0", + "id": "888348de-e946-478c-882e-257cb6969905", "type": "text/javascript", "exec": [ "" @@ -5367,7 +5367,7 @@ { "listen": "test", "script": { - "id": "bed362b2-19fd-4612-8e0f-cddb39aec70d", + "id": "1d00d2e5-6758-4be3-8477-56c6f2006e68", "type": "text/javascript", "exec": [ "" @@ -5390,7 +5390,7 @@ { "listen": "test", "script": { - "id": "7c5ed658-dac3-4eb4-8bfd-79c6f3d2d7c5", + "id": "5f9b97ee-51c9-4994-8b7f-470ecc1bc2ad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5459,7 +5459,7 @@ { "listen": "test", "script": { - "id": "f9ac4414-c453-48d0-97f5-12ca7de73507", + "id": "04ceb7bc-e58e-4095-ac40-beec0fa666e3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5538,7 +5538,7 @@ { "listen": "test", "script": { - "id": "6af95dd1-9f26-4c4f-a96f-4f6bf9149374", + "id": "f3a668bc-8295-437f-a345-04bf695e3f96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5567,7 +5567,7 @@ { "listen": "prerequest", "script": { - "id": "70361920-a2bc-4549-909f-396a6567f19c", + "id": "b82ef3ac-fd4e-4222-a345-06ccfdaef95c", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5617,7 +5617,7 @@ { "listen": "test", "script": { - "id": "1331cab4-16ee-4636-9519-13db0cde8a00", + "id": "a9524062-d169-4096-8675-5ae9ae2c5d32", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5682,7 +5682,7 @@ { "listen": "test", "script": { - "id": "5204aca1-54c0-47fd-8047-f2a6390b7262", + "id": "33ffa4dd-a4da-4a5a-90de-1f8eaa88aace", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5755,7 +5755,7 @@ { "listen": "prerequest", "script": { - "id": "46865ead-58cd-4d0d-9fff-c88d8260e283", + "id": "ad24b2ff-ce24-4def-9cb8-5abf5ec89c0c", "type": "text/javascript", "exec": [ "" @@ -5765,7 +5765,7 @@ { "listen": "test", "script": { - "id": "064f3f61-03d0-47c5-a8e0-2d79040fa019", + "id": "4de94d08-3c34-4d96-8142-623c56f26f81", "type": "text/javascript", "exec": [ "" @@ -5785,7 +5785,7 @@ { "listen": "test", "script": { - "id": "6e746c36-a843-4cbe-89eb-6c3f20b79e59", + "id": "08d6cba2-f051-4983-8c9f-25c89b119e4f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -5845,7 +5845,7 @@ { "listen": "test", "script": { - "id": "001c29c9-ca90-4e58-835f-8b0d24bb80a0", + "id": "b8500d8d-eea1-4adf-859d-40ea2345f246", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5898,7 +5898,7 @@ { "listen": "test", "script": { - "id": "844197db-dfa8-4d65-a51f-7fdc62e1c730", + "id": "5c635b9c-8390-4932-a7c7-34304f220731", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -5956,7 +5956,7 @@ { "listen": "test", "script": { - "id": "6e288797-2b9c-4b5e-aa4d-69365535890a", + "id": "1e6aa51b-751f-407c-8b79-2e4c3784df80", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -6023,7 +6023,7 @@ { "listen": "test", "script": { - "id": "308464d0-cc57-4f7f-8f28-22a9abbb604f", + "id": "92543035-5b1f-420d-b22f-6288afd53932", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6085,7 +6085,7 @@ { "listen": "prerequest", "script": { - "id": "8e0f982f-c069-49c1-bdf6-b33f2fc03a5c", + "id": "0bcb8ab0-e5ca-4ad2-a9d0-be8bc5228b29", "type": "text/javascript", "exec": [ "" @@ -6095,7 +6095,7 @@ { "listen": "test", "script": { - "id": "18d75f41-62fe-4ae8-8b7e-e69e02f1f0ab", + "id": "0f680686-0fe9-4325-b97e-add2202f9359", "type": "text/javascript", "exec": [ "" @@ -6115,7 +6115,7 @@ { "listen": "test", "script": { - "id": "80f1a934-6202-443b-be02-2732369533fe", + "id": "43fbbf1b-27d6-4cd6-ba06-7c8a35cf2924", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6181,7 +6181,7 @@ { "listen": "test", "script": { - "id": "ce6680cc-cc2e-461e-98c4-7772a05d294e", + "id": "7b85cd15-ef37-4143-97b5-9f257d411cbf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6254,7 +6254,7 @@ { "listen": "test", "script": { - "id": "9fcb2869-0ee1-4325-9523-71ba51f030e2", + "id": "97b5bf00-70a6-4f9d-926e-2f2ee8872e3f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6312,7 +6312,7 @@ { "listen": "test", "script": { - "id": "cca21f15-6e3a-43c3-a0c1-3939a590769d", + "id": "7fc0c6e0-462d-46db-a2ca-b40b4a18e61a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6362,7 +6362,7 @@ { "listen": "test", "script": { - "id": "89def25a-d837-472b-997c-544cdf94fca2", + "id": "c89a76f8-9737-49f5-aaa3-90ecf77fcdf2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -6429,7 +6429,7 @@ { "listen": "test", "script": { - "id": "7419b9c9-59f4-438f-9873-6281493a0a28", + "id": "13055fa6-7dc7-41de-a358-4f9036a2ac2d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6496,7 +6496,7 @@ { "listen": "test", "script": { - "id": "b0491970-03ef-467f-bcce-746002d676de", + "id": "9bd13a66-da80-4727-9c97-e17b26aad895", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6560,7 +6560,7 @@ { "listen": "test", "script": { - "id": "60f576d2-85d7-4b55-b984-426932920fe9", + "id": "da9b0862-c18d-4cf0-8b83-4b06ae7d8ddc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6621,7 +6621,7 @@ { "listen": "test", "script": { - "id": "8b1988a8-3fc5-47b3-a249-bec5c17c2cfe", + "id": "358371ed-a7bd-4525-a1fa-9cef7303cd7c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6673,7 +6673,7 @@ { "listen": "test", "script": { - "id": "08dc6d28-54eb-4a1b-8b42-454f5f025feb", + "id": "8e4a0229-16d7-46be-9051-37a64169bebb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -6738,7 +6738,7 @@ { "listen": "test", "script": { - "id": "af7b7629-6df2-4782-980e-809bd804c1ef", + "id": "e742a6df-670b-4b4c-be69-0278eedb239a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6764,7 +6764,7 @@ { "listen": "prerequest", "script": { - "id": "fff31a27-550c-41d9-aa07-f5a82dbdd35c", + "id": "158e4ad9-4a1e-4e18-91ac-06705b0cdf3b", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -6814,7 +6814,7 @@ { "listen": "test", "script": { - "id": "15bbb853-7cdb-4689-862e-8f5401b3d190", + "id": "1fef519a-097f-4ae2-ba74-825e31c72797", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -6883,7 +6883,7 @@ { "listen": "test", "script": { - "id": "9308e8e3-bd24-410d-a2d3-f43d061fe691", + "id": "d0dea421-6192-4170-8946-69892ce1e557", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -6945,7 +6945,7 @@ { "listen": "test", "script": { - "id": "a10729ed-3663-4f65-a69c-4059cffb3300", + "id": "8c4469c2-08cd-45fb-aeff-a857c8571121", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7000,7 +7000,7 @@ { "listen": "test", "script": { - "id": "34a30305-b1ef-401e-9c96-ac0d641b0697", + "id": "493e3f9b-ec2f-41a6-8770-cba11b684fb2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7069,7 +7069,7 @@ { "listen": "test", "script": { - "id": "72c6d96f-1b9a-4cd9-894d-561f51cb9493", + "id": "18528a7c-8dfd-4140-8d98-c2422dabb597", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7130,7 +7130,7 @@ { "listen": "test", "script": { - "id": "959676c4-0b54-4df9-b094-58c5a0887780", + "id": "b077bfbc-40be-4db7-bec3-b75097ed7829", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7182,7 +7182,7 @@ { "listen": "test", "script": { - "id": "f16c7eee-2ce2-47f5-aa30-088f75633d01", + "id": "4809d937-4234-4ca2-8209-4543dd3579a1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7235,7 +7235,7 @@ { "listen": "test", "script": { - "id": "9d154ed3-c8f1-4848-b650-1b0463681a22", + "id": "1eb05adc-32a9-4ae0-98e5-7707ecb5d2f0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7288,7 +7288,7 @@ { "listen": "test", "script": { - "id": "b23a073f-d179-462c-9fcd-3667ef4e5c99", + "id": "f2cc75a1-f110-4dee-983f-42d44fcf3903", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7350,7 +7350,7 @@ { "listen": "test", "script": { - "id": "4477891c-7e3b-4f29-a86b-4efed071ae84", + "id": "bad3aac9-206a-46e6-8c33-de58391df12b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7431,7 +7431,7 @@ { "listen": "test", "script": { - "id": "1d984807-9a06-45f3-b12a-d879685e50b1", + "id": "e5baf407-4ce6-4ee5-972c-5d231f128143", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7490,7 +7490,7 @@ { "listen": "test", "script": { - "id": "83dba95e-c057-4ef7-9d9d-6aa90e47a295", + "id": "813e1b2e-80ee-42cf-bb9b-4504f9b4830e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -7556,7 +7556,7 @@ { "listen": "test", "script": { - "id": "a05c7bf3-f53d-4592-adbf-5f861d6241af", + "id": "665d5267-3b5a-44fc-af02-6d41786b1dcb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7605,7 +7605,7 @@ { "listen": "test", "script": { - "id": "d90920cd-4cba-46af-9d8e-b3b306abdd67", + "id": "98e1746f-3382-4166-9798-c23b7fa93f78", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7656,7 +7656,7 @@ { "listen": "test", "script": { - "id": "3e334484-3ae4-49a1-880a-672583fcfe87", + "id": "1c3b4353-7bb2-42da-9c9a-733255059648", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7707,7 +7707,7 @@ { "listen": "test", "script": { - "id": "fb355d27-e327-4cd5-8b54-31eabaef921c", + "id": "5375bd00-68a8-4058-96e6-fe3be7d6248c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7752,7 +7752,7 @@ { "listen": "test", "script": { - "id": "91a53380-e37d-455c-812b-6acbef693880", + "id": "f2013e40-cc7d-4672-91a6-354a6054273e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7803,7 +7803,7 @@ { "listen": "test", "script": { - "id": "0958f36c-e814-4f56-9ebe-69da3c2d99a9", + "id": "2d0848f0-8bc7-4ccb-8e5e-1a7abf75d5a8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7854,7 +7854,7 @@ { "listen": "test", "script": { - "id": "0db71748-ad77-4ade-a214-d90600b8ddd6", + "id": "a7674331-cb41-4302-a7ec-23ed75b4e118", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7912,7 +7912,7 @@ { "listen": "test", "script": { - "id": "fcd9e64b-7f83-4392-888d-10dbbd787bdd", + "id": "e49aee53-2999-4ee2-9b72-36c25fdb8d66", "exec": [ "var jsonData = pm.response.json();\r", "\r", @@ -7974,7 +7974,7 @@ { "listen": "test", "script": { - "id": "6420b3d6-c6d9-4062-89b9-b9406e903309", + "id": "eaf72655-86c9-4e83-8fa2-493ce4664d3c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -8021,7 +8021,7 @@ { "listen": "test", "script": { - "id": "2542e69e-5932-46b6-ba88-05b23571ba13", + "id": "5117ccab-783a-401d-8fbb-a019313f7956", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -8084,7 +8084,7 @@ { "listen": "test", "script": { - "id": "b169a452-99ac-4a80-9267-ebc33576195e", + "id": "7a620481-111d-4847-bf17-dada57960822", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8153,7 +8153,7 @@ { "listen": "test", "script": { - "id": "a043e333-3f9a-422c-8e59-65ca5dcf5cb9", + "id": "0b5e4ade-0265-4334-b408-0d56c88d34d9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8232,7 +8232,7 @@ { "listen": "test", "script": { - "id": "ff9717e7-5768-43a2-bedc-df0ce7a118eb", + "id": "27d315b7-02ed-4a48-b07f-d5d243ad3341", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8261,7 +8261,7 @@ { "listen": "prerequest", "script": { - "id": "d35ec241-382b-4f87-804b-bc8280fa3f9c", + "id": "9b6d52d1-b16c-43c1-b848-5bf819e44706", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8311,7 +8311,7 @@ { "listen": "test", "script": { - "id": "bb16ca95-521e-4c1e-a4e7-f7a31f9aa097", + "id": "e011418a-b560-40eb-836d-411a321d8375", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8375,7 +8375,7 @@ { "listen": "test", "script": { - "id": "0442c601-89ea-4e4e-932f-a99eaa7e1a4f", + "id": "a6dbab58-9e59-4a64-becc-324d6e4926cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8448,7 +8448,7 @@ { "listen": "prerequest", "script": { - "id": "2aa18a39-1ae2-417c-b6a2-19e33db6eb48", + "id": "632b92a2-d36f-42fc-93fc-a53038a7a3c7", "type": "text/javascript", "exec": [ "" @@ -8458,7 +8458,7 @@ { "listen": "test", "script": { - "id": "c4218e58-b9f1-4116-9823-e021fe25faca", + "id": "c68a66e3-a957-468d-8978-822e7ee20ad4", "type": "text/javascript", "exec": [ "" @@ -8478,7 +8478,7 @@ { "listen": "test", "script": { - "id": "71f71182-5a59-424e-a73c-9b3c036d5105", + "id": "2526d00e-de31-436a-a80b-a5bcaff1caf8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -8538,7 +8538,7 @@ { "listen": "test", "script": { - "id": "a1accd44-70ee-44ec-a6a1-01ffdab039a9", + "id": "ef287a65-01ef-4e95-a034-f9044070dd01", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8591,7 +8591,7 @@ { "listen": "test", "script": { - "id": "0b3e4444-9f53-4816-8637-bac93d9433d7", + "id": "cd9e3031-69c8-4e44-808c-65f2b6865868", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -8649,7 +8649,7 @@ { "listen": "test", "script": { - "id": "709b04e1-8ba3-4fc5-bed0-431095bf9101", + "id": "807cc766-74e4-4862-808d-5c941787feb3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -8716,7 +8716,7 @@ { "listen": "test", "script": { - "id": "5fb4a144-7367-4440-85eb-50de8607fcc8", + "id": "0e8b779d-1981-44b3-8459-176519c1c42c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8778,7 +8778,7 @@ { "listen": "prerequest", "script": { - "id": "26b93ac6-c18e-4ed5-9607-f1bd384dad92", + "id": "2be78af1-d09e-425a-bd55-88f12af03b90", "type": "text/javascript", "exec": [ "" @@ -8788,7 +8788,7 @@ { "listen": "test", "script": { - "id": "8767e003-e4c9-4bb9-aac9-58e3e03ae334", + "id": "3b33e7a1-292b-4925-a63c-680cee05564d", "type": "text/javascript", "exec": [ "" @@ -8808,7 +8808,7 @@ { "listen": "test", "script": { - "id": "f4e89290-7f16-4f96-a7dd-449b474e5e34", + "id": "6e50b436-ae07-4c93-a449-deb7b8396ac2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -8874,7 +8874,7 @@ { "listen": "test", "script": { - "id": "b9bbaced-5115-4fff-b44f-7bd358b0c6cf", + "id": "25c6a0ae-671d-448b-b43c-fc45d6d216dc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8947,7 +8947,7 @@ { "listen": "test", "script": { - "id": "ab26c1e3-07f2-42b0-8cc2-6e537bace17c", + "id": "5458444f-f4ff-4843-849b-10307cb3ad35", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9005,7 +9005,7 @@ { "listen": "test", "script": { - "id": "ceb8c81c-602d-44a0-aa89-b65b8f21092b", + "id": "c2fce6e5-d59b-405e-9bb6-ea88ead403cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -9055,7 +9055,7 @@ { "listen": "test", "script": { - "id": "f7869cbe-eb8d-42e6-9d53-420b16a4cb24", + "id": "b2dd9a04-2220-4c37-a49b-ccd3fc252c09", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -9122,7 +9122,7 @@ { "listen": "test", "script": { - "id": "e0e9fbf5-4491-4cab-b532-8f3cb68c0dee", + "id": "effb74b8-5a26-4600-994c-c52a27c3de11", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9189,7 +9189,7 @@ { "listen": "test", "script": { - "id": "0f44e558-896e-41a5-821d-8e47f76b69e0", + "id": "d660af76-12fe-482a-9839-d5ccb410876f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9253,7 +9253,7 @@ { "listen": "test", "script": { - "id": "8f28ddb0-dc64-42fd-bb4a-8e9d604b2bdc", + "id": "a90639b2-53b0-4411-9a8d-51c39ccf63ea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9317,7 +9317,7 @@ { "listen": "test", "script": { - "id": "5a46191c-6f56-49fb-bab6-56ae8bb748d2", + "id": "ccf12192-e359-4357-9466-c4d7021335a1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9369,7 +9369,7 @@ { "listen": "test", "script": { - "id": "860c6ad3-a700-402d-bbea-e7e9134ff6b1", + "id": "c2623d5f-9e13-47c7-811f-d30e1a70be2f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -9427,7 +9427,7 @@ { "listen": "test", "script": { - "id": "9a51456b-e0ed-4ce8-80e6-bbcfaba23a76", + "id": "67888cc0-a375-4384-97e8-e4798263a59d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -9492,7 +9492,7 @@ { "listen": "test", "script": { - "id": "a07d03e3-e428-48c4-8782-fdfe6df4adb7", + "id": "d1f6be16-40ad-462e-9ac9-5f4e32b3d97f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9520,7 +9520,7 @@ { "listen": "prerequest", "script": { - "id": "1b1f4f93-0700-4aa8-81d3-9629d2302b24", + "id": "2a77b1ba-419f-488c-873e-d323c6a2fd12", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9570,7 +9570,7 @@ { "listen": "test", "script": { - "id": "7ce7a9ec-5505-4be5-b196-f027612f2caa", + "id": "ffd4afd7-9945-4624-a27c-7d7e6f1f0c6a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9632,7 +9632,7 @@ { "listen": "test", "script": { - "id": "bc0cc017-fc11-4342-b8f4-38d8a78c6132", + "id": "59556001-ff1e-4d88-9364-d73e22fa756e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9719,7 +9719,7 @@ { "listen": "test", "script": { - "id": "2387dfdf-168a-4924-818f-3d9d413fcc22", + "id": "7df36f8e-ad18-4e02-82a1-bafe366d150c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9745,7 +9745,7 @@ { "listen": "prerequest", "script": { - "id": "7b45e6c0-c13b-4446-8e5a-b2746a956962", + "id": "1c313379-1623-486f-8945-0f44f2859aab", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9792,7 +9792,7 @@ { "listen": "test", "script": { - "id": "db35f394-6e0c-487e-afcd-5cf5b0474c34", + "id": "bd6cab94-51b6-4fc5-9293-1a7d3eb65d9a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9819,7 +9819,7 @@ { "listen": "prerequest", "script": { - "id": "e6f02e64-377a-4c49-8849-ec5f24bcf0ae", + "id": "f9572367-4760-42c2-83ba-860d5c7381bb", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9869,7 +9869,7 @@ { "listen": "test", "script": { - "id": "a1caaca9-d7f3-4125-84d6-b00501f076be", + "id": "bf005d7a-9fc5-44c1-b79c-66e467b667c8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9931,7 +9931,7 @@ { "listen": "test", "script": { - "id": "770e3445-b3be-442b-9fc4-885d5d00c391", + "id": "dc46a14d-8d1d-40f6-8e6c-7a23e00d8181", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10018,7 +10018,7 @@ { "listen": "test", "script": { - "id": "2ff291cf-8fc7-4232-8d9a-656249874818", + "id": "a04ee0a3-dcaa-4fa1-9aed-591e43b6e719", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10044,7 +10044,7 @@ { "listen": "prerequest", "script": { - "id": "1acb04b5-f103-40aa-bc85-9ccc8fd13195", + "id": "f5b1f810-633d-4ed9-86f0-1bdfbb350bf5", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10091,7 +10091,7 @@ { "listen": "test", "script": { - "id": "37802e2f-c4c9-48be-af4c-43eb02764f4b", + "id": "2e2d5c11-90b1-4b6a-a440-0f96f0b3bb29", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10167,7 +10167,7 @@ { "listen": "test", "script": { - "id": "7eaa4f9b-923a-49e1-a883-6049f9de787b", + "id": "afc8ea09-724f-4f40-8bcd-039bb5ee8e61", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10228,7 +10228,7 @@ { "listen": "test", "script": { - "id": "f5dd4791-91f1-44f1-8501-3807914d6650", + "id": "e9e9d949-a6eb-44c3-bc17-3aab9d2f0e41", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10280,7 +10280,7 @@ { "listen": "test", "script": { - "id": "ae44170d-6f86-4a03-b05b-5b0502a0d2c7", + "id": "66d5b400-da6f-49b8-88fd-2a041c6202f2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10333,7 +10333,7 @@ { "listen": "test", "script": { - "id": "be136538-a304-4423-8dbb-71e216b1f96a", + "id": "d473e41d-ba50-42e3-8536-96cf7a1016a8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10386,7 +10386,7 @@ { "listen": "test", "script": { - "id": "21ca596b-17dd-43f2-94ed-4ab9a661d4aa", + "id": "94b5698a-c226-455a-8a3b-016af0b06efb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10448,7 +10448,7 @@ { "listen": "test", "script": { - "id": "4a147f5b-e5fb-45d9-9e61-eed7a9c8cb6f", + "id": "d2aba0b6-e78b-420c-b5bb-6d655fd3d43a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10529,7 +10529,7 @@ { "listen": "test", "script": { - "id": "53913f62-b306-49b1-92de-a36041f10eca", + "id": "b6eb4b04-cece-4446-8ddd-207ed8523007", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10588,7 +10588,7 @@ { "listen": "test", "script": { - "id": "2bfc6f7a-f393-4773-9537-cb30b0d6469c", + "id": "44e71ed2-bd92-4286-8bc2-acef18bea485", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -10654,7 +10654,7 @@ { "listen": "test", "script": { - "id": "a30b5c36-4e59-4414-b750-fa90776156fd", + "id": "dcd89b68-8f60-428e-adbd-1abf8a6b22bc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10703,7 +10703,7 @@ { "listen": "test", "script": { - "id": "af52ce7b-3a2f-4fa5-837f-4b00330698d3", + "id": "fa49a201-0534-44b9-8d6c-cdd8495503b7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10752,7 +10752,7 @@ { "listen": "test", "script": { - "id": "87b1ad6d-29ef-4207-a341-fb10a3d231b5", + "id": "6a73d985-da4c-4ca5-b812-315363bff529", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10797,7 +10797,7 @@ { "listen": "test", "script": { - "id": "d5e44c9e-51bb-482d-a887-54188c69ff19", + "id": "b72f04f4-2ee5-4cc6-8b3a-e1e8d873dec2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10842,7 +10842,7 @@ { "listen": "test", "script": { - "id": "22dc922f-a8a7-4ac4-95be-3ae32d3c1d9f", + "id": "162090c6-5750-40bc-8d45-069ddcfddd7d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10887,7 +10887,7 @@ { "listen": "test", "script": { - "id": "2f8fbde2-bbf5-439f-a671-e2014d7381ce", + "id": "74b2f832-e4c9-41df-a9d0-6fb42e40bf4e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10940,7 +10940,7 @@ { "listen": "test", "script": { - "id": "be82389d-3049-4f4e-8b42-f83cb5f24edd", + "id": "71844e1b-3856-4a83-a7be-bd2ce6efb036", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10993,7 +10993,7 @@ { "listen": "test", "script": { - "id": "d711aa1d-dc70-43d7-9e7b-59880f5ee959", + "id": "3bd9e77d-85a4-4ec1-8f68-f074da52c78d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11053,7 +11053,7 @@ { "listen": "test", "script": { - "id": "56c5fa0b-618f-46d0-ae3d-ccb3a38a48b7", + "id": "f0aec656-1cc5-475c-a64a-edb93dbf157e", "exec": [ "var jsonData = pm.response.json();\r", "\r", @@ -11092,7 +11092,7 @@ { "key": "File", "type": "file", - "src": "/C:/Users/Niray/source/repos/dex-backend/Postman/testimage.png" + "src": "testimage.png" } ] }, @@ -11115,7 +11115,7 @@ { "listen": "test", "script": { - "id": "7ecae597-6a7d-4f73-8d52-f148fc07b72a", + "id": "a5e946ff-b01e-4140-9382-dbd64066ab23", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -11165,7 +11165,7 @@ { "listen": "test", "script": { - "id": "86056755-ca0c-4b74-856b-e1568813789c", + "id": "1d8d7e2e-f0e7-4410-bfe9-79efeaa50609", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -11244,7 +11244,7 @@ { "listen": "prerequest", "script": { - "id": "98d99c07-2ed8-4653-81a6-a296d2493dec", + "id": "fc7f2bbc-c2fc-4579-9150-452bff60ad27", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11288,7 +11288,7 @@ { "listen": "test", "script": { - "id": "2e5986ab-5640-493e-8d59-ce2f22726d36", + "id": "6a86a871-22c8-41a7-8df2-0442a191e4bc", "type": "text/javascript", "exec": [ "" diff --git a/Services.Tests/RoleServiceTest.cs b/Services.Tests/RoleServiceTest.cs index 387e229c..367b51c9 100644 --- a/Services.Tests/RoleServiceTest.cs +++ b/Services.Tests/RoleServiceTest.cs @@ -86,7 +86,7 @@ public void isValidScope_true() "EmbedWrite", "EmbedRead" }; - bool isValidScope = Service.isValidScope("RoleRead"); + bool isValidScope = Service.IsValidScope("RoleRead"); Assert.IsTrue(isValidScope); } @@ -97,7 +97,7 @@ public void isValidScope_true() [Test] public void isValidScope_false() { - bool isValidScope = Service.isValidScope("role:read"); + bool isValidScope = Service.IsValidScope("role:read"); Assert.IsFalse(isValidScope); } diff --git a/Services/Services/RoleService.cs b/Services/Services/RoleService.cs index 7298a5de..7df1d937 100644 --- a/Services/Services/RoleService.cs +++ b/Services/Services/RoleService.cs @@ -32,7 +32,7 @@ public interface IRoleService : IService Task> GetAllAsync(); List GetValidScopes(); - bool isValidScope(string scope); + bool IsValidScope(string scope); } @@ -76,7 +76,7 @@ public List GetValidScopes() /// /// true if [is valid scope] [the specified scope]; otherwise, false. /// - public bool isValidScope(string scope) + public bool IsValidScope(string scope) { List scopes = GetValidScopes(); return scopes.Contains(scope); From 4e2fb88f8a66ca72058508626041020c6e4e6e7a Mon Sep 17 00:00:00 2001 From: I380210 Date: Wed, 7 Oct 2020 09:49:53 +0200 Subject: [PATCH 039/157] changed Resource results for userUser and UserProject --- API/Configuration/MappingProfile.cs | 21 +++++++++++++++++---- API/Controllers/UserController.cs | 4 +++- API/Resources/UserUserResourceResult.cs | 8 ++++---- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 78d73fdb..9dc17199 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -31,12 +31,25 @@ public class MappingProfile : Profile /// public MappingProfile() { - CreateMap() - .ForMember(q => q.UserProject, options => options.MapFrom(q => q.Project.Name)) - .ForAllOtherMembers(o => o.Ignore()); + // CreateMap() + // .ForMember(q => q.UserProject, options => options.MapFrom(q => q.Project.Name)) + // .ForAllOtherMembers(o => o.Ignore()); CreateMap(); - CreateMap(); + + CreateMap() + .ForMember(q => q.Id, opt => opt.MapFrom(q => q.FollowedUser.Id)) + .ForMember(q => q.Name, opt => opt.MapFrom(q => q.FollowedUser.Name)) + .ForAllOtherMembers(o => o.Ignore()); + + CreateMap() + .ForMember(q => q.Project.Name, opt => opt.MapFrom(p => p.Project.Name)) + .ForMember(q => q.Project.ShortDescription, opt => opt.MapFrom(p => p.Project.ShortDescription)) + .ForMember(q => q.Project.Uri, opt => opt.MapFrom(p => p.Project.Uri)) + .ForMember(q => q.Project.Description, opt => opt.MapFrom(p => p.Project.Description)) + .ForAllOtherMembers(o => o.Ignore()); + + CreateMap(); diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index cca7e38c..0bc8005d 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -413,7 +413,9 @@ public async Task FollowUser(int followedUserId) userUserService.Add(userUser); userUserService.Save(); - return Ok(); + //return Ok(); + return Ok(mapper.Map(userUser)); + } /// diff --git a/API/Resources/UserUserResourceResult.cs b/API/Resources/UserUserResourceResult.cs index 743fc73a..c519c0a6 100644 --- a/API/Resources/UserUserResourceResult.cs +++ b/API/Resources/UserUserResourceResult.cs @@ -14,19 +14,19 @@ public class UserUserResourceResult /// /// PK of UserUser /// - public int Id { get; set; } + //public int Id { get; set; } /// /// Set or get user /// - public User User{ get; set; } + //public User User{ get; set; } /// /// set or get User /// - public int UserId { get; set; } + public int Id { get; set; } /// /// User object to follow /// - public User Followeduser { get; set; } + public string Name { get; set; } } } From 91b0a2bf5644a8b93f9be86c1fd237ed08f4d165 Mon Sep 17 00:00:00 2001 From: I380210 Date: Wed, 7 Oct 2020 10:24:03 +0200 Subject: [PATCH 040/157] Fixes regarding feedback on PR In resources changed using models to using resources instead. Moved following projects from user controller to project controller. Added comments and got rid of all warnings. Co-Authored-By: Dave Bouman <49709450+DaveBouman@users.noreply.github.com> --- API/Configuration/MappingProfile.cs | 19 ++-- API/Controllers/ProjectController.cs | 118 +++++++++++++++++++- API/Controllers/UserController.cs | 123 ++------------------- API/Resources/UserProjectResource.cs | 32 ------ API/Resources/UserProjectResourceResult.cs | 15 +-- API/Resources/UserResourceResult.cs | 2 +- API/Resources/UserUserResource.cs | 27 ----- API/Resources/UserUserResourceResult.cs | 10 +- Services/Services/UserProjectService.cs | 2 +- 9 files changed, 141 insertions(+), 207 deletions(-) delete mode 100644 API/Resources/UserProjectResource.cs delete mode 100644 API/Resources/UserUserResource.cs diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 9dc17199..76f67499 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -31,24 +31,19 @@ public class MappingProfile : Profile /// public MappingProfile() { - // CreateMap() - // .ForMember(q => q.UserProject, options => options.MapFrom(q => q.Project.Name)) - // .ForAllOtherMembers(o => o.Ignore()); + CreateMap(); - CreateMap(); - - CreateMap() + CreateMap() .ForMember(q => q.Id, opt => opt.MapFrom(q => q.FollowedUser.Id)) .ForMember(q => q.Name, opt => opt.MapFrom(q => q.FollowedUser.Name)) .ForAllOtherMembers(o => o.Ignore()); - CreateMap() - .ForMember(q => q.Project.Name, opt => opt.MapFrom(p => p.Project.Name)) - .ForMember(q => q.Project.ShortDescription, opt => opt.MapFrom(p => p.Project.ShortDescription)) - .ForMember(q => q.Project.Uri, opt => opt.MapFrom(p => p.Project.Uri)) - .ForMember(q => q.Project.Description, opt => opt.MapFrom(p => p.Project.Description)) + CreateMap() + .ForMember(q => q.Name, opt => opt.MapFrom(p => p.Project.Name)) + .ForMember(q => q.ShortDescription, opt => opt.MapFrom(p => p.Project.ShortDescription)) + .ForMember(q => q.Uri, opt => opt.MapFrom(p => p.Project.Uri)) + .ForMember(q => q.Description, opt => opt.MapFrom(p => p.Project.Description)) .ForAllOtherMembers(o => o.Ignore()); - CreateMap(); diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index f0dec293..74a7ec42 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -41,18 +41,22 @@ public class ProjectController : ControllerBase private readonly IMapper mapper; private readonly IProjectService projectService; private readonly IUserService userService; + private readonly IUserProjectService userProjectService; + /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class /// - /// The project service. - /// The user service. - /// The mapper. - public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper) + /// + /// + /// + /// + public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper,IUserProjectService userProjectService) { this.projectService = projectService; this.userService = userService; this.mapper = mapper; + this.userProjectService = userProjectService; } /// @@ -264,5 +268,109 @@ public async Task DeleteProject(int projectId) projectService.Save(); return Ok(); } + + /// + /// Follows a project with given projectId and gets userId + /// + /// + /// 200 if success 409 if user already follows project + [HttpPost("follow/{projectId}")] + [Authorize] + public async Task FollowProject(int projectId) + { + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + if(await userService.FindAsync(user.Id) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the user account.", + Detail = "The database does not contain a user with this user id.", + Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" + }; + return NotFound(problem); + } + + if(userProjectService.CheckIfUserFollows(user.Id, projectId)) + { + ProblemDetails problem = new ProblemDetails + { + Title = "User already follows this project", + Detail = "You are already following this project.", + Instance = "27D14082-9906-4EB8-AE4C-65BAEC0BB4FD" + }; + return Conflict(problem); + } + + Project project = await projectService.FindAsync(projectId); + + if(await projectService.FindAsync(projectId) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the project.", + Detail = "The database does not contain a project with this project id.", + Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" + }; + return NotFound(problem); + } + UserProject userProject = new UserProject(project, user); + userProjectService.Add(userProject); + + userProjectService.Save(); + return Ok(mapper.Map(userProject)); + } + + /// + /// Unfollows project + /// + /// + /// + [HttpDelete("follow/{projectId}")] + [Authorize] + public async Task UnfollowProject(int projectId) + { + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + if(await userService.FindAsync(user.Id) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the user account.", + Detail = "The database does not contain a user with this user id.", + Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" + }; + return NotFound(problem); + } + + if(userProjectService.CheckIfUserFollows(user.Id, projectId) == false) + { + ProblemDetails problem = new ProblemDetails + { + Title = "User is not following this project", + Detail = "You are not following this project.", + Instance = "27D14082-9906-4EB8-AE4C-65BAEC0BB4FD" + }; + return Conflict(problem); + } + + Project project = await projectService.FindAsync(projectId); + + if(await projectService.FindAsync(projectId) == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the project.", + Detail = "The database does not contain a project with this project id.", + Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" + }; + return NotFound(problem); + } + UserProject userProject = new UserProject(project, user); + userProjectService.Remove(userProject); + + userProjectService.Save(); + return Ok(); + } } } diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 0bc8005d..f3d17a8c 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -42,22 +42,21 @@ public class UserController : ControllerBase private readonly IUserService userService; private readonly IRoleService roleService; private readonly IProjectService projectService; - private readonly IUserProjectService userProjectService; private readonly IUserUserService userUserService; - /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The user service. - /// The mapper. - /// The role service. - public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IUserProjectService userProjectService, IProjectService projectService,IUserUserService userUserService) + /// + /// + /// + /// + /// + public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IProjectService projectService,IUserUserService userUserService) { this.userService = userService; this.mapper = mapper; this.roleService = roleService; this.projectService = projectService; - this.userProjectService = userProjectService; this.userUserService = userUserService; } @@ -222,109 +221,7 @@ public async Task DeleteAccount() return Ok(); } - /// - /// Follows a project with given projectId and gets userId - /// - /// - /// 200 if success 409 if user already follows project - [HttpPost("follow/project/{projectId}")] - [Authorize] - public async Task FollowProject(int projectId) - { - User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - - if(await userService.FindAsync(user.Id) == null) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting the user account.", - Detail = "The database does not contain a user with this user id.", - Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" - }; - return NotFound(problem); - } - - if(userProjectService.CheckIfUserFollows(user.Id,projectId)) - { - ProblemDetails problem = new ProblemDetails - { - Title = "User already follows this project", - Detail = "You are already following this project.", - Instance = "27D14082-9906-4EB8-AE4C-65BAEC0BB4FD" - }; - return Conflict(problem); - } - - Project project = await projectService.FindAsync(projectId); - - if(await projectService.FindAsync(projectId) == null) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting the project.", - Detail = "The database does not contain a project with this project id.", - Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" - }; - return NotFound(problem); - } - UserProject userProject = new UserProject(project, user); - userProjectService.Add(userProject); - - userProjectService.Save(); - return Ok(); - } - - /// - /// Unfollows project - /// - /// - /// - [HttpDelete("follow/project/{projectId}")] - [Authorize] - public async Task UnfollowProject(int projectId) - { - User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - - if(await userService.FindAsync(user.Id) == null) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting the user account.", - Detail = "The database does not contain a user with this user id.", - Instance = "B778C55A-D41E-4101-A7A0-F02F76E5A6AE" - }; - return NotFound(problem); - } - - if(userProjectService.CheckIfUserFollows(user.Id, projectId)== false) - { - ProblemDetails problem = new ProblemDetails - { - Title = "User is not following this project", - Detail = "You are not following this project.", - Instance = "27D14082-9906-4EB8-AE4C-65BAEC0BB4FD" - }; - return Conflict(problem); - } - - Project project = await projectService.FindAsync(projectId); - - if(await projectService.FindAsync(projectId) == null) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting the project.", - Detail = "The database does not contain a project with this project id.", - Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" - }; - return NotFound(problem); - } - UserProject userProject = new UserProject(project, user); - userProjectService.Remove(userProject); - - userProjectService.Save(); - return Ok(); - } + /// /// Delete the user account. @@ -369,7 +266,7 @@ public async Task DeleteAccount(int userId) /// /// /// - [HttpPost("follow/user/{followedUserId}")] + [HttpPost("follow/{followedUserId}")] [Authorize] public async Task FollowUser(int followedUserId) { @@ -423,7 +320,7 @@ public async Task FollowUser(int followedUserId) /// /// /// - [HttpDelete("follow/user/{followedUserId}")] + [HttpDelete("follow/{followedUserId}")] [Authorize] public async Task UnfollowUser(int followedUserId) { diff --git a/API/Resources/UserProjectResource.cs b/API/Resources/UserProjectResource.cs deleted file mode 100644 index 10977b98..00000000 --- a/API/Resources/UserProjectResource.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace API.Resources -{ - /// - /// The view model result of UserProject - /// - public class UserProjectResource - { - /// - /// Get or Set Id of a userProjectService Resource Result - /// - public int Id { get; set; } - /// - /// This gets or sets the project - /// - public Project Project { get; set; } - - /// - /// This gets or sets the user - /// - public User User { get; set; } - /// - /// This gets or sets the userid - /// - public int UserId { get; set; } - } -} diff --git a/API/Resources/UserProjectResourceResult.cs b/API/Resources/UserProjectResourceResult.cs index 6758a779..ab7c377c 100644 --- a/API/Resources/UserProjectResourceResult.cs +++ b/API/Resources/UserProjectResourceResult.cs @@ -11,21 +11,22 @@ namespace API.Resources /// public class UserProjectResourceResult { - /// - /// PK of UserProject - /// - public int Id { get; set; } /// /// Set or get Project /// - public Project Project { get; set; } + public string Name{ get; set; } /// /// set or get User /// - public User User { get; set; } + public string ShortDescription { get; set; } /// /// set or get userId /// - public int UserId { get; set; } + public string Description{ get; set; } + + /// + /// Uri project + /// + public string Uri { get; set; } } } diff --git a/API/Resources/UserResourceResult.cs b/API/Resources/UserResourceResult.cs index db347dcf..aeb329e4 100644 --- a/API/Resources/UserResourceResult.cs +++ b/API/Resources/UserResourceResult.cs @@ -63,7 +63,7 @@ public class UserResourceResult /// /// Gets or sets the followed projects for user /// - public List UserProject { get; set; } + public List UserProject { get; set; } } } diff --git a/API/Resources/UserUserResource.cs b/API/Resources/UserUserResource.cs deleted file mode 100644 index 22012b1a..00000000 --- a/API/Resources/UserUserResource.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Models; - -namespace API.Resources -{ - /// - /// The view model result of UserUser - /// - public class UserUserResource - { - /// - /// Get or Set Id of a useruser - /// - public int Id { get; set; } - /// - /// This gets or sets the user - /// - public User User { get; set; } - /// - /// user id - /// - public int UserId { get; set; } - /// - /// This gets or sets the followed user - /// - public User Followeduser { get; set; } - } -} diff --git a/API/Resources/UserUserResourceResult.cs b/API/Resources/UserUserResourceResult.cs index c519c0a6..36754aea 100644 --- a/API/Resources/UserUserResourceResult.cs +++ b/API/Resources/UserUserResourceResult.cs @@ -12,15 +12,7 @@ namespace API.Resources public class UserUserResourceResult { /// - /// PK of UserUser - /// - //public int Id { get; set; } - /// - /// Set or get user - /// - //public User User{ get; set; } - /// - /// set or get User + /// Set or gets id /// public int Id { get; set; } diff --git a/Services/Services/UserProjectService.cs b/Services/Services/UserProjectService.cs index 9952785d..6b5144cb 100644 --- a/Services/Services/UserProjectService.cs +++ b/Services/Services/UserProjectService.cs @@ -43,7 +43,7 @@ public override void Add(UserProject entity) Repository.Add(entity); } - public void Remove(UserProject userProject) + public override void Remove(UserProject userProject) { Repository.Remove(userProject); } From 4028297dcaaa94fcc3634a5e9e3775ce13289c86 Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 7 Oct 2020 11:19:01 +0200 Subject: [PATCH 041/157] added .sh file to run tests. Added comments at fileservice and -repo. --- API/1_API.csproj | 8 +-- API/Controllers/FileController.cs | 4 +- API/Controllers/ProjectController.cs | 41 +++++++------- .../DependencyInjectionExtensions.cs | 1 - API/Resources/FileResource.cs | 14 +---- API/Startup.cs | 2 - APIFileFolderFile | Bin 13976 -> 0 bytes CHANGELOG.md | 2 +- Models/File.cs | 8 +-- Postman/runtests_linux.sh | 3 + .../{runtests.bat => runtests_windows.bat} | 0 Repositories/FileRepository.cs | 33 ++++++++++- Services/Services/FileService.cs | 53 ++++++++++++------ 13 files changed, 102 insertions(+), 67 deletions(-) delete mode 100644 APIFileFolderFile create mode 100644 Postman/runtests_linux.sh rename Postman/{runtests.bat => runtests_windows.bat} (100%) diff --git a/API/1_API.csproj b/API/1_API.csproj index e255995d..b7958826 100644 --- a/API/1_API.csproj +++ b/API/1_API.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -41,9 +41,7 @@ - - - + - + \ No newline at end of file diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 765f63ac..ddaf812b 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -101,7 +101,7 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe Detail = "File is null.", Instance = "ACD46F17-A239-4353-92A5-0B81AA0A96E9" }; - return NotFound(problem); + return BadRequest(problem); } try { @@ -184,7 +184,7 @@ public async Task DeleteSingleFile(int fileId) ProblemDetails problem = new ProblemDetails { Title = "Not authorized.", - Detail = "You are not the uploader of this file.", + Detail = "You do not have the required permissions to delete this file.", Instance = "88967A6F-B168-44E2-A8E7-E9EBD555940E" }; return Unauthorized(problem); diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 37f000a3..ccacb29d 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -107,8 +107,7 @@ public async Task GetAllProjects([FromQuery] ProjectFilterParamsR Count = results.Count(), TotalCount = await projectService.ProjectsCount(projectFilterParams), Page = projectFilterParams.Page, - TotalPages = - await projectService.GetProjectsTotalPages(projectFilterParams) + TotalPages = await projectService.GetProjectsTotalPages(projectFilterParams) }; return Ok(resultsResource); @@ -171,10 +170,10 @@ public async Task CreateProjectAsync([FromBody] ProjectResource p if(projectResource.FileId != 0 && file == null) { ProblemDetails problem = new ProblemDetails - { - Title = "File was not found.", - Detail = "The specified file was not found while creating project.", - Instance = "8CABE64D-6B73-4C88-BBD8-B32FA9FE6EC7" + { + Title = "File was not found.", + Detail = "The specified file was not found while creating project.", + Instance = "8CABE64D-6B73-4C88-BBD8-B32FA9FE6EC7" }; return BadRequest(problem); } @@ -235,11 +234,11 @@ public async Task UpdateProject(int projectId, [FromBody] Project if(projectResource.FileId != 0 && file == null) { ProblemDetails problem = new ProblemDetails - { - Title = "File was not found.", - Detail = "The specified file was not found while updating project.", - Instance = "69166D3D-6D34-4050-BD25-71F1BEBE43D3" - }; + { + Title = "File was not found.", + Detail = "The specified file was not found while updating project.", + Instance = "69166D3D-6D34-4050-BD25-71F1BEBE43D3" + }; return BadRequest(problem); } @@ -276,11 +275,11 @@ public async Task DeleteProject(int projectId) if(project == null) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed to delete the project.", - Detail = "The project could not be found in the database.", - Instance = "AF63CF48-ECAA-4996-BAA0-BF52926D12AC" - }; + { + Title = "Failed to delete the project.", + Detail = "The project could not be found in the database.", + Instance = "AF63CF48-ECAA-4996-BAA0-BF52926D12AC" + }; return NotFound(problem); } @@ -291,11 +290,11 @@ public async Task DeleteProject(int projectId) if(!(project.UserId == user.Id || isAllowed)) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed to delete the project.", - Detail = "The user is not allowed to delete the project.", - Instance = "D0363680-5B4F-40A1-B381-0A7544C70164" - }; + { + Title = "Failed to delete the project.", + Detail = "The user is not allowed to delete the project.", + Instance = "D0363680-5B4F-40A1-B381-0A7544C70164" + }; return Unauthorized(problem); } diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 6ac61eab..3f813687 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -15,7 +15,6 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ -using AngleSharp.Io.Dom; using Data; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs index fd634bb7..9f30dd42 100644 --- a/API/Resources/FileResource.cs +++ b/API/Resources/FileResource.cs @@ -40,18 +40,6 @@ public class FileResource [AllowedExtensions(new [] { ".jpg", ".png", ".jpeg"})] [MaxFileSize(2097152)] public IFormFile File { get; set; } - /// - /// Date and time of uploading - /// - public DateTime UploadDateTime { get; set; } - - /// - /// UploaderId of file - /// - public User Uploader { get; set; } - /// - /// Id of project - /// - public int ProjectId { get; set; } + } } diff --git a/API/Startup.cs b/API/Startup.cs index ad0215c6..7dfdda34 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -297,8 +297,6 @@ await next() o.OAuthClientId(Config.Swagger.ClientId); }); - // using Microsoft.Extensions.FileProviders; - // using System.IO; app.UseStaticFiles(); app.UseFileServer(new FileServerOptions diff --git a/APIFileFolderFile b/APIFileFolderFile deleted file mode 100644 index b415191db085ca2688bb06e5d5e49857d8ebe1b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13976 zcma*OWk6Kl7d3om=#cJ^7F49AJEWvr8bm}=VnA}}p&OKL0hN;OQoxb!4(X1e>$$)G z`+j-8J$$(g!#U^Pz4uvr?S0pY&{S7^giC`90Kg+b}Rru^fLfZx@0zKiGyEY zTB$0^gIDn9O0GEoykNO2t0`cuU=kBN<9K3s08aQaQdwR`*K2ma^;0srP4?#9C#yzP zC!u~;QX*YJaxG$v#9#E9bA9_<3)jUTa(kPnha0=!`A!JGU5|NPaO#uY z@TvVGV(HWvo!F0HOyFfMju-wkP79Qd2frKF+lly|IVf8?M5?B)?wKsYI54yWYSE+c zkcqhnNd=IPx-Xw>UA?-LV+Cwt?b2B)rH=66yzo(^>L8>YYKA_G-z`jmqG4Vm#*zMF znf|0hdYRaQ_*~zd+ogfOyShJ1`0 z$VAtNwxcid;Quoj-i_tRRsvK$PfkwaGW7`TIbVxN*J>2EW4w0Y_3Gt`9?U&dkhheF zYFd3Rrbc^W9k9iKNrRR>3dtq+lEJQOYityuKk{WZA;OWyu}Cil4tma)hp@shCB8nd zq`gr(W4XA9jRWiVlpw2z=_TsDEX7Ac7zuLMB51O}d2V4e%z1z&D<65<(Ikit4f z__}${(IxWQKod!h?sv8m-hA=r(quqo%F5ChhWmZLeCEP|D|`~J1h9_H&X(aa{kC>K z+(erq3cBH{rcOq~>U-3LiIPRbC>q9TiFtupOtkvm&CPAt?U^z3L4i|oc6OEwd{E1P zF)4z1Y3zgAzD?!2!~A#uL_bK*cXj@>6)7os?-?tXBS3u?mLWYBl)dpQ6K&E$>dAKj z{C{tUNuLQpABs3B^~+6^xzcDO_dCrIeohRL*3FllXyXpEN*|D~td>laP;*~P_N06^ zZkH6={ont4lB`23qgC3Qc{J&nwcq{}pe#Tg#tF9J{IFx*sU*$~kwtn7W7b$kbsB4NxUR@UmlG!^ z^+SjzIvn;0@7!~lw?08iHV3utj`g)^Cv}b|C=m|lWmD#Az#t2{iX6*q$dj64<&r5v z4B|5L3}^UyN0cnWGb1B|Uq+)O8GAyE`rYfXXf&NFDHLWruD3d%@Zq=!iN*cxAq2wLpt(AU6z`M=d~38 z<2cdYYYB@!95FX#%C^^nb52UK~#L_+WZplYqwhEDM zJ@BqkP8#_wlqW!deXVaAjj`835nR-9UUI&I!3+UXxy@tqIan&A-g2Qkv9a=AURM>2 zJIuWP@Xwp%=G<)ZivdSAPRB0}+?~pm_i9PQ?62j=!=Ft)C3NUk*M7tIemIx=cN_y4 zjL@PXTxrkk?+_EEmM_>Lt3)OeKB+r#b&0dn`+t$j)2+Cj35}=IS6$q!T=EL^yd-|3 zWHlfE5!c?W&A4h%ToQ>X+eO$I`P{4y<__V&?b2(d`A<}A$wLy=b*^U4oop9j$u(}a zW=!wv=l?`VJy45f`=#HSF?1d2J#rl90Nn@1sN(o|U;TC_=Mkjt^oU$Ri(v2zKl_%* zm23_XFedQ4Qfe=%GVW0Jc#hpwBvGurZTYX*KXV7wv!VOM;QIOBQ{1;fgY7pJ_gp4Z zBTkQF1V8f4PKy!i>D|w^i<(ZejhdssdDP9ZI74FfM;~}&Z0y0*voJk`A|&+G%8fW>Nxh)QQ2Cw~gKK zSTkpS8SZ}U$GRbl@c~O!b4giGy|>GE+DKK7r;vsc_ethuGuhQn%0@bJb3f$|-J)eu zi;>>v4#PT4;!Wxce4^pQ~53+pO+F>cEUA}bvbO*!!L!n6SpO5Ksw2fg>h z^+e$GRnBpmKR>aQ#_UEgh*OpD50OX8wo|6&#x&mD#=#C3)qH$zuG%-_9&qt}9=5Mk{m(O?!0;7efZ|4$IfleS*S4~`Q~LWu{PI?=*H#vg zoY5DU9ceOYN`xr1$^A}-n1!b6j}CcC{EqOnbEj=t*Wy4-~B!EBMF>; zG$v57DZ4sAAJP-dU2XKN{r2Tc5P$Fb6-zd|_KDmgMSX=mepL8ijPmUc-!Uc}6EE!)%Nsihj0*FU<4N zVKt{JxO$3#S)ydIn)GE4w7Ko{bbiYG41CzDo6xWjYFGMGvq^%g3j5>aTww!=}xY0bua%s}$SC%vTu=b4iJ9Bq@7AoU`osMCdke z9;p|pG5+i2hN(Lear08Ubev^~gRL3A=JOja5d|@i#B{=X&7XE?xnt(dOb(WWUx1e0c!E&AMkd*B)Vf>8GY4Kn8>-(=xiQb=fhJX3 zwI2WC0CXy{VYO=l629pNj*V&B3g+fGV4h z2O9qJPE+dFtm$E}F@^ewX-;EBbThC9=C*;GB4;c;TSMXA6PeAPWQqzEYb#XL$Mf;%rk9K z$Va>g%q>It{E}}z{{7r+Gy{l7emp09cySes6=bINp6K`hwO*_YdlCFrc>c`-9W)i> z06ywv%oopq1&LiO$Z4e%DhWrqRh%g?l~s5<&Y0i}O{OpZBiNm%zmd393s?`IZnK&I~gEt*cA9))WX6fr*gjbQSY?;2%;4Ar{ zv*&%8r_=%&R?n`)vvHc0uJ$uP_afy3I?waI6jUxOvtTDFPTA2=W1TYR zV)m?ck&WeR502?Lsq)>t3{l`fw1s@N(Qy}^2Q^5xKn=AnE^D8=3Qd1~BCJXLBCIQb4+ z$afv~{+8O*zsC05`)%T`tQ>6(qmi?a%pR@)-RBovMm>b|)o!~& zo?@rWxXe{s%JP4|H2;nu%nhGLh4;1G)1*c%1{0@Q(Mzds#7w+hH1x~6IqB&ykqiGr z7JUBg&e|C|9I@b6tN;5i>R)f^l?(q%+Nq=#@V>A&5j!6e<6gw`!^$Y`4t$g=Oi59E z$e`Q$r9`vZL{wP{2O6f?`(Fo+7wZD&n-`HLdH{ZRUq*2wCE=L+P<`cMLv|#$kFzEH zN@h=sB5~;(yMMdij}Gv=EUre zBl7P6=A^u`4vIF&M#@V5i8wbQj(&zS&NebViIzzQm*m4f1jE;19(e>7T>0=#2(QX1q5dx zC1xOWMU)z=&WWYpPA|$)mgAP)h$X2B^8#6-jDLDac|p3vcMgt-QgzIE5H5Q8s_ z3BaY|Nxv<0JGLN(I%+j|jCYke#N`w_J}-?5aA5=prEXmwi`5SE&iI4>8mMicXm!vM zWNwZiJqr35I=#1%>nyV*tF@ONIw%|w%#UF?v%R!5u&vr$z)MfC zp#oIDe9HMS_V|YEcxHeDEvUk_V!^M%l!sqdv}=Jlw_t-=9iu~!Q(E#divjukWX+zI zZlXqj)Rqx&uFfiWmzVo>gx%#6`t&Xi&@cxPUK}${SFdaO-7YrPi%@IC+b>={{Tb;B zH4BmSxVE8+UTa1OkJ zGKQ{=El%8=?hpgg;}Zp;nxFq*>M4wi5L6xZ91ssbck)j%5rOjGSsp5g(;Ma9^Q#3U0xmJi)jC$ z64TQi=e1ZqtI8lv2-X@U15dyMuDrd`<9IF zjE{?OeblL7zzsa}-?vakT5`Yz#a-t79`Z>IS! zyEVfS=gzBiGp_#{Q6Z8*FPPOxN`-s9`j$K=2 zP@-=?U1u}QTKYkraC3s^Dh5-krO#N{GkRIj7BsqCM%f{QtmZ5K&26EsC6LQnlkti; z!!@nu_=kJ?ARD*Y3d4(0M`TgCM&r3?4X<_4EQe6?eT>sBf3xwMHztn%3J-zm+B+5g z|^JbUo9DkLA-HO6;Ucp|3KZ6M)KPG@n3V7nk)ZSI*3$+*| zL(mYau~~;+_c`VMfhp{*`FcBa(yg)f@Q}Z(*ydyj+C;6D2(gF>s z&2-h1q&@WKXZwBT-wm}^^ZGNnlN%Ge7W;f%%gw$rG#CF{=!QFb^IoMKo{BD2A*H+x z8&3b(y{P$R=ubquZ#D{7XUC*w&Pfr>9;JeRpiD#uA3j_%1GaGIg%(Cp+!oP@#<*N1 z_tZD+8pGSGa#=GC*|$PVea4mf)9g@U1I4lV@j!Re3N&0I0PK5o$Ou(Ls6)$xiW7WQ zoLbul*DI{DME>1k%y4c`%@z(S=kO30@m?PMwtQ7u{!s_>9^GZMHU_%6@rN)z1_l_g z-goGZ=XI}9_pNVTuAi2hr+#`c{cf$eKA<{=7{GTTy@+AndEtT!`Xvtz%Q)sj?~YY&*_;nRc&It7j2XsaN+4LpF@ z&C{!(So=s~Ak71kUmy*?{5!)DjHz5ZavYW8Bl+&W&ysIfGG6o$O!ORj4Yc*_fZOKa zi@)l`ZVur7O(uk!9v<2?p531;(J{BeVv?)Ip3fBul4ylLQfyuqwELGv;@<;Ee}pb` zQRKFneORB-X8fl!Hq0T?`i8C}Pm3aqr- zwt2xN{idkcB5vi{1hbK6dVLcaiUqM$Pdy$L!B<=8h0$x!gaP4LzJ4~6wQHB2G}u42 zo`WXEvKSPtbG+2rtxGYH>wa^eKXX+`15wXA#bzKa4%iQ!eQF4BB1J=@x)}92U#V}5 z81yMiwi;d&luRX>KTdE;np2W*K2-znFS9_H1LWSe(nFK|oHhUGfj6JES{VK?6c z9rlcaru>HVuu09mle$U%J4xtgq;Y`c?z_8o`-DlB@_FqVVfm_1+liTlKh>u3!=xMU zFMl=>Pf0`l90}alTqdloLT0^qL#mD^pKv6TiKf_>)&NqgsxYq0%fTj{9?34yVxm!TL%oqF7G30Xu?PVX%_ zT=Eh-{{1H^g_FUryAuYLgH1cwdg7@HO=?a!A3+*JG?){L#7t9!`=n>!Ra6*$2gryX zO@~`S1Y*{7hWcs~21bup@d7!yZ&u!wvh^tNMM$1?N>5U-R%Zm7L=VLQcknjS9qRT& z2*@#uW|i6>9yc!RcXIONu(xVE;T%t+u!?RpWJ7HlV<6bNz`4~|W>IDXy_lkl6pE3q z@=F%#_SpM!`FGvkC*kWUM3gU|qI?eU++*69(YwBKNOPD0=l`BimE;GRFlf2mozIQ* z#-x2CX{n0yQBxv zAvC_lX8+C1tNWga+%)fO5V)+eQVnEH{!2=8huGdzJId6CiY z-^Q|41)+406)S}V+k*PAVt_%Hs9*ZuibXI? z5GPzzt8VxJIwQEbUg&=jb+h7smuKb{qe}}G@=EPb>(v8z3k}*aNmLQ`^|3OI{_nwQ zgUgub_v7W5fE!4!t=3F>`U&U5cMe@~mik2o>E1-js?k`V>dRP8;dHsd0Cy~#D03LD8oI$dv$ly=d{4==t~?&nsKi= zj6{(Yb*2D&Lihz+B$|QP(sj`=Kt(PX9BIsR~iVAZUlNbhx0zn%R4 zTLoFmLa!iG>Us9d&>bJ}Vh6A)ts!(0*tXXbGrS9Ii_bVM|0*2kx&9FKMJMl8^pbjz z@EP{pPm~P!g7EivuXB({8@Pp)9;P(W^eL2G45)YvQD0_$!JG3sF{#BdHMVSaupQ9> zl5DgxgC(2JT+}zWT_vZBo^s0IObMSlG~rd0x2o2jSs>f%+qN4mHs9xp4T{vl*nTbZ zJF3;hcQ?)b?&9nr!aJd+8t4`)U7^db5<)mWNlCjN69#3=ju^7tW5al__cjv2Kplm6 ziKij6P(9`0_AYu1P04Z4vpFa3E9XpCIeJmLeTv4sX}*uNXgr<=CK~zQTgc!rAp`L)1a^)Rz*2xQ2mygJ zdID_M*zvcEW7wNn#w@pmA$Va84p@^1UrY(7hDq_35wA`C`hP(X>0}X#tW!5p9AKMV zObe3`$D5{{C<499G}8AH21aT3bS;D~;YaDyMlP8MMFzR?WQ`ZWuA&&iars0UdT%h~ zLT;$wM^`|4M#j)Gv((I}hpS$!ST1@j;+K-YhJR~2Vs(UF4c1&lKvvYY7;`#m%AdXH z;M0-{`%3vH{ne!DRe^MblmME?(Q@ur;uUmL#enzv!#`c3k)-gSsWyJQDUKBw9aldi zY*Gf5;Y6@+6^KNc_6z^|p^3ni6LgCJu&HXBq7R*eNN@K*x70{gMf(c5nG=;!cCK?j zKZPP08HchTnEL2}A~!O_DntK*A?(8lH6Nk`?0``tO&RIsRv_8bj>n@%$;xInr;Sqs z!X-OCp1VYQe=)euB3*)E!M)sosr$4Cs(Yz<$SwQ$I@*Y6_1`-!t%#Bmm(xT|Joq=K zqM2F$yx3BMYat?`H()U>Pt0*gJIt<5;7wy7U-+TJ^lho_|CVYf)64!=!kDAvC5~~Z zBz}+1yseVOBCEvNQ`)8C7fk!0O)$M#>K8Xo$_ zHu&Z!IQzE^@j-f^`CvIa~3>~oVO zEv13Rq^@ePa%@ZHiDA~%dzSr%bKy1Eo^8@^=V~pQPT3Om4=P8yxf(*fPSNXUp ztf#mT?cE(SI$0J=6#+I{UBx7m-W3pmOm*+qqK(h1N~pAO9Mt+^K3r7W-|VWf{XtCB z+=ymcRE#VIHNzh`(@y0v?efh3MCa4e=t5~1y(I|%mc;^1pMD)2nAX|$9YrVm@@W3D zy0UDa>`!uUZF{y=6c%Q3!{uu3$21WJLpp*TI*itFypl50N7EwNk0C*H5SK;lvv=UJSYnSOO2W4#dx6NdSzQ>Sf*`M_9 z6B2Aj8rO<)(`ZDi8Jw5`#(&D!BlBaNWvPXEwu+#zLaTUQfKd@phxBHeW&SAd9PJtz zm!TK`JT1pxIM?rg!aFnMiQYPYl+Yjl$^M54ZJCP0MrN)7E_`%&OOT|F6$TjXomj;7 z>FFg*b!%C3H*P&O-?{VP{KSi58kR};bYozcc!RU!xe$XbV~)FWfZj1C%P8T+1%z1| zHcXcpM#|RJP43z?yc!>m_d@Y*!@ei6t5%Oym>YgoPh6-}FHbPcoOZtwYh84qMsvY7 zMsLXqF04(N*Rrr$^p#if56vG;aZEU^pyYG@j*0xJZX~ls_*xEZS2d~E4@irOiAg+1 zcl9SooZL_cf+TUrJ^thWOR@i1<(I|O8|WHXbljY6YC9tSsGx4XVl=6zc>uEvK7ViM zKM12UF4Ifjc2bwft)(Rn$`4BQ78*O5v!-s#H^ifY>1IlBcSIhi{ zVy~z!6H0HYwnt|M5cK<_n6A3Ri)M-LuJhCy#p2H*4F5VtT*0VM;~UXjZZjUQvA`w$ zp|d~gmFumu#FeLZI8KIm8|l6XO(_YHW{6-xg~PaVDdC%-k2C;v*uzKp;yQDSFK@`B z0+yrp!6!GgW!}u8vQhp+cv*7$s64!`gRbEA3;CZ*(s}j3GaE?B#Qg@niGiV&2ce~sb&1GqqSyU zRp{rET_&^;ExL-iG|3A6fOVe{@(Q?(#;DxAdvWqhe>0Nfq{6UzPKqhuDA$B#0YlDL zMr$uDcQAnj4RFO^tO=C?nUNT&s-V_dj?kLx+sQvtB;&th6{uZ*xQj7oyUf+Qq*;aQknd6s zqQW^XZ)7gd9q zsZNSHym;;lW4sD_wR2et&3|8BSD|6Ia7kM&79ezgtQF0IyX(r3p8oBkpJEezQJd6t z;nVEcryuMWp5!W*f{m6KJ}fK(tFL^bvVU0M=4bbek+-J_e>3bEckK%1kt7)}dmUF| zziCTH2X3|kTwmh;cK)2%)9N^$vMeqiJni^$S%alj(W<_|$Ng6d92#@G(*0KIUa5)R z=7^}K%F|0ITMW_%xdFRR8_TB~13z6>disjB4Ih{N$oc;k%Rr^;wap(+I~;0xUms#w7vwz)i{NCE>!ZIRWid^L3_Q}N+!HG|iBr{rWYzxF= zd>}iz2<7R4?p0V+r0_vaKnlI%QyQZwyRqK>mzA|uTfgTg!?nz=_gAqD^r6iW19ngE zJ^QQY>(G*}Zwc?Qr5X3TCM>%nmM-9gNVM-9C)^y>w3C)ut|kF>7B$Asa;^UFKL$4( zVhs19cT|f#2Vk_3TmfYq>)@9xH-Wt`|8rkrpr zXzut#()&--;YBm@kEDXwPAA{=y)B&kPws+Gr+c)kP&Vmkk>HLM&S0K!0~cTJYd!qM zB5l?A&%pWCtCsMajf`Y?%76?P-VB{Smu-&7X7z&9kjFy+#qNA#-xVd#Rl!o?LKDUh zyF?SYGE<(y(||ia8Eylxl=9b7T7q0M0g7-pILqPUl_8v&j_b?Wu5jc2&3U+hZGgp( z=sU=hq{gGb!C3~YYNPKa6yD`k-|?K2ZD!`uqVD}?9$ulVY;p$#Hd)fkPV9ALMcpHo zZksiwbz~anU(%GQTnuqVvk5#BAh+p|mgkF@SXmS~JVEcse+>gf_DtagZpjXgrX!1! ze-(}W4E5zdSH?bO^Fh5I9&32UWevE>V%rsUc*h^0ZSCy1lH(_TD`RDd>d)4f4>@dz zfmCv;I++Xj62Y%dH-n>WznD}9wG@i)ArKvvob{kQ$m%e=Xw^WjM$;1~5)mI$@?E|` zY-QG(>g0y(a)NS3kF%q{ShW4g_=PvBy@txhxJlrj< zPNR*zH#z4^X^$OsU{OIkYub%?VTgduQROa^{-~aX_(sv=EjQ8H_6}R_-7hQ^c+d3; zv|aNZqha}`yUK@%B{z9noo*B?dDK%X$p29Uxs_?E4LvlBQW*H!8@>K_%ed6am#z8nSC>dIU92{G5*8ZbA`(~hZu|dmW zI;v8fCUHZSa;LSq+BG5oHV#zJ%X#U%m(r=p`s|+p< zJMNe*)yaQ`3XrMh(n2(QDNz@2)7P%NECjz z;o(%1?}AK`P@>Wv$*;9{?} zq-UlS!R3BJ0!K2U&o&(QY)ZxQZP6I%OJdwBVUNtt&(ppCY@Z7qmb16FH^DyUJYvZ` zN>?>ts`4a^L8fYxd+bYSumWlMu`QjjqXhw#)Cjo_jZmV8VQ^&R>8>WWG@+xT<5N(l zNqA{Wr%&V>YNK^F1EWc6eccsKF=ok50?-zH1gfs^KgY&u0&8^4i5`o`9F#*-`5Zp+q#5C6(rv31Hcf7rdrs(IP2=2{yV2c-&-jLd7 zN0prW7ewqY`=DLsSyE*Ln;lGG*8%`2%>~u4x_hL-IR7)+*l=Cu_%-2mazQ01q9b}w z`ec@%4Wd1G0;z*Yq3hFx5nqd+599ssq0?=Q;?N$lWs@SknW~(*V~}RWJ3sgR@@JjR zNr1Crt-4_6wMW&j>41Cm%cU^O60Td{J4cPlJDTO6o!Tiis1e9We zPF9ri=iFLX$;-r$9xp`Hiof2wFLi1@7G^`crMrxzjSa(5uPowWY<`}z z9j`PlIR!us&(6}2%5q}*;v3c__dGUNsaMV$#{lI`A(z&11u?BUslkV2 zM`<1AG+`e_x6c0La$@9SjS1Mp17hgk?0r&6>)YfO#*GVY=3ZFm(1Q@w*7j^l2KgV} zffU0o3G<%#k`&ZLVYQllNv;J~otzY$uKvz|7L`Es=DWKG2wF5d1{Ja|m=rBbao|d< z!wl)l4lsV^?WT?zQcerDqi|5xLWlCc%hmXwa~C7`8F=1)Hx>JI5>&vG@yNTeRhthw zJZ5SOmM*Oqc?=7_*y6TEleAzTx@dp?qf8D7Ak6T_SL!@MCMnv7NXiBN+aOK5bw5c{ z3|EdDkj-6i%~&wqyw0oszK3~Fb=hc1wPN5Hx9tXQT4Upk4@Q&FJ*uDtJ_lX@w&343 zs>%mWgx-y5Y=5D-CZ4VP%e4IZsS%_d4}`b1;K&vn$zfZJ-0*|p)qq&gK39FN%7z`HE9r1EPU(9NNQKW>tXdUyfL z4%~eFgl$1#A;Z4Z{ElX)(M^V%5<3k*yiJ_`F0#e{j)^2&5f;3^%wNTFnP08BAP+sF z{ah?UcT;7-L?RnitHZwCo*(0X*iPC|z(WSjEn8Udc&vart!WKj}%?xS4U0}!jS@n%1Cc(1cBx=ac*XC*exoKMkHwQ#BoPecn8K=g$P~IMm4$U9) zHpY_5*3aAmhZqNr1}c^e6;ZW?ib?HfWu_=!O1C>&KH9OM>^qiF^&sE9novhIIBo*s!E5a{aNNdqUHDy zO~vS%DCgKFqu)OO;YdHxQ*-=oY(;4W98w&(;^*R0D^KzJr!EDXm?xh=o%`#5CpMsN z`uwdDH-@wwo%HQU?{NB){+;qM$SwVmZJ4E(8yYh+&+eF?YW(tWm*I7?+^SI5K>ebqEk~Axj$gAeY0qaJv14Fwy zy#xVr|Grgd{`82lSG1IY=5oCM$L{VqMa{8W=Lfm%tNvaD?n)aiU;gi)7fFllV!L5v zl8BHSv*U?00WM>eUsL8H{xQZ7P3M+=FdZ(pMipeROncDWXIN4d>AWcoi9qjA1a-~i zOg;DxOjNs#fxg-4Ka3p|S5}<8Tjxsw4m2#{oCjer6Z6sgK44senz)eXwoQM*0~7zh z_%*wyT;45f>R;6BuqMyN{0IBznnNa6Xp0#DBAv$ScX!X@&riNJs}mSPZ~J)gH;vP< zhY;wD(yzz9L+{y+oPi-X%L#tlt@aNX9?tC^Mv5yb=-^8QN{^}1#42|@FUn?Yq-ZzK z+i8RgXdNa{qZ!!20By%$ZFwvOyX1*MHq(b*;YrpWV*iKinIN+FYSM^Hb?&XWEytZ) z-BvfcZN4ICgM&9L4+bmlC1Hnn$7%R}WS05J5ZPz3Xy1;mb;v9kGrv(oJ&x-v3 zs<4r#NTm=lW(YPlNEW)Pzc*KQn|@tB_F?6W+WBGp-sB!PJkA%{sT+A26w24Un~8Q$ zaj5~OOxuig5|F#ZSG%sOu%#g-g6Q9f|JglOcoKZQPWjfkMOoi7i}Q%NE_mqS13Pgn zXoxlUaEb?tx;W`KYcb)59dpwJZI2Ryx#z)yEzJLYC3(aRJT3o3c!__Rm(Q`0DdNVA zWsU + /// IFileRepository + /// + /// /// public interface IFileRepository : IRepository { - + /// + /// Gets the files asynchronous. + /// + /// The task that will get the files objects. Task> GetFilesAsync(); + /// + /// Gets the file asynchronous. + /// + /// The file identifier. + /// The task that will get the File object. Task> GetFileByFileIdAsync(int fileId); } + /// + /// FileRepository + /// + /// + /// public class FileRepository : Repository, IFileRepository { + /// + /// Initializes a new instance of the class. + /// + /// The database context. public FileRepository(DbContext dbContext) : base(dbContext) { } + /// + /// Gets the files asynchronous. + /// + /// The task that will get the files objects. public async Task> GetFileByFileIdAsync(int fileId) { return await GetDbSet() @@ -47,6 +71,11 @@ public async Task> GetFileByFileIdAsync(int fileId) .ToListAsync(); } + /// + /// Gets the file asynchronous. + /// + /// The file identifier. + /// The task that will get the File object. public async Task> GetFilesAsync() { return await GetDbSet() diff --git a/Services/Services/FileService.cs b/Services/Services/FileService.cs index e742dcbb..a4e9a0a0 100644 --- a/Services/Services/FileService.cs +++ b/Services/Services/FileService.cs @@ -24,51 +24,72 @@ namespace Services.Services { - + /// + /// The file service interface. + /// public interface IFileService : IService { - + /// + /// Fetches the file object that mathces with the fileId asynchronous. + /// + /// the file identifier. + /// File object. Task> GetFileByFileIdAsync(int fileId); + /// + /// Fetches all file objects asynchronous. + /// + /// A List of file objects. Task> GetFilesAsync(); - + /// + /// Uploads file information to the database (this is not the actual file). + /// + /// The file object. void UploadSingleFile(File entity); } public class FileService : Service, IFileService { + + /// + /// Initializes a new instance of the class. + /// + /// The repository. public FileService(IFileRepository repository) : base(repository) { } + /// + /// + /// protected new IFileRepository Repository => (IFileRepository) base.Repository; + /// + /// Fetches the file object that mathces with the fileId asynchronous. + /// + /// the file identifier. + /// File object. public async Task> GetFileByFileIdAsync(int fileId) { return await Repository.GetFileByFileIdAsync(fileId).ConfigureAwait(false); } + /// + /// Fetches all file objects asynchronous. + /// + /// A List of file objects. public async Task> GetFilesAsync() { return await Repository.GetFilesAsync(); } - public override void Add(File entity) - { - base.Add(entity); - } - - public override void Update(File entity) - { - base.Update(entity); - } - + /// + /// Uploads file information to the database (this is not the actual file). + /// + /// The file object. public void UploadSingleFile(File entity) { Repository.Add(entity); Repository.Save(); } - - - } } From fb0f49780d4f958b79c4ae28e35b71f923c5f66d Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 7 Oct 2020 11:21:41 +0200 Subject: [PATCH 042/157] stage postman environment --- Postman/local.postman_environment.json | 67 ++++++++++---------------- 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 1519078f..1cef8dfa 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "4110dfac-6304-4aab-bd29-2ef362921acc", + "id": "b231668b-0723-406d-bba1-f394034ad801", "name": "Local", "values": [ { @@ -34,12 +34,12 @@ }, { "key": "projectId", - "value": 37, + "value": "24", "enabled": true }, { "key": "userName", - "value": "postmantest_username_updated", + "value": "Developer", "enabled": true }, { @@ -49,7 +49,7 @@ }, { "key": "projectName", - "value": "postmantest_projectname_updated", + "value": "postmantest_projectname", "enabled": true }, { @@ -59,7 +59,7 @@ }, { "key": "accessToken", - "value": "eyJhbGciOiJSUzI1NiIsImtpZCI6Inp1TmZhU2x0UHFsN1RRQlEwa21FQkEiLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MDEzNjY5NjQsImV4cCI6MTYwMTM3MDU2NCwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwNSIsImF1ZCI6ImRleC1hcGkiLCJjbGllbnRfaWQiOiJkZXgtYXBpLWNsaWVudCIsImNsaWVudF9yb2xlIjoiQmFja2VuZEFwcGxpY2F0aW9uIiwic2NvcGUiOlsiRW1iZWRSZWFkIiwiRW1iZWRXcml0ZSIsIkhpZ2hsaWdodFJlYWQiLCJIaWdobGlnaHRXcml0ZSIsIlByb2plY3RSZWFkIiwiUHJvamVjdFdyaXRlIiwiVXNlclJlYWQiLCJVc2VyV3JpdGUiXX0.CQw0TalYOB2hUX6b8jC8AQMI4whkomjYJFBJd0FmUti40KAWApRshHlk-lBTv0FvbTCgs0JyA8qqPUqge4PEdvKtC2Fv93FlLptGrVED4Hy7I_yNEQFQvFSwybrc0x2-X_J8x1Wh-y01JzioUh_n7Aw3DCUZPcJyLvRmXhUwjm-f3EnFvN86W2IEdH6MlZL5wsiIo2hc35TInRdjGg4-4npXIBBlyJ7_VIQ7rngoqkxW7Y2xAQ8yEo_AzkAtFQAopc8yrgrJcoyl42IQa5K7GV49bLgyBqb_rNQDI1bWXdncS7BeNWbUCtitmmj6q37CR4KAZB8fXYe8O6uDe_2Kig", + "value": "", "enabled": true }, { @@ -79,32 +79,32 @@ }, { "key": "roleId", - "value": 34, + "value": "1", "enabled": true }, { "key": "highlightId", - "value": 66, + "value": "1", "enabled": true }, { "key": "embedGuid", - "value": "78627411-a7e2-4fe1-84a1-633971ec66c3", + "value": "", "enabled": true }, { "key": "embeddedProjectId", - "value": 92, + "value": "", "enabled": true }, { "key": "highlightStartDate", - "value": "2020-09-18T08:15:16.681", + "value": "", "enabled": true }, { "key": "highlightEndDate", - "value": "2020-09-20T08:15:16.682", + "value": "", "enabled": true }, { @@ -119,7 +119,7 @@ }, { "key": "current_timestamp", - "value": "2020-09-18T08:15:16.890Z", + "value": "", "enabled": true }, { @@ -134,7 +134,7 @@ }, { "key": "future_timestamp", - "value": "2020-09-20T08:15:16.682Z", + "value": "", "enabled": true }, { @@ -149,22 +149,22 @@ }, { "key": "adminProjectId", - "value": 91, + "value": "", "enabled": true }, { "key": "adminEmbedGuid", - "value": "ea7067dc-3f01-43a6-b8f3-311968fc7303", + "value": "", "enabled": true }, { "key": "adminHighlightId", - "value": 67, + "value": "", "enabled": true }, { "key": "PrUserId", - "value": 17, + "value": "", "enabled": true }, { @@ -174,56 +174,41 @@ }, { "key": "otherEmbedGuid", - "value": "7eb1fdea-6dbd-447f-b3c7-6c46f515e6df", + "value": "", "enabled": true }, { "key": "otherEmbeddedProjectId", - "value": 91, + "value": "", "enabled": true }, { "key": "createdUserId", - "value": 84, + "value": "", "enabled": true }, { "key": "administratorUserId", - "value": 1, + "value": "", "enabled": true }, { "key": "registeredUserId", - "value": 33, + "value": "", "enabled": true }, { "key": "createdUserIdentityId", - "value": "999", + "value": "", "enabled": true }, { "key": "identityId", - "value": 84, - "enabled": true - }, - { - "key": "fileId", - "value": "1", - "enabled": true - }, - { - "key": "prFileId", - "value": null, - "enabled": true - }, - { - "key": "adminFileId", - "value": 92, + "value": "", "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-09-29T08:18:13.470Z", - "_postman_exported_using": "Postman/7.33.1" + "_postman_exported_at": "2020-06-10T15:45:45.966Z", + "_postman_exported_using": "Postman/7.26.0" } \ No newline at end of file From 1105ff592cf743173e43d273af6e1e983654b862 Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 7 Oct 2020 11:22:25 +0200 Subject: [PATCH 043/157] added variables for file testing in postman --- Postman/local.postman_environment.json | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 1cef8dfa..a87a51a8 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "b231668b-0723-406d-bba1-f394034ad801", + "id": "dacd2554-cdd7-459f-bc3b-787c454809ec", "name": "Local", "values": [ { @@ -206,9 +206,24 @@ "key": "identityId", "value": "", "enabled": true + }, + { + "key": "fileId", + "value": "", + "enabled": true + }, + { + "key": "prFileId", + "value": "", + "enabled": true + }, + { + "key": "adminFileId", + "value": "", + "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-06-10T15:45:45.966Z", - "_postman_exported_using": "Postman/7.26.0" + "_postman_exported_at": "2020-10-07T09:21:05.563Z", + "_postman_exported_using": "Postman/7.33.1" } \ No newline at end of file From ae58fc4105222649407fe544518af5f240747c42 Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 7 Oct 2020 11:51:13 +0200 Subject: [PATCH 044/157] removed fileserver rule as it was not necessary. --- API/Extensions/FileUploader.cs | 7 +++---- API/Extensions/MaxFileSizeAttribute.cs | 2 +- API/Startup.cs | 8 -------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index ad097c5f..47bace0e 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -28,7 +28,7 @@ public class FileExistException : Exception /// /// public FileExistException(string name) - : base(String.Format("File {0} already exists", name)) + : base($"File {name} already exists") { } } @@ -78,7 +78,6 @@ public class FileUploader : IFileUploader public FileUploader(IWebHostEnvironment env) { uploadPath = Path.Combine(env.WebRootPath, "Resources\\"); - serverRoot = Path.Combine("https://localhost:5001/Resources/"); } /// @@ -120,7 +119,7 @@ public async Task UploadSingleFile(IFormFile file, string fileName) } } - return serverRoot + fileName; + return fileName; } throw new FileExistException(fileName); @@ -135,7 +134,7 @@ public async Task UploadSingleFile(IFormFile file, string fileName) /// Method deletes the file from the file server /// /// - /// Bool which tells if file is deleted succesfully or not + /// Bool which tells if file is deleted successfully or not public void DeleteFile(File file) { if(System.IO.File.Exists(Path.Combine(uploadPath, file.Name))) diff --git a/API/Extensions/MaxFileSizeAttribute.cs b/API/Extensions/MaxFileSizeAttribute.cs index ddb28380..0fe6531f 100644 --- a/API/Extensions/MaxFileSizeAttribute.cs +++ b/API/Extensions/MaxFileSizeAttribute.cs @@ -52,7 +52,7 @@ protected override ValidationResult IsValid( /// public string GetErrorMessage() { - return $"Maximum allowed file size is { maxFileSize} bytes."; + return $"Maximum allowed file size is {maxFileSize} bytes."; } /// diff --git a/API/Startup.cs b/API/Startup.cs index 7dfdda34..551e1bae 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -298,14 +298,6 @@ await next() }); app.UseStaticFiles(); - - app.UseFileServer(new FileServerOptions - { - FileProvider = new PhysicalFileProvider( - Path.Combine(env.WebRootPath, "Resources")), - RequestPath = "/Resources", - EnableDirectoryBrowsing = true - }); } /// From b0256c77ea3eb9659a2365e7a7f136967c51ba8d Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 7 Oct 2020 15:01:02 +0200 Subject: [PATCH 045/157] Added new RoleScope for FileWriting --- API/Controllers/FileController.cs | 5 +++-- API/Startup.cs | 3 +++ Data/Helpers/Seed.cs | 1 + IdentityServer/Configuration/IdentityConfig.cs | 4 +++- Models/Defaults/Defaults.cs | 4 ++++ Services.Tests/RoleServiceTest.cs | 6 ++++-- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index ddaf812b..f7720d0c 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -177,9 +177,10 @@ public async Task DeleteSingleFile(int fileId) return NotFound(problem); } - if(!file.Uploader.Id.Equals(user.Id)) + if(!file.Uploader.Id.Equals(user.Id) ) { - if(!userService.UserHasScope(user.IdentityId, Defaults.Roles.Administrator)) + bool userHasScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.FileWrite)); + if(userHasScope) { ProblemDetails problem = new ProblemDetails { diff --git a/API/Startup.cs b/API/Startup.cs index 551e1bae..a6c60482 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -129,6 +129,9 @@ public void ConfigureServices(IServiceCollection services) policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.EmbedRead)))); o.AddPolicy(nameof(Defaults.Scopes.EmbedWrite), policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.EmbedWrite)))); + + o.AddPolicy(nameof(Defaults.Scopes.FileWrite), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.FileWrite)))); }); services.AddCors(); diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 8b035eb1..4685cb82 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -90,6 +90,7 @@ public static List SeedRoles() new RoleScope(nameof(Defaults.Scopes.HighlightWrite)), new RoleScope(nameof(Defaults.Scopes.EmbedRead)), new RoleScope(nameof(Defaults.Scopes.EmbedWrite)), + new RoleScope(nameof(Defaults.Scopes.FileWrite)) } }; roles.Add(administratorRole); diff --git a/IdentityServer/Configuration/IdentityConfig.cs b/IdentityServer/Configuration/IdentityConfig.cs index 94d55eb9..0365a291 100644 --- a/IdentityServer/Configuration/IdentityConfig.cs +++ b/IdentityServer/Configuration/IdentityConfig.cs @@ -55,6 +55,7 @@ public static IEnumerable GetIdentityResources() new Scope(nameof(Defaults.Scopes.HighlightRead)), new Scope(nameof(Defaults.Scopes.EmbedWrite)), new Scope(nameof(Defaults.Scopes.EmbedRead)), + new Scope(nameof(Defaults.Scopes.FileWrite)) } } }; @@ -81,7 +82,8 @@ public static IEnumerable Clients(Config config) nameof(Defaults.Scopes.HighlightRead), nameof(Defaults.Scopes.HighlightWrite), nameof(Defaults.Scopes.EmbedWrite), - nameof(Defaults.Scopes.EmbedRead) + nameof(Defaults.Scopes.EmbedRead), + nameof(Defaults.Scopes.FileWrite) }, Claims = new List { diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index 54f3a1cd..3c093c39 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -92,6 +92,10 @@ public static class Scopes [Description("This scope gives write access to the embed namespace")] public const string EmbedRead = "embed:read"; + + [Description("This scope gives write access to the file namespace")] + public const string FileWrite = "file:write"; + } } diff --git a/Services.Tests/RoleServiceTest.cs b/Services.Tests/RoleServiceTest.cs index 367b51c9..20886aec 100644 --- a/Services.Tests/RoleServiceTest.cs +++ b/Services.Tests/RoleServiceTest.cs @@ -61,7 +61,8 @@ public void GetValidScopes() "RoleRead", "RoleWrite", "EmbedWrite", - "EmbedRead" + "EmbedRead", + "FileWrite" }; List retrievedScopes = Service.GetValidScopes(); Assert.AreEqual(currentScopes,retrievedScopes); @@ -84,7 +85,8 @@ public void isValidScope_true() "RoleRead", "RoleWrite", "EmbedWrite", - "EmbedRead" + "EmbedRead", + "FileWrite" }; bool isValidScope = Service.IsValidScope("RoleRead"); From 331593dfa6f0e2d13b45ea89ebacc7e80c4bd2c4 Mon Sep 17 00:00:00 2001 From: Niray Date: Thu, 8 Oct 2020 10:36:10 +0200 Subject: [PATCH 046/157] added tests files. Removed redundant methods in fileservice and -repo. --- API/Controllers/FileController.cs | 58 +++++++++---------- API/Extensions/FileUploader.cs | 1 - .../DataGenerators/FileDataGenerator.cs | 30 ++++++++++ .../DataSources/FileDataSourceAttribute.cs | 53 +++++++++++++++++ Repositories.Tests/FileRepositoryTest.cs | 24 ++++++++ Repositories/FileRepository.cs | 35 +---------- Services.Tests/FileServiceTest.cs | 33 +++++++++++ Services/Services/FileService.cs | 43 -------------- 8 files changed, 168 insertions(+), 109 deletions(-) create mode 100644 Repositories.Tests/DataGenerators/FileDataGenerator.cs create mode 100644 Repositories.Tests/DataSources/FileDataSourceAttribute.cs create mode 100644 Repositories.Tests/FileRepositoryTest.cs create mode 100644 Services.Tests/FileServiceTest.cs diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index f7720d0c..d5e53ee7 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -42,7 +42,6 @@ public class FileController : ControllerBase private readonly IFileService fileService; private readonly IMapper mapper; - private readonly IProjectService projectService; private readonly IUserService userService; private readonly IFileUploader fileUploader; /// @@ -50,14 +49,12 @@ public class FileController : ControllerBase /// /// The file service. /// The mapper. - /// The Project service /// The User service /// /// The file uploader extension - public FileController(IFileService fileService, IMapper mapper, IProjectService projectService, IFileUploader fileUploader, IUserService userService) + public FileController(IFileService fileService, IMapper mapper, IFileUploader fileUploader, IUserService userService) { this.fileService = fileService; this.mapper = mapper; - this.projectService = projectService; this.userService = userService; this.fileUploader = fileUploader; } @@ -70,7 +67,7 @@ public FileController(IFileService fileService, IMapper mapper, IProjectService [Authorize] public async Task GetFilesAsync() { - IEnumerable files = await fileService.GetFilesAsync(); + IEnumerable files = await fileService.GetAll(); if(!files.Any()) { ProblemDetails problem = new ProblemDetails @@ -114,16 +111,17 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe .ConfigureAwait(false); File file = new File(path, newFileName, user, uploadDateTime); - fileService.UploadSingleFile(file); + fileService.Add(file); + fileService.Save(); return Ok(mapper.Map(file)); } catch(FileExistException fileExistException) { ProblemDetails problem = new ProblemDetails - { - Title = fileExistException.Message, - Detail = "Please rename filename.", - Instance = "D902F8C6-23FF-4506-B272-C757BD709464" + { + Title = fileExistException.Message, + Detail = "Please rename filename.", + Instance = "D902F8C6-23FF-4506-B272-C757BD709464" }; return BadRequest(problem); } @@ -169,27 +167,25 @@ public async Task DeleteSingleFile(int fileId) if(file == null) { ProblemDetails problem = new ProblemDetails - { - Title = "File was not found.", - Detail = "File was not found.", - Instance = "9D3830A2-E7D1-4610-A147-1D43BFB8DDBC" + { + Title = "File was not found.", + Detail = "File was not found.", + Instance = "9D3830A2-E7D1-4610-A147-1D43BFB8DDBC" }; return NotFound(problem); } - if(!file.Uploader.Id.Equals(user.Id) ) + bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.FileWrite)); + if(!(file.Uploader.Id.Equals(user.Id) || isAllowed)) { - bool userHasScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.FileWrite)); - if(userHasScope) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Not authorized.", - Detail = "You do not have the required permissions to delete this file.", - Instance = "88967A6F-B168-44E2-A8E7-E9EBD555940E" - }; - return Unauthorized(problem); - } + ProblemDetails problem = new ProblemDetails + { + Title = "Not authorized.", + Detail = "You do not have the required permissions to delete this file.", + Instance = "88967A6F-B168-44E2-A8E7-E9EBD555940E" + }; + return Unauthorized(problem); + } try @@ -202,11 +198,11 @@ await fileService.RemoveAsync(fileId) } catch(FileNotFoundException) { ProblemDetails problem = new ProblemDetails - { - Title = "File could not be deleted because the path does not exist.", - Detail = "File could not be found.", - Instance = "436349B4-50D9-49FD-8618-82367BEB7941" - }; + { + Title = "File could not be deleted because the path does not exist.", + Detail = "File could not be found.", + Instance = "436349B4-50D9-49FD-8618-82367BEB7941" + }; return NotFound(problem); } diff --git a/API/Extensions/FileUploader.cs b/API/Extensions/FileUploader.cs index 47bace0e..3da3c15f 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/Extensions/FileUploader.cs @@ -69,7 +69,6 @@ public class FileUploader : IFileUploader { private readonly string uploadPath; - private readonly string serverRoot; /// /// File Uploader diff --git a/Repositories.Tests/DataGenerators/FileDataGenerator.cs b/Repositories.Tests/DataGenerators/FileDataGenerator.cs new file mode 100644 index 00000000..794c376b --- /dev/null +++ b/Repositories.Tests/DataGenerators/FileDataGenerator.cs @@ -0,0 +1,30 @@ +using Bogus; +using Models; +using Repositories.Tests.DataGenerators.Base; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Repositories.Tests.DataGenerators +{ + public class FileDataGenerator : FakeDataGenerator + { + /// + /// Initializes the projectDataGenerator + /// and define dataGenerator options + /// + public FileDataGenerator() + { + Faker fakeUser = new Faker() + .RuleFor(user => user.Name, faker => faker.Name.FirstName()) + .RuleFor(user => user.Email, faker => faker.Internet.Email()) + .RuleFor(user => user.IdentityId, faker => faker.Random.Int().ToString()); + + Faker = new Faker() + .RuleFor(p => p.Name, faker => faker.Name.FindName()) + .RuleFor(p => p.Path, faker => faker.System.FilePath()) + .RuleFor(p => p.UploadDateTime, faker => faker.Date.Past()) + .RuleFor(p => p.Uploader, fakeUser); + } + } +} diff --git a/Repositories.Tests/DataSources/FileDataSourceAttribute.cs b/Repositories.Tests/DataSources/FileDataSourceAttribute.cs new file mode 100644 index 00000000..ea71877e --- /dev/null +++ b/Repositories.Tests/DataSources/FileDataSourceAttribute.cs @@ -0,0 +1,53 @@ +using Models; +using NUnit.Framework.Interfaces; +using Repositories.Tests.DataGenerators; +using Repositories.Tests.DataGenerators.Base; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Repositories.Tests.DataSources +{ + /// + /// Attribute to generate projects + /// + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] + public class FileDataSourceAttribute : Attribute, IParameterDataSource + + { + private readonly IFakeDataGenerator fakeDataGenerator; + private readonly int amountToGenerate = 0; + + public FileDataSourceAttribute() + { + fakeDataGenerator = new FileDataGenerator(); + } + + /// + /// Initializes fileDataSourceAttribute + /// and setting the amount of files to be generated + /// + public FileDataSourceAttribute(int amount) : this() + { + amountToGenerate = amount; + } + + /// + /// Generate the data and return it + /// + /// Extra parameters given in the attribute, not in use but required due to inheritance + /// The generated data + public IEnumerable GetData(IParameterInfo parameter) + { + if(amountToGenerate <= 1) + { + return new[] { fakeDataGenerator.Generate() }; + } + List files = fakeDataGenerator.GenerateRange(amountToGenerate).ToList(); + return new[] { files }; + } + } + +} diff --git a/Repositories.Tests/FileRepositoryTest.cs b/Repositories.Tests/FileRepositoryTest.cs new file mode 100644 index 00000000..3709048d --- /dev/null +++ b/Repositories.Tests/FileRepositoryTest.cs @@ -0,0 +1,24 @@ +using Models; +using NUnit.Framework; +using Repositories.Tests.Base; +using Repositories.Tests.DataSources; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Repositories.Tests +{ + public class FileRepositoryTest : RepositoryTest + { + /// + /// Gets the repository. + /// + /// + /// The repository. + /// + protected new IFileRepository Repository => (IFileRepository) base.Repository; + + + } +} diff --git a/Repositories/FileRepository.cs b/Repositories/FileRepository.cs index e1a75f37..8233f266 100644 --- a/Repositories/FileRepository.cs +++ b/Repositories/FileRepository.cs @@ -31,18 +31,7 @@ namespace Repositories /// /// public interface IFileRepository : IRepository { - /// - /// Gets the files asynchronous. - /// - /// The task that will get the files objects. - Task> GetFilesAsync(); - /// - /// Gets the file asynchronous. - /// - /// The file identifier. - /// The task that will get the File object. - Task> GetFileByFileIdAsync(int fileId); - + } @@ -60,27 +49,5 @@ public class FileRepository : Repository, IFileRepository /// The database context. public FileRepository(DbContext dbContext) : base(dbContext) { } - /// - /// Gets the files asynchronous. - /// - /// The task that will get the files objects. - public async Task> GetFileByFileIdAsync(int fileId) - { - return await GetDbSet() - .Where(s => s.Id == fileId) - .ToListAsync(); - } - - /// - /// Gets the file asynchronous. - /// - /// The file identifier. - /// The task that will get the File object. - public async Task> GetFilesAsync() - { - return await GetDbSet() - .ToListAsync(); - - } } } diff --git a/Services.Tests/FileServiceTest.cs b/Services.Tests/FileServiceTest.cs new file mode 100644 index 00000000..1289bffa --- /dev/null +++ b/Services.Tests/FileServiceTest.cs @@ -0,0 +1,33 @@ +using AngleSharp.Io.Dom; +using Models; +using NUnit.Framework; +using Repositories; +using Repositories.Tests.DataSources; +using Services.Services; +using Services.Tests.Base; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Services.Tests +{ + /// + /// FileServiceTest + /// + /// + [TestFixture] + public class FileServiceTest : ServiceTest + { + + /// + /// Gets the service. + /// + /// + /// The service. + /// + protected new IFileService Service => (IFileService) base.Service; + + + } +} diff --git a/Services/Services/FileService.cs b/Services/Services/FileService.cs index a4e9a0a0..9b5003cb 100644 --- a/Services/Services/FileService.cs +++ b/Services/Services/FileService.cs @@ -29,22 +29,6 @@ namespace Services.Services /// public interface IFileService : IService { - /// - /// Fetches the file object that mathces with the fileId asynchronous. - /// - /// the file identifier. - /// File object. - Task> GetFileByFileIdAsync(int fileId); - /// - /// Fetches all file objects asynchronous. - /// - /// A List of file objects. - Task> GetFilesAsync(); - /// - /// Uploads file information to the database (this is not the actual file). - /// - /// The file object. - void UploadSingleFile(File entity); } @@ -62,34 +46,7 @@ public FileService(IFileRepository repository) : base(repository) { } /// protected new IFileRepository Repository => (IFileRepository) base.Repository; - /// - /// Fetches the file object that mathces with the fileId asynchronous. - /// - /// the file identifier. - /// File object. - public async Task> GetFileByFileIdAsync(int fileId) - { - return await Repository.GetFileByFileIdAsync(fileId).ConfigureAwait(false); - } - - /// - /// Fetches all file objects asynchronous. - /// - /// A List of file objects. - public async Task> GetFilesAsync() - { - return await Repository.GetFilesAsync(); - } - /// - /// Uploads file information to the database (this is not the actual file). - /// - /// The file object. - public void UploadSingleFile(File entity) - { - Repository.Add(entity); - Repository.Save(); - } } } From 961b731dc3b043e2ae2093ae08863e909bd40a69 Mon Sep 17 00:00:00 2001 From: I380210 Date: Thu, 8 Oct 2020 20:01:09 +0200 Subject: [PATCH 047/157] Added postman tests for following project and following users --- Postman/dex.postman_collection.json | 1054 +++++++++++++++++++++++- Postman/local.postman_environment.json | 16 +- 2 files changed, 1039 insertions(+), 31 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 47c3dbee..b1b34704 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -137,32 +137,32 @@ { "listen": "test", "script": { - "id": "94f54dfd-89dd-45a8-ac76-35c00e370aba", + "id": "a3b6c462-7e86-46c8-9d98-05b5dd339313", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "var userName = pm.environment.get(\"userName\");\r", - "\r", - "var jsonData = pm.response.json();\r", - "\r", - "pm.environment.set(\"createdUserId\", jsonData.id);\r", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);\r", - "\r", - "pm.test(\"Status code is 201\", function () {\r", - " pm.response.to.have.status(201);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.success;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "\r", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", - "});\r", - "\r", - "pm.test(\"Check if created Username matches: \" + userName, function () {\r", - " pm.expect(jsonData.name).to.eql(userName);\r", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = \"Hailie\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", "});" ], "type": "text/javascript" @@ -171,11 +171,89 @@ ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "" + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "88c15a99-a0c3-4e47-8fd0-ce9f64208f48", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } }, - "description": "follow a user" + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } }, "response": [] } @@ -528,6 +606,139 @@ { "name": "Project", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "Project-FollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "201e6274-7400-4796-a8e8-1f716949998e", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = \"Generic Metal Ball\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "77bdb6e8-2d5d-4d80-854a-cbd75bc74a2d", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "Project-CreateProject-Administrator", "event": [ @@ -3277,6 +3488,130 @@ { "name": "User", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "User-FollowUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "f0e5f35a-4a60-4212-9534-a6951d3fe67d", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = \"Hailie\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "ac49acff-4932-4bc4-a299-84a88c2d43ca", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "User-CreateUser-Guest", "event": [ @@ -3639,6 +3974,130 @@ { "name": "Project", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "Project-FollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "10f720b4-7358-425b-9ae3-fc710f13606f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = \"Generic Metal Ball\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "e6514155-994f-4971-84bb-ca8b6dac9877", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "Project-CreateProject-Guest", "event": [ @@ -5496,6 +5955,139 @@ { "name": "User", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "User-FollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "c4255679-9796-4eb1-934b-c81ba7548568", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = \"Hailie\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "65dc7b50-8b33-4be3-a0f8-0913a5350531", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "User-CreateUser-Registered", "event": [ @@ -6009,6 +6601,139 @@ { "name": "Project", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "Project-FollowProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "90d3b837-8b90-41bc-ad24-be764de509b0", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = \"Generic Metal Ball\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "ed5d7f2c-f6da-4369-9d7c-c83b504c5a60", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "Project-CreateProject-Registered", "event": [ @@ -8207,6 +8932,139 @@ { "name": "User", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "User-FollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "bebfe0e1-7c12-49b3-a8f8-6f78fe45722c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = \"Hailie\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "0207ca5a-12c2-4045-b0c1-b2d0d3577370", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "User-CreateUser-PR", "event": [ @@ -8597,6 +9455,139 @@ { "name": "Project", "item": [ + { + "name": "Follow", + "item": [ + { + "name": "Project-FollowProject-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "c227fa4b-6d4b-4bc8-88b5-7a113a70ebd0", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = \"Generic Metal Ball\"", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "e44c9331-1716-4417-a614-a2fee9502f0f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "Project-CreateProject-PR", "event": [ @@ -10923,5 +11914,12 @@ } } ], + "variable": [ + { + "id": "f7e8fb98-dff6-4403-a75a-f17a701a2b53", + "key": "userIdToFollow", + "value": "25" + } + ], "protocolProfileBehavior": {} } \ No newline at end of file diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 1cef8dfa..b867d483 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "b231668b-0723-406d-bba1-f394034ad801", + "id": "26248cfc-ce96-4e40-be23-1383bf1ba4ab", "name": "Local", "values": [ { @@ -206,9 +206,19 @@ "key": "identityId", "value": "", "enabled": true + }, + { + "key": "userIdToFollow", + "value": "25", + "enabled": true + }, + { + "key": "projectIdToFollow", + "value": "3", + "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-06-10T15:45:45.966Z", - "_postman_exported_using": "Postman/7.26.0" + "_postman_exported_at": "2020-10-08T17:59:49.823Z", + "_postman_exported_using": "Postman/7.33.1" } \ No newline at end of file From 60a3ba8263cd0519a496a6f272aba49d96c92a67 Mon Sep 17 00:00:00 2001 From: I380210 Date: Thu, 8 Oct 2020 20:07:35 +0200 Subject: [PATCH 048/157] Check so that user can not follow his self --- API/Controllers/UserController.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index f3d17a8c..e1788f49 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -220,7 +220,6 @@ public async Task DeleteAccount() userService.Save(); return Ok(); } - /// @@ -306,11 +305,20 @@ public async Task FollowUser(int followedUserId) }; return NotFound(problem); } + if(user.Id == followedUserId) + { + ProblemDetails problem = new ProblemDetails + { + Title = "You can not follow yourself", + Detail = "You can not follow yourself", + Instance = "57C13F73-6D22-41F3-AB05-0CCC1B3C8328" + }; + return NotFound(problem); + } UserUser userUser = new UserUser(user,followedUser); userUserService.Add(userUser); userUserService.Save(); - //return Ok(); return Ok(mapper.Map(userUser)); } From 61d5210570770b7d15a84c84d801ab6bdb2ee496 Mon Sep 17 00:00:00 2001 From: "Bouman,Dave D.H.M" Date: Fri, 9 Oct 2020 10:17:07 +0200 Subject: [PATCH 049/157] Test for following projects and users PR level --- Postman/dex.postman_collection.json | 456 ++++++++++++++-------------- 1 file changed, 228 insertions(+), 228 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index b1b34704..02162261 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "4c6d78aa-2bbc-4505-93d1-c1846ab50b11", + "_postman_id": "15b47cf4-c2f6-4f6b-8c22-36f49a4e3c19", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "1a66471b-1e40-4815-b5f6-c3fb2b2e8fd8", + "id": "622ca3a9-dc9b-42b8-b55d-0537af4d3b83", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "877f7f20-3b0c-447f-948b-092f40cede71", + "id": "032bc349-b4e4-4b5a-aff2-1ead716f5a98", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -137,7 +137,7 @@ { "listen": "test", "script": { - "id": "a3b6c462-7e86-46c8-9d98-05b5dd339313", + "id": "8c2c40d4-e34b-4275-9bef-24720025cbf1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = \"Hailie\"", @@ -208,7 +208,7 @@ { "listen": "test", "script": { - "id": "88c15a99-a0c3-4e47-8fd0-ce9f64208f48", + "id": "b26f3f9c-895e-4b40-b3d5-096ca94b0b0f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -267,7 +267,7 @@ { "listen": "test", "script": { - "id": "39a57a69-a92b-45eb-84e8-4b6773e67c57", + "id": "c9dfef6a-396d-4477-8e49-5b76141946c1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -336,7 +336,7 @@ { "listen": "test", "script": { - "id": "3f97d1ff-21c0-4d6e-8521-2f22cf5049cb", + "id": "07a764e6-4314-4ed3-93a8-25322bcc4aeb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -404,7 +404,7 @@ { "listen": "test", "script": { - "id": "38406795-99dd-4e5a-a8f2-b95f96868388", + "id": "57906af8-50ba-416a-b4d8-7e4a6c975d02", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -472,7 +472,7 @@ { "listen": "test", "script": { - "id": "4113b3dc-eac1-4b89-a21b-9d3929cbf399", + "id": "6894152d-7a12-4d14-8aab-28d1376dabb0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -547,7 +547,7 @@ { "listen": "test", "script": { - "id": "b2235654-c18d-4b7d-939b-602924f01da8", + "id": "36f73913-b210-4ffd-9ef8-4a2ce0175f48", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -615,7 +615,7 @@ { "listen": "test", "script": { - "id": "201e6274-7400-4796-a8e8-1f716949998e", + "id": "287acf8f-aec8-4770-ac9e-e656d54f35e7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -686,7 +686,7 @@ { "listen": "test", "script": { - "id": "77bdb6e8-2d5d-4d80-854a-cbd75bc74a2d", + "id": "b3503337-aaf8-4db6-94e8-9bc0d8953cb2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -745,7 +745,7 @@ { "listen": "test", "script": { - "id": "d61393e3-8548-41e7-bcc9-82828fea65ab", + "id": "1c696694-d10f-45c4-aab9-d97c1d6faad7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -823,7 +823,7 @@ { "listen": "test", "script": { - "id": "2c863cf6-a428-4359-9f9e-548d78446f87", + "id": "7198a4cd-4efb-471e-996d-939c1bdc9f0b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -896,7 +896,7 @@ { "listen": "test", "script": { - "id": "fe9eda6f-c02b-41d4-a2cc-07b30e54ddcb", + "id": "0fcc46d0-f45e-483c-baea-3bc0d71193af", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -965,7 +965,7 @@ { "listen": "test", "script": { - "id": "c4c1a16c-c1a3-4136-8a53-6fd0be5431b4", + "id": "e9fc2415-58dd-4083-b335-2f64fb7ab2ba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -1033,7 +1033,7 @@ { "listen": "test", "script": { - "id": "54725aa6-72bd-4c23-a6df-5d6b1e60cabe", + "id": "8f851662-a3c9-46bd-b519-01348db38346", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -1101,7 +1101,7 @@ { "listen": "test", "script": { - "id": "e4c8b9cb-1fa4-408b-8c16-04961dde95d2", + "id": "c81ba9b2-ec7b-44b2-8e26-45e658b7feb8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1161,7 +1161,7 @@ { "listen": "test", "script": { - "id": "e97c451d-4366-4c6d-9ceb-cd8c5e4a8684", + "id": "92f9f5de-9e9a-4f42-93b0-9fb8e15307ad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1190,7 +1190,7 @@ { "listen": "prerequest", "script": { - "id": "2851e3e3-e4d0-4839-87c2-d9d3340404ca", + "id": "23f191d3-aebc-423d-9f07-8b24f5272261", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -1240,7 +1240,7 @@ { "listen": "test", "script": { - "id": "2cfe31e9-7fc9-467d-b676-6790f1e54dad", + "id": "337bbdae-0434-41b8-a5d7-ce94541c5dd3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1309,7 +1309,7 @@ { "listen": "test", "script": { - "id": "019f2d15-3d25-418c-860c-1917145fc59c", + "id": "be6b82c6-7a26-450e-ad4b-edf48cf7542b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1371,7 +1371,7 @@ { "listen": "test", "script": { - "id": "271e79a5-ddc3-44d8-ab01-b5a967540077", + "id": "f22fbe1e-7ea3-4799-a4a7-c0e7a20706fd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1458,7 +1458,7 @@ { "listen": "test", "script": { - "id": "67f60ae3-5548-4109-a4df-52d5e1868c61", + "id": "2b2bb4ef-fa33-4cc9-9cb3-fa3c0efe7827", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1490,7 +1490,7 @@ { "listen": "prerequest", "script": { - "id": "2b9f6333-d10f-49c0-81cf-52231cfbad56", + "id": "987fcc5f-6972-4f50-b325-8bae54197c77", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1537,7 +1537,7 @@ { "listen": "test", "script": { - "id": "457b9fc9-fcca-450c-8c1e-7e9127b9688b", + "id": "724a1d02-0c5a-4a5c-9158-e4b1d920f29d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1604,7 +1604,7 @@ { "listen": "test", "script": { - "id": "9782026b-8f7e-40a7-b050-411d25f0eef9", + "id": "7017dddf-7b80-4142-bc59-167a9f5bb71d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1665,7 +1665,7 @@ { "listen": "test", "script": { - "id": "ed85d1d2-b21b-4072-89dc-fa5de22e296d", + "id": "211ea404-c5cc-48f1-b562-7c4e007cb725", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1729,7 +1729,7 @@ { "listen": "test", "script": { - "id": "1690e619-382d-45aa-b88d-8b9e795a792d", + "id": "de30bc1f-e6ab-4c67-93dc-1cfa4f147755", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1798,7 +1798,7 @@ { "listen": "test", "script": { - "id": "fefd4466-3278-46db-9db5-61847e44f5e0", + "id": "c9b40baa-b53d-4af0-bc02-3a326814c8f2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1856,7 +1856,7 @@ { "listen": "test", "script": { - "id": "e8da1a0e-329c-4826-b2cd-6c5dad774d5a", + "id": "6874eede-770c-4bf8-9f9f-8f09b9af6d9d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1910,7 +1910,7 @@ { "listen": "test", "script": { - "id": "1f055dca-69b8-4297-99a1-c5321398e464", + "id": "bd48c06b-c759-4fe0-a306-76102630b710", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1971,7 +1971,7 @@ { "listen": "test", "script": { - "id": "0b2a1f2c-fec9-488c-888b-573b921c960f", + "id": "61070a16-f988-40a2-8c95-de084475a654", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -2044,7 +2044,7 @@ { "listen": "test", "script": { - "id": "e39513c3-a147-437f-a1b5-4c03e76a1437", + "id": "ba55d918-67e3-4cf4-a93a-ed67d970fce6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -2117,7 +2117,7 @@ { "listen": "test", "script": { - "id": "1c7ea11e-7201-4a24-b257-6bc0d17a8a8e", + "id": "75f9bf33-3a07-4a84-adc1-776fa9ae9329", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2183,7 +2183,7 @@ { "listen": "test", "script": { - "id": "d795bd97-87f7-4d8c-ab20-d3031e1d2d10", + "id": "abb1c3ed-ab73-4053-980f-5cd22bb4b0cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2242,7 +2242,7 @@ { "listen": "test", "script": { - "id": "c7f0497c-cbe6-43cf-98a0-7a9ca23ce83d", + "id": "e738a54a-9615-4080-a61d-9894ede77643", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2309,7 +2309,7 @@ { "listen": "test", "script": { - "id": "f1ae0b8e-54ad-4355-b9f9-c49af8676795", + "id": "19ec5ef5-d0b9-4198-b2f9-707861dc97d6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2367,7 +2367,7 @@ { "listen": "test", "script": { - "id": "527f91d5-ad8d-46ce-8069-540188368e15", + "id": "9744ad73-8dcb-4f73-a81b-c332f797b1b7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2446,7 +2446,7 @@ { "listen": "test", "script": { - "id": "604583d4-3ef0-4f82-9f63-3299393322d0", + "id": "c4f737ad-78e1-4dc1-b166-23534a190ef8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2504,7 +2504,7 @@ { "listen": "test", "script": { - "id": "3d393be2-6c48-43c8-9321-1178421b017a", + "id": "75867608-0218-4815-b802-da195ec984e9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2565,7 +2565,7 @@ { "listen": "test", "script": { - "id": "35ff002f-0a1c-4ba9-8f32-fc076a9df016", + "id": "7d857f51-d717-4bca-a83b-b2d8e2388a8f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2631,7 +2631,7 @@ { "listen": "test", "script": { - "id": "ab7fc434-1e94-4314-ba61-510622ed8109", + "id": "0382450f-12d8-47de-8b5f-35d4ee161c7c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2697,7 +2697,7 @@ { "listen": "test", "script": { - "id": "f9441b5e-6468-402c-9050-1f2ed2cd7eb2", + "id": "64cee8c3-a845-444d-9a00-eab1a596d810", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2742,7 +2742,7 @@ { "listen": "test", "script": { - "id": "519d324d-2050-48fc-8fe0-5f3db727443d", + "id": "bf7d15e8-eef6-403e-98e6-b9c03d5613d2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2787,7 +2787,7 @@ { "listen": "test", "script": { - "id": "122d06e3-da11-4a10-a8a2-13b5f55aff4e", + "id": "fa92cf59-cfc8-4fb5-84cf-dc29357beb9a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2832,7 +2832,7 @@ { "listen": "test", "script": { - "id": "5d07534a-c7b2-4bae-a1a4-be5a1f83e1b0", + "id": "4d63d5ca-527f-4208-a90d-c5b2ba455f0f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2877,7 +2877,7 @@ { "listen": "test", "script": { - "id": "bd435066-2722-44b0-9a2c-ac6ea5e487e3", + "id": "667710b2-4d58-46f2-8e25-a23066fe83ad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2922,7 +2922,7 @@ { "listen": "test", "script": { - "id": "eac8340a-8d68-45cd-8ad8-5a0922681e69", + "id": "581793a6-309b-4202-a185-94ec2f2bda18", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2974,7 +2974,7 @@ { "listen": "test", "script": { - "id": "1bc6d1c9-c7bc-4c78-97a5-9070d46de4a2", + "id": "31d0a8bd-acef-44a3-8725-50ca24dbd5cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3025,7 +3025,7 @@ { "listen": "test", "script": { - "id": "da84d71f-908e-4898-83f9-a898ce10cd5a", + "id": "d951c37b-ca39-447e-b008-2debbd203589", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3076,7 +3076,7 @@ { "listen": "test", "script": { - "id": "4138c470-08ac-4206-a387-8163c1df0da4", + "id": "fa428b70-de14-4aca-99f4-6374b127411b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3127,7 +3127,7 @@ { "listen": "test", "script": { - "id": "f842c6a4-1a66-4307-9040-6655f27f2850", + "id": "0eb8538e-21ae-4223-ae14-5ffbd11402ce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3178,7 +3178,7 @@ { "listen": "test", "script": { - "id": "d8c1d940-c3d6-4581-b266-cc116a0fa4b1", + "id": "41fa493b-05ae-4df2-946a-003ff9626958", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3243,7 +3243,7 @@ { "listen": "test", "script": { - "id": "0c6968b3-5428-45c1-87f4-38526d9c6fb8", + "id": "47e0e31b-43db-4c4e-935d-43f9cae04435", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3321,7 +3321,7 @@ { "listen": "test", "script": { - "id": "75deb1d3-1c6e-4207-86f4-b96144908cd6", + "id": "4e299008-02cd-42eb-952e-d3b60ad336c2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3350,7 +3350,7 @@ { "listen": "prerequest", "script": { - "id": "36f4ee88-cb32-479a-a102-e67e71dad85b", + "id": "7bf72eea-1f8d-4731-8c7a-3d88d65b9962", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3400,7 +3400,7 @@ { "listen": "test", "script": { - "id": "ae663b53-9e1c-4377-bc32-e63b3e398673", + "id": "5b1c36b8-dcb1-4386-b656-1416ad821b83", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3464,7 +3464,7 @@ { "listen": "prerequest", "script": { - "id": "7e3a5b84-6845-41a8-aff2-21b10364fd31", + "id": "08b2ee8d-a707-4507-8525-e34ee9c8334b", "type": "text/javascript", "exec": [ "" @@ -3474,7 +3474,7 @@ { "listen": "test", "script": { - "id": "fa2b34bb-9f3a-4894-96a3-6bf90cb5e1a7", + "id": "00b011f4-078c-4dcd-9eb0-0b219d3330d1", "type": "text/javascript", "exec": [ "" @@ -3497,7 +3497,7 @@ { "listen": "test", "script": { - "id": "f0e5f35a-4a60-4212-9534-a6951d3fe67d", + "id": "9d12f59d-daa3-41cb-abb9-067bfa00bf66", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = \"Hailie\"", @@ -3559,7 +3559,7 @@ { "listen": "test", "script": { - "id": "ac49acff-4932-4bc4-a299-84a88c2d43ca", + "id": "5fc04efd-d264-4ec9-9c6c-42abd9e97cb4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3618,7 +3618,7 @@ { "listen": "test", "script": { - "id": "4942ccb1-9408-4924-b16b-54dfffb38ce4", + "id": "fc74f4f4-5116-43d2-9d34-5dd0868e706d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3676,7 +3676,7 @@ { "listen": "test", "script": { - "id": "3975ec96-369f-46b0-b497-452ecbc9ea9f", + "id": "d6c6e1ae-9fec-43c9-9627-ee2a0c75883d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3734,7 +3734,7 @@ { "listen": "test", "script": { - "id": "089e8a95-d3df-4ac7-acc4-67408697854c", + "id": "f5493b86-bfdf-4f4d-b1d8-0d0717cdc517", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3792,7 +3792,7 @@ { "listen": "test", "script": { - "id": "3b8d73ce-9d75-4e1e-9cdb-e33e26fff397", + "id": "374d0c2d-af18-45f5-9878-d41aa2935a5e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3842,7 +3842,7 @@ { "listen": "test", "script": { - "id": "b94ec53e-4628-4cfe-b7fb-7c0ed100e92c", + "id": "8a26a436-5ca8-4e24-810b-59ff7b9e3f60", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3901,7 +3901,7 @@ { "listen": "test", "script": { - "id": "9b01cdbf-1112-4885-84ef-5a44ad7a8e08", + "id": "f81eadce-501a-4ec1-be85-8b047b538d5f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3950,7 +3950,7 @@ { "listen": "prerequest", "script": { - "id": "d4dd4897-4d7a-48de-bc80-d5606ab80503", + "id": "4e646515-8c49-4ace-b61d-389b68f5ea32", "type": "text/javascript", "exec": [ "" @@ -3960,7 +3960,7 @@ { "listen": "test", "script": { - "id": "76c9fba7-fe09-4b16-b40e-fe89a49be6d0", + "id": "716e4779-0df5-489d-a081-63e132710770", "type": "text/javascript", "exec": [ "" @@ -3983,7 +3983,7 @@ { "listen": "test", "script": { - "id": "10f720b4-7358-425b-9ae3-fc710f13606f", + "id": "405bb2c3-45fb-4955-bcba-6b3ad52b0771", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -4045,7 +4045,7 @@ { "listen": "test", "script": { - "id": "e6514155-994f-4971-84bb-ca8b6dac9877", + "id": "d4fc2373-9aa7-46b7-9d12-23ef34ce9480", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4104,7 +4104,7 @@ { "listen": "test", "script": { - "id": "3e462c07-e508-4306-8b95-7557a94f615e", + "id": "a393964a-a080-451b-b972-20721f47a74b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4164,7 +4164,7 @@ { "listen": "test", "script": { - "id": "236f3f80-f62e-4511-b6d0-a4b3993a5b6c", + "id": "54579761-8b3c-407d-9b64-f2beb6b67d39", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4234,7 +4234,7 @@ { "listen": "test", "script": { - "id": "58ab0e79-fe53-4681-b341-34afe2642378", + "id": "03797c64-f4ee-4d16-8376-c23243b4097f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4289,7 +4289,7 @@ { "listen": "test", "script": { - "id": "2f9e208b-5a8f-4cc8-903b-bc2cc7e29d92", + "id": "3de558cf-a1da-459d-827a-ea85aa319593", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4346,7 +4346,7 @@ { "listen": "test", "script": { - "id": "6f18a740-5476-4be8-bf16-42fcfb1039c4", + "id": "dbd54a6a-ba38-4b97-b334-a3fc0170713b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4395,7 +4395,7 @@ { "listen": "prerequest", "script": { - "id": "5332822c-ddf6-4ce9-8b20-0481daaa8a26", + "id": "f755a274-974f-4982-a17c-7de81f35998e", "type": "text/javascript", "exec": [ "" @@ -4405,7 +4405,7 @@ { "listen": "test", "script": { - "id": "ec54b55e-b850-440d-9fc7-fefa181c621d", + "id": "01555567-5ad5-4273-87f1-80a1890101ee", "type": "text/javascript", "exec": [ "" @@ -4425,7 +4425,7 @@ { "listen": "test", "script": { - "id": "b6e95ced-1911-46c8-8055-a9193cc92f85", + "id": "db1f317c-4c86-4dcf-977b-b9507c5c2bd4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4452,7 +4452,7 @@ { "listen": "prerequest", "script": { - "id": "b28a827f-e5dc-4803-98de-4479d8cb49ad", + "id": "296e7a09-03f1-44db-bc5a-9316366c39a8", "exec": [ "" ], @@ -4491,7 +4491,7 @@ { "listen": "test", "script": { - "id": "9d2a102d-f73c-46ad-8a97-517668618507", + "id": "35e6820f-6e0b-498d-9a39-66f518f4b742", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4536,7 +4536,7 @@ { "listen": "test", "script": { - "id": "2557b49b-0fb6-436f-a106-c2b7b70e9b82", + "id": "d9733d72-2edd-412b-a595-1f738ff14dce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4591,7 +4591,7 @@ { "listen": "test", "script": { - "id": "ee616ea3-7ada-47c4-8d89-8c6771ea0a91", + "id": "02e5de5e-f2c3-4dd3-afe4-de4fdbb1afaa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4640,7 +4640,7 @@ { "listen": "test", "script": { - "id": "d65c21c4-d620-420e-9686-99925b45a379", + "id": "651052bf-2b9d-4489-b7f5-99c01385cca0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4667,7 +4667,7 @@ { "listen": "prerequest", "script": { - "id": "afccfc7c-e898-49de-8c85-48025ffab8c2", + "id": "81110ac3-3f0c-45d7-b74a-01779ed4a78b", "exec": [ "" ], @@ -4707,7 +4707,7 @@ { "listen": "test", "script": { - "id": "b416083f-571d-4198-839c-3fac30df8cbe", + "id": "f33b9cf5-acc9-4d7c-95f1-edc2fa0a21ea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4756,7 +4756,7 @@ { "listen": "prerequest", "script": { - "id": "ace2271a-1cf8-441c-97f9-745ecc7f4dfc", + "id": "27b605d7-c247-4e59-a5f1-898b560d61de", "type": "text/javascript", "exec": [ "" @@ -4766,7 +4766,7 @@ { "listen": "test", "script": { - "id": "9a540bec-5d16-4586-92e7-6dd0c7bd9ad1", + "id": "baff3cd0-debd-4770-aac4-0d821ab6a654", "type": "text/javascript", "exec": [ "" @@ -4786,7 +4786,7 @@ { "listen": "test", "script": { - "id": "8afb37b6-e751-439c-95b4-4948c97fba13", + "id": "bd249c7c-9098-48f5-abfe-71a082ae62ff", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4841,7 +4841,7 @@ { "listen": "test", "script": { - "id": "6fac0ea0-97bd-4270-88ea-8d4abadd30ab", + "id": "1afeb01f-d3d1-4257-893c-a381c4dd9000", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4887,7 +4887,7 @@ { "listen": "test", "script": { - "id": "049f545c-6501-48e4-88ad-436e1e3ad52c", + "id": "3f3424e6-f363-4c3c-bf06-644fdcfba60e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4934,7 +4934,7 @@ { "listen": "test", "script": { - "id": "6b2c0c4d-e8d8-40bb-96e3-8e39d97dbf86", + "id": "bbabd139-d044-4ae6-9165-6338738e84f6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4983,7 +4983,7 @@ { "listen": "prerequest", "script": { - "id": "974fe5e0-8faa-48e7-8283-bf3d74ade01b", + "id": "dbbc22d9-c4cc-4c78-939f-2114b32b1c79", "type": "text/javascript", "exec": [ "" @@ -4993,7 +4993,7 @@ { "listen": "test", "script": { - "id": "9c7ce2dc-0cb6-41c9-a4e3-a5f9d042905c", + "id": "5034988c-c395-452f-8475-7e30543625ef", "type": "text/javascript", "exec": [ "" @@ -5013,7 +5013,7 @@ { "listen": "test", "script": { - "id": "5b366383-0215-4ef8-bd31-ae24bccdadb3", + "id": "e9c51a24-8ee2-46a5-88a8-0dfd01ca483f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5069,7 +5069,7 @@ { "listen": "test", "script": { - "id": "d5ff7b7a-d816-4013-abf5-ccd7abdc645b", + "id": "dbff30d9-b7ad-4372-b961-2d8a1525e5ee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5116,7 +5116,7 @@ { "listen": "test", "script": { - "id": "c4b0517b-d251-4c51-81ea-dccbb2497469", + "id": "5d1a8e96-5a95-4967-af4b-bc21142b50c1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5164,7 +5164,7 @@ { "listen": "test", "script": { - "id": "9c013aa9-fdf3-4882-952e-f380dc67c033", + "id": "a37694e1-2dfd-45f7-8fff-2410ce0f6268", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5212,7 +5212,7 @@ { "listen": "test", "script": { - "id": "d5e45691-05ef-488b-a0f2-b85bc78c8159", + "id": "6db2ca35-391f-4691-8dfb-65ed053a5671", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5269,7 +5269,7 @@ { "listen": "test", "script": { - "id": "058da24c-ff03-4e2d-a209-ab0fe546f23a", + "id": "c3974170-b1c2-4c56-af33-61b8e9896bfe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5340,7 +5340,7 @@ { "listen": "prerequest", "script": { - "id": "ea089996-0384-4ff0-918b-9d702a487aa0", + "id": "65696e3b-a46c-4390-9fbe-baf20616c22f", "type": "text/javascript", "exec": [ "" @@ -5350,7 +5350,7 @@ { "listen": "test", "script": { - "id": "18d829ae-ecba-46bb-938a-04631a5f60b4", + "id": "4b34755c-a073-4061-bd8d-e7e46109aac9", "type": "text/javascript", "exec": [ "" @@ -5370,7 +5370,7 @@ { "listen": "test", "script": { - "id": "2037afa0-45dd-4446-ba30-5d7722c9110e", + "id": "3110845e-227d-4eb2-8528-6691d71d159a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5421,7 +5421,7 @@ { "listen": "prerequest", "script": { - "id": "b8061e8c-27bc-42d2-8db0-273cfef13eaf", + "id": "c8a55b47-579c-42c1-b25f-f37d5ab51819", "type": "text/javascript", "exec": [ "" @@ -5431,7 +5431,7 @@ { "listen": "test", "script": { - "id": "adc06546-acbc-46c2-b1b2-887e037da1db", + "id": "00f76b2c-6c1e-4844-9c1d-277abb8a00e0", "type": "text/javascript", "exec": [ "" @@ -5451,7 +5451,7 @@ { "listen": "test", "script": { - "id": "5ab936d6-a3af-49ec-b9b2-bf4ad61d9051", + "id": "d6932703-02cc-4b19-beaa-97c9353f3671", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5507,7 +5507,7 @@ { "listen": "prerequest", "script": { - "id": "4175d156-de80-48b0-9d2f-fa430b8fce3c", + "id": "32a4d758-bc51-44fd-920b-825b893093da", "type": "text/javascript", "exec": [ "" @@ -5517,7 +5517,7 @@ { "listen": "test", "script": { - "id": "3902d157-5c56-4155-b143-795149f25549", + "id": "4b9a8125-4112-434e-86ca-4145a98398b6", "type": "text/javascript", "exec": [ "" @@ -5533,7 +5533,7 @@ { "listen": "prerequest", "script": { - "id": "41e1ddcd-f7cf-4ba9-b197-a053c0db5ab6", + "id": "d6e608e7-4b6f-4890-abd3-1469270d6396", "type": "text/javascript", "exec": [ "" @@ -5543,7 +5543,7 @@ { "listen": "test", "script": { - "id": "336416e8-70f4-4e6f-b815-59c1a8f9d8c2", + "id": "cb660d64-67b1-4aa3-8c73-d93aa2b476b2", "type": "text/javascript", "exec": [ "" @@ -5566,7 +5566,7 @@ { "listen": "test", "script": { - "id": "37390962-11bb-4481-8ff6-6a262fdbbfb9", + "id": "99fd2e04-d30d-4f64-9d5b-11705ba1613f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5635,7 +5635,7 @@ { "listen": "test", "script": { - "id": "841a6755-d58d-44bd-a843-9a6f8cea1c1c", + "id": "b76895b5-b5e6-45df-9d89-e31b4d9584ce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5714,7 +5714,7 @@ { "listen": "test", "script": { - "id": "09cb57b5-8dd8-4c1f-ad89-19a1d9448867", + "id": "f6067cb9-610b-400b-9899-caa2944b065d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5743,7 +5743,7 @@ { "listen": "prerequest", "script": { - "id": "8bcd0405-0a24-4c0e-b86a-18ec8ca810f4", + "id": "87cc86f5-a6a4-4b94-9f13-c51200f18485", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5793,7 +5793,7 @@ { "listen": "test", "script": { - "id": "062857b0-45f0-48c1-9bbe-875ddd2e77ef", + "id": "6cccd197-e6af-4090-bdd6-0ed3b49ac08d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5858,7 +5858,7 @@ { "listen": "test", "script": { - "id": "640e670c-ee8c-4060-838a-71b2448049aa", + "id": "41077d54-84aa-4a9c-b971-949f7d241ec6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5931,7 +5931,7 @@ { "listen": "prerequest", "script": { - "id": "b4a8e825-5968-49ee-a637-87a3041ee206", + "id": "78212168-5235-417c-bc3b-6bbd30905984", "type": "text/javascript", "exec": [ "" @@ -5941,7 +5941,7 @@ { "listen": "test", "script": { - "id": "44cfdd99-f456-427e-b9ce-c5bca735ddae", + "id": "afcafa55-2c36-4b15-b724-ef064ad43bb8", "type": "text/javascript", "exec": [ "" @@ -5964,7 +5964,7 @@ { "listen": "test", "script": { - "id": "c4255679-9796-4eb1-934b-c81ba7548568", + "id": "37e84333-0a77-4d1d-bb3f-7391bd039d68", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = \"Hailie\"", @@ -6035,7 +6035,7 @@ { "listen": "test", "script": { - "id": "65dc7b50-8b33-4be3-a0f8-0913a5350531", + "id": "7178a83a-970c-4f28-8f73-778c0caf68de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6094,7 +6094,7 @@ { "listen": "test", "script": { - "id": "8c17f208-acb1-4093-8f96-6777e7f1873f", + "id": "1c43be11-b552-4135-830b-879094deffac", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6154,7 +6154,7 @@ { "listen": "test", "script": { - "id": "08718303-940b-4fe3-b1d6-5e0bad5717f8", + "id": "e09471c5-34ef-41cb-9d9e-fd8fb4f94358", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6217,7 +6217,7 @@ { "listen": "test", "script": { - "id": "a14d4009-fb13-4a72-a3ba-92e085e63ca5", + "id": "fc5a8c5b-7a0f-4273-a79c-5e63d9775a9c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6280,7 +6280,7 @@ { "listen": "test", "script": { - "id": "64ad21ec-65c1-4fb5-a049-1359bd7ef974", + "id": "0205bcbb-5884-4ad4-8195-20b48e1084a0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6337,7 +6337,7 @@ { "listen": "test", "script": { - "id": "9b2bc0ad-c52d-425d-9b92-ac0d533d3da6", + "id": "523b6117-8d14-4af1-9f6e-62af23137b64", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6390,7 +6390,7 @@ { "listen": "test", "script": { - "id": "9f26698d-f2ae-4ac6-b1b7-50c1210073f0", + "id": "c243bdb7-3234-471c-bf83-962258701895", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -6448,7 +6448,7 @@ { "listen": "test", "script": { - "id": "cb64f4c6-eafa-4467-8aea-48d6f89eaa1b", + "id": "50ae26ac-cb0f-45d3-a622-e2ffd52e9bea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -6515,7 +6515,7 @@ { "listen": "test", "script": { - "id": "de09312d-cd71-44c8-a67e-f33d8d97611e", + "id": "7816f55a-3c8b-4f0e-a118-a9aece4db9eb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6577,7 +6577,7 @@ { "listen": "prerequest", "script": { - "id": "78e80d2d-cfa0-4ef8-80ac-61576263dcc6", + "id": "bcc4a9d7-589c-468b-aa77-ef2e4a708422", "type": "text/javascript", "exec": [ "" @@ -6587,7 +6587,7 @@ { "listen": "test", "script": { - "id": "164e4639-9aae-4276-a94c-c17de5a6acf3", + "id": "acc49cd3-821e-404f-b8a1-7690a9dd0096", "type": "text/javascript", "exec": [ "" @@ -6610,7 +6610,7 @@ { "listen": "test", "script": { - "id": "90d3b837-8b90-41bc-ad24-be764de509b0", + "id": "7532e929-2bca-4537-86e8-532d2442cd73", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -6681,7 +6681,7 @@ { "listen": "test", "script": { - "id": "ed5d7f2c-f6da-4369-9d7c-c83b504c5a60", + "id": "17328367-b943-4634-a860-c6d14cc434bc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6740,7 +6740,7 @@ { "listen": "test", "script": { - "id": "1c032e5f-34c9-48ab-b787-32a42cb22ad3", + "id": "bc7330a4-1713-4b09-b72d-9a98cbaaff81", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6806,7 +6806,7 @@ { "listen": "test", "script": { - "id": "6d9a6718-f202-46b8-91f5-3a5038ece212", + "id": "a41a791d-9dc5-48e5-b6e5-c3a8cc7e40ef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6879,7 +6879,7 @@ { "listen": "test", "script": { - "id": "fbaf4624-82cc-422a-ab25-8ae346aefe6b", + "id": "a4be3f2b-0fae-4d78-9d44-ee29b87647d9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6937,7 +6937,7 @@ { "listen": "test", "script": { - "id": "0f0987a9-a9e2-43ee-b04e-82cc81400cb4", + "id": "c1fed73c-d531-45c0-bc66-abaae7345f53", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6987,7 +6987,7 @@ { "listen": "test", "script": { - "id": "9c741cad-37f6-44b8-8bce-583b2c3b5121", + "id": "a1197433-2a85-4d74-bcd0-f16255c23cef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -7054,7 +7054,7 @@ { "listen": "test", "script": { - "id": "4884b2bb-386a-4146-a5bf-d60e9e23a761", + "id": "8b8d3014-985d-4569-a6e3-907821a158ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7121,7 +7121,7 @@ { "listen": "test", "script": { - "id": "d8f5857d-e7a9-4562-acb0-d79f13f97dc9", + "id": "ae8813d5-05d8-491c-b087-17872ad7d067", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7185,7 +7185,7 @@ { "listen": "test", "script": { - "id": "a8704e86-b968-4a1a-a115-bb42c1abd901", + "id": "9d18f10b-a502-4d2f-9a21-6132bec67d02", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7246,7 +7246,7 @@ { "listen": "test", "script": { - "id": "50da69f4-51af-425e-b3b5-679833b093a3", + "id": "7c3bd164-c534-45f8-a0dd-e48af58cc4d8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7298,7 +7298,7 @@ { "listen": "test", "script": { - "id": "54224f90-08a3-41d9-956d-e5f3b59dad78", + "id": "02ae8509-044f-4745-aae2-020318edf81c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -7363,7 +7363,7 @@ { "listen": "test", "script": { - "id": "be2bbe3c-ef1c-4009-92f0-0677a98bd699", + "id": "127596a8-e3e7-479f-8e78-ff1a24495bb6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7389,7 +7389,7 @@ { "listen": "prerequest", "script": { - "id": "69985e3d-b872-4019-bf58-fea7e0dd4017", + "id": "cfa98217-d58b-4931-8f1c-c443ebe3ca23", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -7439,7 +7439,7 @@ { "listen": "test", "script": { - "id": "96d1d50d-6690-4d93-a15b-8b832849f24e", + "id": "40e79ce9-01a4-42f6-b2d2-af1c0bf4ae51", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -7508,7 +7508,7 @@ { "listen": "test", "script": { - "id": "877cbb1e-c498-46e0-b01c-57945b28e4f1", + "id": "254bb444-9cb0-4255-b521-bcbee1ab7d44", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -7570,7 +7570,7 @@ { "listen": "test", "script": { - "id": "62414f21-5bf5-4d24-baa6-bf6449dbae80", + "id": "5d59b4f7-185e-42bf-a782-18a344289e00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7625,7 +7625,7 @@ { "listen": "test", "script": { - "id": "d7fe4641-7fc6-451e-b9f2-7667ce7fdbbb", + "id": "6c6e3931-fe9d-49c7-b63f-637b5e3f42c5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7694,7 +7694,7 @@ { "listen": "test", "script": { - "id": "b388bf7f-5916-4038-9fbd-2aad609aff61", + "id": "3d9e8e84-ac44-4b95-aad8-49ed91687360", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7755,7 +7755,7 @@ { "listen": "test", "script": { - "id": "c825a04e-4755-435a-babf-b2c5b35a8411", + "id": "8df598ef-c845-4a12-995c-e5e7cde65e97", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7807,7 +7807,7 @@ { "listen": "test", "script": { - "id": "406f0f19-9584-4a48-a16a-243e0c776d53", + "id": "ee0f629f-69b6-4808-abf8-6a2724dd44cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7860,7 +7860,7 @@ { "listen": "test", "script": { - "id": "4e973ecb-358e-4822-a755-1f840d24a537", + "id": "6a8592e7-1056-47dc-88e1-5d648f385739", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7913,7 +7913,7 @@ { "listen": "test", "script": { - "id": "957e049b-e852-4add-9c98-99f7d53018b4", + "id": "1af3ed86-2d41-406a-af9d-2919e1feb511", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7975,7 +7975,7 @@ { "listen": "test", "script": { - "id": "b9ee11c5-3ab1-439c-bfca-ebdc24c37a97", + "id": "0c1e1f20-b2d9-4ea7-8c7d-fc6ea4e4236d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8056,7 +8056,7 @@ { "listen": "test", "script": { - "id": "e4c53361-76fa-420e-a96d-51553bd28e36", + "id": "62702c2e-f2e6-4a7e-9610-9fb6a73b9603", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8115,7 +8115,7 @@ { "listen": "test", "script": { - "id": "7ee13813-ee65-4e70-a4b6-cadf3a9643f8", + "id": "0fe89ead-57b0-4330-bcf6-7ffcb60f7ed7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -8181,7 +8181,7 @@ { "listen": "test", "script": { - "id": "ff110cc1-e561-4946-a576-29c78a67f84e", + "id": "bdb3336a-e349-4520-85ac-de527e8996dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8230,7 +8230,7 @@ { "listen": "test", "script": { - "id": "ee37ff4e-7621-4704-801e-fb77d7e2a532", + "id": "731d0dd1-fd43-476e-9cb8-270d7cf1d227", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8281,7 +8281,7 @@ { "listen": "test", "script": { - "id": "821bf299-4745-47f4-a85e-b3703c8cc427", + "id": "6c66624b-e451-4b91-8056-073f5e97029b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8332,7 +8332,7 @@ { "listen": "test", "script": { - "id": "5c29ffca-aece-4dbf-ad79-c0df35474f00", + "id": "5f8f9879-25c1-4028-99e4-8d575999878e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8377,7 +8377,7 @@ { "listen": "test", "script": { - "id": "3b0faf63-9482-47af-bb14-05f1e8c72fe8", + "id": "ec780b37-1ee5-40da-8995-b9ee56c0d978", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8428,7 +8428,7 @@ { "listen": "test", "script": { - "id": "7dfb434e-df3a-45a3-a688-c70d0ac6bcfb", + "id": "4951c987-9463-4f11-a737-61cc04d83cb5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8479,7 +8479,7 @@ { "listen": "test", "script": { - "id": "ea2b80d1-3a0d-46a6-96ee-a36507b4958d", + "id": "d8a149d2-907e-4fae-a914-59a0d5bbeeaa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8544,7 +8544,7 @@ { "listen": "test", "script": { - "id": "276bd88c-9e4a-4a67-a68a-87b294292f7b", + "id": "cc979478-67c4-4909-bc60-7f82e044eade", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8613,7 +8613,7 @@ { "listen": "test", "script": { - "id": "1916c432-a17f-4bf2-ba4c-d127f1b7eb61", + "id": "9d7a5490-ed3c-4d00-83bd-fa1757b9838f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8692,7 +8692,7 @@ { "listen": "test", "script": { - "id": "858bd459-551e-4ae6-a02a-81717839d7ef", + "id": "89ce03d3-54f2-47bd-a9a3-1e81bf88046f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8721,7 +8721,7 @@ { "listen": "prerequest", "script": { - "id": "8ce9640a-0b5a-43c2-b1fb-6de12e14b804", + "id": "42443c21-b762-4e42-ba0e-e7c3e4c6f888", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8771,7 +8771,7 @@ { "listen": "test", "script": { - "id": "c9b33945-4099-499d-b76c-ab26a5003c0e", + "id": "ccdbfcbc-ebb8-48a3-b32c-be792a78c50d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8835,7 +8835,7 @@ { "listen": "test", "script": { - "id": "71be5a9d-0e56-44a1-95f8-9d51b87ad33d", + "id": "0abc7ced-7e3c-4f39-a53e-39b0f70289a9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8908,7 +8908,7 @@ { "listen": "prerequest", "script": { - "id": "3577cb8f-ec54-4681-abf4-d079de9df68f", + "id": "a6a1a55e-362a-4edb-b44e-7163b9e093a8", "type": "text/javascript", "exec": [ "" @@ -8918,7 +8918,7 @@ { "listen": "test", "script": { - "id": "f69c81ab-26d1-40bb-b61d-763f347c481b", + "id": "c37a7de1-afd9-4cb7-8557-5f9eda7e1c3c", "type": "text/javascript", "exec": [ "" @@ -8936,12 +8936,12 @@ "name": "Follow", "item": [ { - "name": "User-FollowUser-Registered", + "name": "User-FollowUser-PR", "event": [ { "listen": "test", "script": { - "id": "bebfe0e1-7c12-49b3-a8f8-6f78fe45722c", + "id": "4584d09c-d869-4f99-8bbd-2d8ea7db7e91", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = \"Hailie\"", @@ -9007,12 +9007,12 @@ "response": [] }, { - "name": "User-UnFollowUser-Registered", + "name": "User-UnFollowUser-PR", "event": [ { "listen": "test", "script": { - "id": "0207ca5a-12c2-4045-b0c1-b2d0d3577370", + "id": "b1db8446-b232-432f-825b-cc90c8414906", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9071,7 +9071,7 @@ { "listen": "test", "script": { - "id": "8a5de292-f8fe-4364-88dd-ce801423c894", + "id": "1f23e773-e049-4f66-89a9-03d88ea5d998", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9131,7 +9131,7 @@ { "listen": "test", "script": { - "id": "4832f5c1-34bc-46e5-a183-b8c0e6da4b73", + "id": "7ca4c33d-d336-4cd3-adba-395f4884199d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9191,7 +9191,7 @@ { "listen": "test", "script": { - "id": "f76adf10-5d5d-438d-a25f-06bafaac67cb", + "id": "3ded50fc-6239-4cdb-b859-6bca9c1068a8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9244,7 +9244,7 @@ { "listen": "test", "script": { - "id": "fc9b9959-958c-4220-90af-f5cdbd54a462", + "id": "9ca1ee92-70e7-4719-befc-964f7acc82f2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -9302,7 +9302,7 @@ { "listen": "test", "script": { - "id": "2503be33-b38a-485e-9343-b908fd5d5376", + "id": "c01fe1a3-a2ec-43ca-a6ff-b4ac3879cc9c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -9369,7 +9369,7 @@ { "listen": "test", "script": { - "id": "783bc2e1-55de-4d85-9b38-b310c5b36455", + "id": "10eca275-822a-492f-91cb-4bd9c5798603", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9431,7 +9431,7 @@ { "listen": "prerequest", "script": { - "id": "2241cc60-029d-4ea8-bfb4-823a78229b5e", + "id": "224a7dff-c4f3-44c7-a5ae-5580c2862f96", "type": "text/javascript", "exec": [ "" @@ -9441,7 +9441,7 @@ { "listen": "test", "script": { - "id": "fa9713b6-08c5-4fed-b895-43d23e6cc4bb", + "id": "7f19e3e4-d9bb-4030-a07b-816b369a01d9", "type": "text/javascript", "exec": [ "" @@ -9464,7 +9464,7 @@ { "listen": "test", "script": { - "id": "c227fa4b-6d4b-4bc8-88b5-7a113a70ebd0", + "id": "a72b41af-06e1-4c17-968c-da98431ecde8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -9535,7 +9535,7 @@ { "listen": "test", "script": { - "id": "e44c9331-1716-4417-a614-a2fee9502f0f", + "id": "a4723ae3-89c8-40f5-b1ca-44f1f10eee7b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9594,7 +9594,7 @@ { "listen": "test", "script": { - "id": "873d39b1-5d77-4e8c-81bb-8cd34c0b18b8", + "id": "9942acd6-d058-4c13-928c-78449976ebe1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -9660,7 +9660,7 @@ { "listen": "test", "script": { - "id": "8ac6d8f8-a9ca-4e8f-91ca-32b1746e9b0e", + "id": "c243acad-627b-4ea3-b52e-ffdaa8c9da2a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9733,7 +9733,7 @@ { "listen": "test", "script": { - "id": "fe50be45-03da-4d44-b16c-ff57d01c2290", + "id": "5b3371ae-bd25-426e-be36-74a626eb162d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9791,7 +9791,7 @@ { "listen": "test", "script": { - "id": "d50e0434-5bc5-4838-8cde-5983878b40cd", + "id": "b0f9f8cc-1448-44ae-9518-62672a3b3d6c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -9841,7 +9841,7 @@ { "listen": "test", "script": { - "id": "1536f62b-6328-490d-a89a-4fa7c93808d3", + "id": "d16484b3-583f-408b-82ef-8c6d2d5bca0c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -9908,7 +9908,7 @@ { "listen": "test", "script": { - "id": "a022dace-9a2e-4088-90eb-cb6d1ba13cb3", + "id": "a3481927-07f6-40a8-b361-ba9122288947", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9975,7 +9975,7 @@ { "listen": "test", "script": { - "id": "49ca32af-af00-42ab-8103-a3615ecc8e0d", + "id": "df9e180d-4d1d-42aa-8dd4-9345343231ee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10039,7 +10039,7 @@ { "listen": "test", "script": { - "id": "b764313c-6aa5-418d-80a4-810bfcb3893a", + "id": "b29b5cb3-5395-49fd-b01a-121731813f43", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10103,7 +10103,7 @@ { "listen": "test", "script": { - "id": "b0f6f5fe-9cfe-4eb4-afd1-c0f261f50831", + "id": "49bd9343-6e42-47c5-9ae3-a53728fffe5e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10155,7 +10155,7 @@ { "listen": "test", "script": { - "id": "4301a870-38a9-4569-a654-a2a17fa506d5", + "id": "e1cbbff7-4d03-415b-be38-5568a09ce095", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -10213,7 +10213,7 @@ { "listen": "test", "script": { - "id": "a44c8b53-8712-4ade-820e-1e7b25be11a4", + "id": "33c17bbe-8e31-4744-b381-be8ce6d272fc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -10278,7 +10278,7 @@ { "listen": "test", "script": { - "id": "aafa55b8-8fe1-41d8-9f7f-fb8f05db5948", + "id": "666566fe-da83-4962-9ca0-85124a1e5d6d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10306,7 +10306,7 @@ { "listen": "prerequest", "script": { - "id": "9b21b58f-75c7-4af2-bee6-47d44e1c58c2", + "id": "ee838acc-3e15-4912-b24b-bc8a85452d3f", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10356,7 +10356,7 @@ { "listen": "test", "script": { - "id": "0d710855-d971-41bd-8d27-fade2a7b372e", + "id": "a6002647-2010-4b68-963b-8366772ddb77", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10418,7 +10418,7 @@ { "listen": "test", "script": { - "id": "0a94ca2d-e983-47a7-a761-14d0fda401b5", + "id": "bb8cd6f6-c3e2-47bb-9fc2-51569b75df22", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10505,7 +10505,7 @@ { "listen": "test", "script": { - "id": "a55882d9-b71b-428d-9fc6-90b03c2b7cb4", + "id": "47571cfd-f67b-41ff-b086-797bee461abc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10531,7 +10531,7 @@ { "listen": "prerequest", "script": { - "id": "c3a4192d-3a10-414b-be16-f5aaf5586f77", + "id": "ef6e8daf-35ca-4e62-a138-36e7d3b48e66", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10578,7 +10578,7 @@ { "listen": "test", "script": { - "id": "452abed7-0837-4678-86af-2b1561d74580", + "id": "d1d89642-5d69-43ab-acb9-64844497b349", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10605,7 +10605,7 @@ { "listen": "prerequest", "script": { - "id": "07e369ec-21f0-48c1-a7d1-4b78b36d764f", + "id": "ba320264-68af-4638-8ec3-b61c656a83d9", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10655,7 +10655,7 @@ { "listen": "test", "script": { - "id": "cec31933-5f54-4dc0-8bb6-ad7a7eb62062", + "id": "86e894c5-178d-44cf-beed-422c9db38ade", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10717,7 +10717,7 @@ { "listen": "test", "script": { - "id": "b382bf14-534e-4767-b311-830712c54b0d", + "id": "c2148556-cbf9-4e4c-820d-9559b277daff", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10804,7 +10804,7 @@ { "listen": "test", "script": { - "id": "1cae5ed2-a085-46d8-9207-9896a68f2e51", + "id": "25f9d703-bda6-4ba2-8440-fef30a33e9de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10830,7 +10830,7 @@ { "listen": "prerequest", "script": { - "id": "da3df4c2-f9ac-4728-9e5f-69a9e8353c95", + "id": "53d83c86-8668-47fd-85da-9485d4d0583f", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10877,7 +10877,7 @@ { "listen": "test", "script": { - "id": "7a95bdbf-2a79-440b-a248-4453ab6ade0b", + "id": "2cb32935-fadd-40b3-9a99-5a1a28271d5f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10953,7 +10953,7 @@ { "listen": "test", "script": { - "id": "2dd415c9-d29b-4b9b-aa15-cfe16f3b0827", + "id": "23a58fe6-1ae9-4a3f-a28b-ef71653667fe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11014,7 +11014,7 @@ { "listen": "test", "script": { - "id": "79295a5a-ea10-453b-8200-7557ceab73f2", + "id": "63eabe54-031b-4a7c-9e1e-f0c342aaf875", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11066,7 +11066,7 @@ { "listen": "test", "script": { - "id": "b6cc6c3e-45fc-48ad-8ef9-ebfcde11f4b4", + "id": "4d09c9d5-8db8-46e2-8be6-f60f0adb8367", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11119,7 +11119,7 @@ { "listen": "test", "script": { - "id": "c1bd1964-ea17-414c-98ab-18232a942352", + "id": "ebca2426-ccd2-4630-ad2f-7f36974c6af0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11172,7 +11172,7 @@ { "listen": "test", "script": { - "id": "99d71c3d-11d9-4589-a1a6-7e6ac0e413d1", + "id": "56617499-cc50-497a-9d4a-68b5bd3e1b21", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11234,7 +11234,7 @@ { "listen": "test", "script": { - "id": "2d6a11c2-f1cd-4863-8ea3-aaff7b496d37", + "id": "4b06d7ad-d115-49ae-b817-0c13c088f10c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11315,7 +11315,7 @@ { "listen": "test", "script": { - "id": "8c879a0a-9f3d-44d7-935f-9700ea075a4a", + "id": "0e163ede-e5a6-4d69-818f-9b0c5821b775", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11374,7 +11374,7 @@ { "listen": "test", "script": { - "id": "78cc0209-bf5c-40e4-8812-2ed8705ea952", + "id": "8f924eac-687b-4a75-9ebd-8b81c211db20", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -11440,7 +11440,7 @@ { "listen": "test", "script": { - "id": "d4b82be0-b7f7-4724-839e-0167d8254be3", + "id": "1175bbca-6ade-4903-b447-1dcff5c4ad88", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11489,7 +11489,7 @@ { "listen": "test", "script": { - "id": "deaeb677-41fd-46a8-878e-026659b33b85", + "id": "0647c921-6e6f-4f33-b2a4-0f23fd39f4bd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11538,7 +11538,7 @@ { "listen": "test", "script": { - "id": "5a30750f-e358-42bc-81d5-650c493c1f99", + "id": "55a81887-d09d-41ee-bbd7-965bad01ae1d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11583,7 +11583,7 @@ { "listen": "test", "script": { - "id": "64032e5f-d79e-4947-b055-7e021e238a07", + "id": "5069e425-2209-483b-8639-39cbb510acca", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11628,7 +11628,7 @@ { "listen": "test", "script": { - "id": "cbf023ee-44d3-4bd4-83b6-5571062f9509", + "id": "b3405879-cbec-41f5-9e44-c3edd43c6c73", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11673,7 +11673,7 @@ { "listen": "test", "script": { - "id": "6ebd58c6-3a21-48d1-9549-7f81ab51c932", + "id": "876578b1-e600-445b-a7a0-41164b9e28da", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11726,7 +11726,7 @@ { "listen": "test", "script": { - "id": "b95ac45b-cdee-4482-84d2-f0c844649b6c", + "id": "512d7e3e-cbfe-44b9-8ac3-ebba262aed5c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11779,7 +11779,7 @@ { "listen": "test", "script": { - "id": "2bacc554-84be-4825-8307-d4f4b7c10b1c", + "id": "a8e328bc-82e1-42c5-9839-285ccb9a94b8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11862,7 +11862,7 @@ { "listen": "prerequest", "script": { - "id": "7f712054-0215-4224-87bf-cacb473a73c5", + "id": "4c04625f-3ac3-41a3-b6ab-d29131a17f2d", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11906,7 +11906,7 @@ { "listen": "test", "script": { - "id": "40e6f6a8-bbb4-4210-9fb1-d5f55131cbb5", + "id": "999e55b8-1e6e-477a-85cf-37a1c6983af7", "type": "text/javascript", "exec": [ "" From 9f063e8260465ed8c0ebe2972f9025c57c2ede72 Mon Sep 17 00:00:00 2001 From: "Bouman,Dave D.H.M" Date: Fri, 9 Oct 2020 10:22:52 +0200 Subject: [PATCH 050/157] FIx for userproject --- ...201009082218_fixforuserproject.Designer.cs | 337 ++++++++++++++++++ .../20201009082218_fixforuserproject.cs | 17 + 2 files changed, 354 insertions(+) create mode 100644 Data/Migrations/20201009082218_fixforuserproject.Designer.cs create mode 100644 Data/Migrations/20201009082218_fixforuserproject.cs diff --git a/Data/Migrations/20201009082218_fixforuserproject.Designer.cs b/Data/Migrations/20201009082218_fixforuserproject.Designer.cs new file mode 100644 index 00000000..1f7670fa --- /dev/null +++ b/Data/Migrations/20201009082218_fixforuserproject.Designer.cs @@ -0,0 +1,337 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20201009082218_fixforuserproject")] + partial class fixforuserproject + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FollowedUserId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FollowedUserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserUser"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProject") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.HasOne("Models.User", "FollowedUser") + .WithMany("FollowedUsers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20201009082218_fixforuserproject.cs b/Data/Migrations/20201009082218_fixforuserproject.cs new file mode 100644 index 00000000..cc388723 --- /dev/null +++ b/Data/Migrations/20201009082218_fixforuserproject.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class fixforuserproject : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} From b1ab71e7a71fc83853a0f51a4a17b6bc1cf13ad1 Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 9 Oct 2020 11:47:36 +0200 Subject: [PATCH 051/157] refactored fileuploader and added tests for fileuploading --- API/Controllers/FileController.cs | 10 +-- .../FileUploader.cs | 63 +++---------------- Models/Exceptions/FileExistException.cs | 21 +++++++ Repositories.Tests/FileRepositoryTest.cs | 34 ++++++++++ Services.Tests/FileServiceTest.cs | 50 ++++++++++++++- 5 files changed, 117 insertions(+), 61 deletions(-) rename API/{Extensions => HelperClasses}/FileUploader.cs (58%) create mode 100644 Models/Exceptions/FileExistException.cs diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index d5e53ee7..78075895 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -25,6 +25,7 @@ using Microsoft.AspNetCore.Mvc; using Models; using Models.Defaults; +using Models.Exceptions; using Services.Services; using System; using System.IO; @@ -105,13 +106,14 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe DateTime uploadDateTime = DateTime.Now; int fileExtPos = fileResource.File.FileName.LastIndexOf("."); string extension = fileResource.File.FileName.Substring(fileExtPos); - string newFileName = fileUploader.RemoveSpecialCharacters(fileResource.File.FileName.Remove(fileExtPos) + Guid.NewGuid() + extension); - string path = await fileUploader.UploadSingleFile(fileResource.File, newFileName); + string newFileName = Guid.NewGuid().ToString() + extension; User user = await HttpContext.GetContextUser(userService) .ConfigureAwait(false); + File file = new File(newFileName, newFileName, user, uploadDateTime); - File file = new File(path, newFileName, user, uploadDateTime); - fileService.Add(file); + await fileUploader.UploadSingleFile(fileResource.File, newFileName); + + await fileService.AddAsync(file); fileService.Save(); return Ok(mapper.Map(file)); diff --git a/API/Extensions/FileUploader.cs b/API/HelperClasses/FileUploader.cs similarity index 58% rename from API/Extensions/FileUploader.cs rename to API/HelperClasses/FileUploader.cs index 3da3c15f..5c99d9a8 100644 --- a/API/Extensions/FileUploader.cs +++ b/API/HelperClasses/FileUploader.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Models.Exceptions; using Serilog; using System; using System.Collections.Generic; @@ -17,35 +18,13 @@ namespace API.Extensions { - /// - /// File already exists exception - /// - [Serializable] - public class FileExistException : Exception - { - /// - /// File already exist constructor - /// - /// - public FileExistException(string name) - : base($"File {name} already exists") - { } - } + /// /// Interface for file uploader /// public interface IFileUploader { - - /// - /// Remove specials characters from string - /// - /// - /// String without special characters - string RemoveSpecialCharacters(string str); - - /// /// Uploads single file /// @@ -59,7 +38,6 @@ public interface IFileUploader /// /// void DeleteFile(File file); - } /// @@ -79,25 +57,6 @@ public FileUploader(IWebHostEnvironment env) uploadPath = Path.Combine(env.WebRootPath, "Resources\\"); } - /// - /// Removes special characters for string to avoid problems - /// - /// - /// String without special characters - public string RemoveSpecialCharacters(string str) - { - StringBuilder sb = new StringBuilder(); - foreach(char c in str) - { - if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '.' || c == '_') - { - sb.Append(c); - } - } - return sb.ToString(); - } - - /// /// Uploads single file /// @@ -108,20 +67,12 @@ public async Task UploadSingleFile(IFormFile file, string fileName) { try { - if(!System.IO.File.Exists(uploadPath + fileName)) - { - await using(Stream sourceStream = file.OpenReadStream()) - { - await using(FileStream destinationStream = System.IO.File.Create(uploadPath + fileName)) - { - await sourceStream.CopyToAsync(destinationStream); - } - } - - return fileName; - } + if(System.IO.File.Exists(uploadPath + fileName)) throw new FileExistException(fileName); + await using Stream sourceStream = file.OpenReadStream(); + await using FileStream destinationStream = System.IO.File.Create(uploadPath + fileName); + await sourceStream.CopyToAsync(destinationStream); - throw new FileExistException(fileName); + return fileName; } catch(Exception e) { Log.Logger.Error(e, "Unexpected error"); diff --git a/Models/Exceptions/FileExistException.cs b/Models/Exceptions/FileExistException.cs new file mode 100644 index 00000000..03cf61fa --- /dev/null +++ b/Models/Exceptions/FileExistException.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Models.Exceptions +{ + /// + /// File already exists exception + /// + [Serializable] + public class FileExistException : Exception + { + /// + /// File already exist constructor + /// + /// + public FileExistException(string name) + : base($"File {name} already exists") + { } + } +} diff --git a/Repositories.Tests/FileRepositoryTest.cs b/Repositories.Tests/FileRepositoryTest.cs index 3709048d..a20618f3 100644 --- a/Repositories.Tests/FileRepositoryTest.cs +++ b/Repositories.Tests/FileRepositoryTest.cs @@ -19,6 +19,40 @@ public class FileRepositoryTest : RepositoryTest /// protected new IFileRepository Repository => (IFileRepository) base.Repository; + /// + [Test] + public override Task AddAsyncTest_GoodFlow([FileDataSource] File entity) + { + return base.AddAsyncTest_GoodFlow(entity); + } + + /// + [Test] + public override void AddRangeTest_BadFlow_EmptyList() + { + base.AddRangeTest_BadFlow_EmptyList(); + } + + /// + [Test] + public override void AddRangeTest_BadFlow_Null() + { + base.AddRangeTest_BadFlow_Null(); + } + + /// + [Test] + public override Task AddRangeTest_GoodFlow([FileDataSource(5)] List entities) + { + return base.AddRangeTest_GoodFlow(entities); + } + + /// + [Test] + public override void AddTest_BadFlow_Null() + { + base.AddTest_BadFlow_Null(); + } } } diff --git a/Services.Tests/FileServiceTest.cs b/Services.Tests/FileServiceTest.cs index 1289bffa..cefcf012 100644 --- a/Services.Tests/FileServiceTest.cs +++ b/Services.Tests/FileServiceTest.cs @@ -26,8 +26,56 @@ public class FileServiceTest : ServiceTest /// /// The service. /// - protected new IFileService Service => (IFileService) base.Service; + public new IFileService Service => (IFileService) base.Service; + /// + [Test] + public override void AddRangeTest_GoodFlow([FileDataSource(100)] IEnumerable entities) + { + base.AddRangeTest_GoodFlow(entities); + } + + /// + [Test] + public override void AddTest_GoodFlow([FileDataSource] File entity) + { + base.AddTest_GoodFlow(entity); + } + + /// + [Test] + public override Task GetAll([FileDataSource(100)] List entities) + { + return base.GetAll(entities); + } + + /// + [Test] + public override void Remove([FileDataSource] File entity) + { + base.Remove(entity); + } + + /// + [Test] + public Task RemoveAsync() + { + return base.RemoveAsync(1); + } + + /// + [Test] + public override void Save() + { + base.Save(); + } + + /// + [Test] + public override void Update([FileDataSource] File entity) + { + base.Update(entity); + } } } From 52a1c64e1f65a9220f40c8ceb11ef3621a575163 Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 9 Oct 2020 14:43:39 +0200 Subject: [PATCH 052/157] rename FileUploader methods --- API/HelperClasses/FileUploader.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/API/HelperClasses/FileUploader.cs b/API/HelperClasses/FileUploader.cs index 5c99d9a8..2a5d6d25 100644 --- a/API/HelperClasses/FileUploader.cs +++ b/API/HelperClasses/FileUploader.cs @@ -31,13 +31,13 @@ public interface IFileUploader /// /// /// path of file location - Task UploadSingleFile(IFormFile file, string fileName); + Task CopyFileToDirectory(IFormFile file, string fileName); /// /// Method deletes the file from the file server /// /// - void DeleteFile(File file); + void DeleteFileFromDirectory(File file); } /// @@ -63,7 +63,7 @@ public FileUploader(IWebHostEnvironment env) /// File to upload /// Name of file /// path of file location - public async Task UploadSingleFile(IFormFile file, string fileName) + public async Task CopyFileToDirectory(IFormFile file, string fileName) { try { @@ -85,7 +85,7 @@ public async Task UploadSingleFile(IFormFile file, string fileName) /// /// /// Bool which tells if file is deleted successfully or not - public void DeleteFile(File file) + public void DeleteFileFromDirectory(File file) { if(System.IO.File.Exists(Path.Combine(uploadPath, file.Name))) { From 8e91b1b18f9dfb88e32ad4e98d42d63b646eaac3 Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 9 Oct 2020 14:44:35 +0200 Subject: [PATCH 053/157] rename FileUploader methods --- API/Controllers/FileController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 78075895..fdf60cba 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -111,7 +111,7 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe .ConfigureAwait(false); File file = new File(newFileName, newFileName, user, uploadDateTime); - await fileUploader.UploadSingleFile(fileResource.File, newFileName); + await fileUploader.CopyFileToDirectory(fileResource.File, newFileName); await fileService.AddAsync(file); fileService.Save(); @@ -195,7 +195,7 @@ public async Task DeleteSingleFile(int fileId) await fileService.RemoveAsync(fileId) .ConfigureAwait(false); fileService.Save(); - fileUploader.DeleteFile(file); + fileUploader.DeleteFileFromDirectory(file); return Ok(); } catch(FileNotFoundException) { From d439a28f5f1bc39423b8fa279f9900af11da0880 Mon Sep 17 00:00:00 2001 From: Niray Date: Mon, 12 Oct 2020 09:35:35 +0200 Subject: [PATCH 054/157] updated typo and mapped File to FileResource --- API/Controllers/FileController.cs | 2 +- API/Extensions/MaxFileSizeAttribute.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index fdf60cba..cb1b096b 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -150,7 +150,7 @@ public async Task GetSingleFile(int fileId) return NotFound(problem); } - return Ok(file); + return Ok(mapper.Map(file)); } /// diff --git a/API/Extensions/MaxFileSizeAttribute.cs b/API/Extensions/MaxFileSizeAttribute.cs index 0fe6531f..ab1f9ec1 100644 --- a/API/Extensions/MaxFileSizeAttribute.cs +++ b/API/Extensions/MaxFileSizeAttribute.cs @@ -8,7 +8,7 @@ namespace API.Extensions { /// - /// Attribute fort maximum file size + /// Attribute for maximum file size /// public class MaxFileSizeAttribute : ValidationAttribute { From 8e8253502f34ecded6d84da657db3b41816f1574 Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Wed, 14 Oct 2020 14:50:05 +0200 Subject: [PATCH 055/157] Removed some old migrations and added a single new migration for this issue. --- Data/4_Data.csproj | 15 +- ...200918123151_AddedUserProjects.Designer.cs | 299 ---------------- .../20200918123151_AddedUserProjects.cs | 92 ----- ...0918124148_UpdatedUserProjects.Designer.cs | 296 --------------- .../20200918124148_UpdatedUserProjects.cs | 24 -- ...inkingTableForFollowedProjects.Designer.cs | 300 ---------------- ..._CreatedLinkingTableForFollowedProjects.cs | 52 --- ...edDBSetForUserFollowedProjects.Designer.cs | 300 ---------------- ...31414_AddedDBSetForUserFollowedProjects.cs | 107 ------ ...0200922131933_UpdatedUserModel.Designer.cs | 302 ---------------- .../20200922131933_UpdatedUserModel.cs | 52 --- ...structorForUserFollowedProject.Designer.cs | 302 ---------------- ..._AddedConstructorForUserFollowedProject.cs | 17 - ...20200929144427_InitUserProject.Designer.cs | 302 ---------------- .../20200930110730_InitUserUserTable.cs | 52 --- ...201009082218_fixforuserproject.Designer.cs | 337 ------------------ .../20201009082218_fixforuserproject.cs | 17 - ...545_AddFollowUsersAndProjects.Designer.cs} | 4 +- ...201014124545_AddFollowUsersAndProjects.cs} | 70 ++-- 19 files changed, 39 insertions(+), 2901 deletions(-) delete mode 100644 Data/Migrations/20200918123151_AddedUserProjects.Designer.cs delete mode 100644 Data/Migrations/20200918123151_AddedUserProjects.cs delete mode 100644 Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs delete mode 100644 Data/Migrations/20200918124148_UpdatedUserProjects.cs delete mode 100644 Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs delete mode 100644 Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs delete mode 100644 Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs delete mode 100644 Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs delete mode 100644 Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs delete mode 100644 Data/Migrations/20200922131933_UpdatedUserModel.cs delete mode 100644 Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs delete mode 100644 Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs delete mode 100644 Data/Migrations/20200929144427_InitUserProject.Designer.cs delete mode 100644 Data/Migrations/20200930110730_InitUserUserTable.cs delete mode 100644 Data/Migrations/20201009082218_fixforuserproject.Designer.cs delete mode 100644 Data/Migrations/20201009082218_fixforuserproject.cs rename Data/Migrations/{20200930110730_InitUserUserTable.Designer.cs => 20201014124545_AddFollowUsersAndProjects.Designer.cs} (99%) rename Data/Migrations/{20200929144427_InitUserProject.cs => 20201014124545_AddFollowUsersAndProjects.cs} (73%) diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index 296ba1ec..c7e71205 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -5,20 +5,7 @@ 8 - - - - - - - - - - - - - - + diff --git a/Data/Migrations/20200918123151_AddedUserProjects.Designer.cs b/Data/Migrations/20200918123151_AddedUserProjects.Designer.cs deleted file mode 100644 index c21905b5..00000000 --- a/Data/Migrations/20200918123151_AddedUserProjects.Designer.cs +++ /dev/null @@ -1,299 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200918123151_AddedUserProjects")] - partial class AddedUserProjects - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("IdentityId") - .HasColumnType("int"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserProject"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("FollowedProject") - .HasForeignKey("UserId"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200918123151_AddedUserProjects.cs b/Data/Migrations/20200918123151_AddedUserProjects.cs deleted file mode 100644 index 98dfe900..00000000 --- a/Data/Migrations/20200918123151_AddedUserProjects.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class AddedUserProjects : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_RoleScope_Role_RoleId", - table: "RoleScope"); - - migrationBuilder.AlterColumn( - name: "RoleId", - table: "RoleScope", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldNullable: true); - - migrationBuilder.CreateTable( - name: "UserProject", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - IdentityId = table.Column(nullable: false), - UserId = table.Column(nullable: true), - ProjectId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_UserProject", x => x.Id); - table.ForeignKey( - name: "FK_UserProject_Project_ProjectId", - column: x => x.ProjectId, - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_UserProject_User_UserId", - column: x => x.UserId, - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserProject_ProjectId", - table: "UserProject", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_UserProject_UserId", - table: "UserProject", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_RoleScope_Role_RoleId", - table: "RoleScope", - column: "RoleId", - principalTable: "Role", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_RoleScope_Role_RoleId", - table: "RoleScope"); - - migrationBuilder.DropTable( - name: "UserProject"); - - migrationBuilder.AlterColumn( - name: "RoleId", - table: "RoleScope", - type: "int", - nullable: true, - oldClrType: typeof(int)); - - migrationBuilder.AddForeignKey( - name: "FK_RoleScope_Role_RoleId", - table: "RoleScope", - column: "RoleId", - principalTable: "Role", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs b/Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs deleted file mode 100644 index 040dd275..00000000 --- a/Data/Migrations/20200918124148_UpdatedUserProjects.Designer.cs +++ /dev/null @@ -1,296 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200918124148_UpdatedUserProjects")] - partial class UpdatedUserProjects - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserProject"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("FollowedProject") - .HasForeignKey("UserId"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200918124148_UpdatedUserProjects.cs b/Data/Migrations/20200918124148_UpdatedUserProjects.cs deleted file mode 100644 index 58567cb3..00000000 --- a/Data/Migrations/20200918124148_UpdatedUserProjects.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class UpdatedUserProjects : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IdentityId", - table: "UserProject"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IdentityId", - table: "UserProject", - type: "int", - nullable: false, - defaultValue: 0); - } - } -} diff --git a/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs b/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs deleted file mode 100644 index a0439de1..00000000 --- a/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.Designer.cs +++ /dev/null @@ -1,300 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200922130428_CreatedLinkingTableForFollowedProjects")] - partial class CreatedLinkingTableForFollowedProjects - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserFollowedProject"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserFollowedProjects") - .HasForeignKey("UserId"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs b/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs deleted file mode 100644 index cfb02159..00000000 --- a/Data/Migrations/20200922130428_CreatedLinkingTableForFollowedProjects.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class CreatedLinkingTableForFollowedProjects : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "UserFollowedProject", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(nullable: true), - UserId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_UserFollowedProject", x => x.Id); - table.ForeignKey( - name: "FK_UserFollowedProject_Project_ProjectId", - column: x => x.ProjectId, - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_UserFollowedProject_User_UserId", - column: x => x.UserId, - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserFollowedProject_ProjectId", - table: "UserFollowedProject", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_UserFollowedProject_UserId", - table: "UserFollowedProject", - column: "UserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserFollowedProject"); - } - } -} diff --git a/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs b/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs deleted file mode 100644 index 2a4b653b..00000000 --- a/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.Designer.cs +++ /dev/null @@ -1,300 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200922131414_AddedDBSetForUserFollowedProjects")] - partial class AddedDBSetForUserFollowedProjects - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserFollowedProjects"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserFollowedProjects") - .HasForeignKey("UserId"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs b/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs deleted file mode 100644 index 6e95a836..00000000 --- a/Data/Migrations/20200922131414_AddedDBSetForUserFollowedProjects.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class AddedDBSetForUserFollowedProjects : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserFollowedProject_Project_ProjectId", - table: "UserFollowedProject"); - - migrationBuilder.DropForeignKey( - name: "FK_UserFollowedProject_User_UserId", - table: "UserFollowedProject"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserFollowedProject", - table: "UserFollowedProject"); - - migrationBuilder.RenameTable( - name: "UserFollowedProject", - newName: "UserFollowedProjects"); - - migrationBuilder.RenameIndex( - name: "IX_UserFollowedProject_UserId", - table: "UserFollowedProjects", - newName: "IX_UserFollowedProjects_UserId"); - - migrationBuilder.RenameIndex( - name: "IX_UserFollowedProject_ProjectId", - table: "UserFollowedProjects", - newName: "IX_UserFollowedProjects_ProjectId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserFollowedProjects", - table: "UserFollowedProjects", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_UserFollowedProjects_Project_ProjectId", - table: "UserFollowedProjects", - column: "ProjectId", - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_UserFollowedProjects_User_UserId", - table: "UserFollowedProjects", - column: "UserId", - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserFollowedProjects_Project_ProjectId", - table: "UserFollowedProjects"); - - migrationBuilder.DropForeignKey( - name: "FK_UserFollowedProjects_User_UserId", - table: "UserFollowedProjects"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserFollowedProjects", - table: "UserFollowedProjects"); - - migrationBuilder.RenameTable( - name: "UserFollowedProjects", - newName: "UserFollowedProject"); - - migrationBuilder.RenameIndex( - name: "IX_UserFollowedProjects_UserId", - table: "UserFollowedProject", - newName: "IX_UserFollowedProject_UserId"); - - migrationBuilder.RenameIndex( - name: "IX_UserFollowedProjects_ProjectId", - table: "UserFollowedProject", - newName: "IX_UserFollowedProject_ProjectId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserFollowedProject", - table: "UserFollowedProject", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_UserFollowedProject_Project_ProjectId", - table: "UserFollowedProject", - column: "ProjectId", - principalTable: "Project", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_UserFollowedProject_User_UserId", - table: "UserFollowedProject", - column: "UserId", - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs b/Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs deleted file mode 100644 index 1e0f88cd..00000000 --- a/Data/Migrations/20200922131933_UpdatedUserModel.Designer.cs +++ /dev/null @@ -1,302 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200922131933_UpdatedUserModel")] - partial class UpdatedUserModel - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserFollowedProjects"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserFollowedProjects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200922131933_UpdatedUserModel.cs b/Data/Migrations/20200922131933_UpdatedUserModel.cs deleted file mode 100644 index e313dc34..00000000 --- a/Data/Migrations/20200922131933_UpdatedUserModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class UpdatedUserModel : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserFollowedProjects_User_UserId", - table: "UserFollowedProjects"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "UserFollowedProjects", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_UserFollowedProjects_User_UserId", - table: "UserFollowedProjects", - column: "UserId", - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserFollowedProjects_User_UserId", - table: "UserFollowedProjects"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "UserFollowedProjects", - type: "int", - nullable: true, - oldClrType: typeof(int)); - - migrationBuilder.AddForeignKey( - name: "FK_UserFollowedProjects_User_UserId", - table: "UserFollowedProjects", - column: "UserId", - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs b/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs deleted file mode 100644 index d5d87dbd..00000000 --- a/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.Designer.cs +++ /dev/null @@ -1,302 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200924132339_AddedConstructorForUserFollowedProject")] - partial class AddedConstructorForUserFollowedProject - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserFollowedProjects"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserFollowedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserFollowedProjects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs b/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs deleted file mode 100644 index 8a8a9d67..00000000 --- a/Data/Migrations/20200924132339_AddedConstructorForUserFollowedProject.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class AddedConstructorForUserFollowedProject : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Data/Migrations/20200929144427_InitUserProject.Designer.cs b/Data/Migrations/20200929144427_InitUserProject.Designer.cs deleted file mode 100644 index 0a9d98ae..00000000 --- a/Data/Migrations/20200929144427_InitUserProject.Designer.cs +++ /dev/null @@ -1,302 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200929144427_InitUserProject")] - partial class InitUserProject - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserProject"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserProject") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200930110730_InitUserUserTable.cs b/Data/Migrations/20200930110730_InitUserUserTable.cs deleted file mode 100644 index 5bd854e0..00000000 --- a/Data/Migrations/20200930110730_InitUserUserTable.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class InitUserUserTable : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "UserUser", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(nullable: true), - FollowedUserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserUser", x => x.Id); - table.ForeignKey( - name: "FK_UserUser_User_FollowedUserId", - column: x => x.FollowedUserId, - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_UserUser_User_UserId", - column: x => x.UserId, - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserUser_FollowedUserId", - table: "UserUser", - column: "FollowedUserId"); - - migrationBuilder.CreateIndex( - name: "IX_UserUser_UserId", - table: "UserUser", - column: "UserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserUser"); - } - } -} diff --git a/Data/Migrations/20201009082218_fixforuserproject.Designer.cs b/Data/Migrations/20201009082218_fixforuserproject.Designer.cs deleted file mode 100644 index 1f7670fa..00000000 --- a/Data/Migrations/20201009082218_fixforuserproject.Designer.cs +++ /dev/null @@ -1,337 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20201009082218_fixforuserproject")] - partial class fixforuserproject - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("UserProject"); - }); - - modelBuilder.Entity("Models.UserUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FollowedUserId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("FollowedUserId"); - - b.HasIndex("UserId"); - - b.ToTable("UserUser"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); - - modelBuilder.Entity("Models.UserProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId"); - - b.HasOne("Models.User", "User") - .WithMany("UserProject") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.UserUser", b => - { - b.HasOne("Models.User", "FollowedUser") - .WithMany("FollowedUsers") - .HasForeignKey("FollowedUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20201009082218_fixforuserproject.cs b/Data/Migrations/20201009082218_fixforuserproject.cs deleted file mode 100644 index cc388723..00000000 --- a/Data/Migrations/20201009082218_fixforuserproject.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class fixforuserproject : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Data/Migrations/20200930110730_InitUserUserTable.Designer.cs b/Data/Migrations/20201014124545_AddFollowUsersAndProjects.Designer.cs similarity index 99% rename from Data/Migrations/20200930110730_InitUserUserTable.Designer.cs rename to Data/Migrations/20201014124545_AddFollowUsersAndProjects.Designer.cs index 79543ecc..554341da 100644 --- a/Data/Migrations/20200930110730_InitUserUserTable.Designer.cs +++ b/Data/Migrations/20201014124545_AddFollowUsersAndProjects.Designer.cs @@ -10,8 +10,8 @@ namespace _4_Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20200930110730_InitUserUserTable")] - partial class InitUserUserTable + [Migration("20201014124545_AddFollowUsersAndProjects")] + partial class AddFollowUsersAndProjects { protected override void BuildTargetModel(ModelBuilder modelBuilder) { diff --git a/Data/Migrations/20200929144427_InitUserProject.cs b/Data/Migrations/20201014124545_AddFollowUsersAndProjects.cs similarity index 73% rename from Data/Migrations/20200929144427_InitUserProject.cs rename to Data/Migrations/20201014124545_AddFollowUsersAndProjects.cs index 31a58752..af4ff07a 100644 --- a/Data/Migrations/20200929144427_InitUserProject.cs +++ b/Data/Migrations/20201014124545_AddFollowUsersAndProjects.cs @@ -1,12 +1,11 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace _4_Data.Migrations { - public partial class InitUserProject : Migration + public partial class AddFollowUsersAndProjects : Migration { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.CreateTable( name: "UserProject", columns: table => new @@ -33,57 +32,60 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateIndex( - name: "IX_UserProject_ProjectId", - table: "UserProject", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_UserProject_UserId", - table: "UserProject", - column: "UserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserProject"); - migrationBuilder.CreateTable( - name: "UserFollowedProjects", + name: "UserUser", columns: table => new { - Id = table.Column(type: "int", nullable: false) + Id = table.Column(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(type: "int", nullable: true), - UserId = table.Column(type: "int", nullable: false) + UserId = table.Column(nullable: true), + FollowedUserId = table.Column(nullable: false) }, constraints: table => { - table.PrimaryKey("PK_UserFollowedProjects", x => x.Id); + table.PrimaryKey("PK_UserUser", x => x.Id); table.ForeignKey( - name: "FK_UserFollowedProjects_Project_ProjectId", - column: x => x.ProjectId, - principalTable: "Project", + name: "FK_UserUser_User_FollowedUserId", + column: x => x.FollowedUserId, + principalTable: "User", principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_UserFollowedProjects_User_UserId", + name: "FK_UserUser_User_UserId", column: x => x.UserId, principalTable: "User", principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( - name: "IX_UserFollowedProjects_ProjectId", - table: "UserFollowedProjects", + name: "IX_UserProject_ProjectId", + table: "UserProject", column: "ProjectId"); migrationBuilder.CreateIndex( - name: "IX_UserFollowedProjects_UserId", - table: "UserFollowedProjects", + name: "IX_UserProject_UserId", + table: "UserProject", column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_UserUser_FollowedUserId", + table: "UserUser", + column: "FollowedUserId"); + + migrationBuilder.CreateIndex( + name: "IX_UserUser_UserId", + table: "UserUser", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "UserProject"); + + migrationBuilder.DropTable( + name: "UserUser"); } } } From 023aaf353df8c39755af4bd383b2979dd4a50aca Mon Sep 17 00:00:00 2001 From: Niray Date: Thu, 15 Oct 2020 12:25:46 +0200 Subject: [PATCH 056/157] adjustments made relevant for merge --- API/Controllers/FileController.cs | 28 ++++++++++++++++++---------- API/Controllers/ProjectController.cs | 3 ++- Postman/dex.postman_collection.json | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index cb1b096b..465803a0 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -29,6 +29,8 @@ using Services.Services; using System; using System.IO; +using System.Net; +using System.Net.Http; using File = Models.File; namespace API.Controllers @@ -64,21 +66,13 @@ public FileController(IFileService fileService, IMapper mapper, IFileUploader fi /// Get all files /// /// A response and list of files. + /// This endpoint returns all projects. [HttpGet] [Authorize] + [ProducesResponseType(typeof(IEnumerable), (int) HttpStatusCode.OK)] public async Task GetFilesAsync() { IEnumerable files = await fileService.GetAll(); - if(!files.Any()) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting files.", - Detail = "The database does not contain any files.", - Instance = "47525791-57C4-4DE2-91B1-90086D893112" - }; - return NotFound(problem); - } return Ok(mapper.Map, IEnumerable>(files)); } @@ -87,8 +81,13 @@ public async Task GetFilesAsync() /// Uploads a single file /// /// HTTP Response + /// This endpoint returns all files. + /// The 400 bad request is returned when a file is null. [HttpPost] [Authorize] + [Consumes("multipart/form-data")] + [ProducesResponseType(typeof(FileResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] public async Task UploadSingleFile([FromForm] FileResource fileResource) { if(fileResource.File == null) @@ -133,8 +132,11 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe /// Find file by id /// /// + ///This endpoint returns one single file. /// File [HttpGet("{fileId}")] + [ProducesResponseType(typeof(FileResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetSingleFile(int fileId) { File file = await fileService.FindAsync(fileId); @@ -157,9 +159,15 @@ public async Task GetSingleFile(int fileId) /// Deletes single file /// /// + /// This endpoint deletes one single file. + /// The 404 Not Found response is returned when the file was not found. + /// The 401 Not Authorized response is returned when the user does not have the right credentials. /// [HttpDelete("{fileId}")] [Authorize] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] public async Task DeleteSingleFile(int fileId) { File file = await fileService.FindAsync(fileId); diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index f7063148..41c617bb 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -51,8 +51,9 @@ public class ProjectController : ControllerBase /// /// The project service which is used to communicate with the logic layer. /// The user service which is used to communicate with the logic layer. + /// The file service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. - public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper) + public ProjectController(IProjectService projectService, IUserService userService, IFileService fileService, IMapper mapper) { this.projectService = projectService; this.userService = userService; diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 264db771..58b13f37 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1168,7 +1168,7 @@ "", "function findProjectId(jsonData, item) {", " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].project.id == item) {", + " if (jsonData[i].projectId == item) {", " return i;", " }", " }", From a0dda57d8d17e10aedbbbf7bd726e643da4cbc66 Mon Sep 17 00:00:00 2001 From: Niray Date: Thu, 15 Oct 2020 12:30:14 +0200 Subject: [PATCH 057/157] changed changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0efb314a..fc5a4bd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added a fileuploader which gives the opportunity to upload files and icons - [#217] (https://github.com/DigitalExcellence/dex-backend/issues/217) + ### Changed ### Deprecated @@ -28,7 +30,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added descriptions for Project Highlights - [#219](https://github.com/DigitalExcellence/dex-backend/issues/219) -- Added a fileuploader which gives the opportunity to upload files and icons - [#217] (https://github.com/DigitalExcellence/dex-backend/issues/217) ### Changed From 9c9cd1b93f84cd1e30f1659877a0cb8ef50bbac9 Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 16 Oct 2020 11:35:27 +0200 Subject: [PATCH 058/157] Move startup.cs UseStaticFiles to the correct location. --- API/Startup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/API/Startup.cs b/API/Startup.cs index 5edc5fb6..5a43a22c 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -223,6 +223,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseProblemDetails(); + app.UseStaticFiles(); + app.UseRouting(); app.UseCors(c => { @@ -303,7 +305,6 @@ await next() o.OAuthClientId(Config.Swagger.ClientId); }); - app.UseStaticFiles(); } /// From 78855e8eb67852429cc763d71750aeb45e65211a Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 16 Oct 2020 11:41:36 +0200 Subject: [PATCH 059/157] Clean up migrations and make UploaderId required --- Data/4_Data.csproj | 7 +- .../20200916082905_AddFileModel.Designer.cs | 292 ----------------- .../Migrations/20200916082905_AddFileModel.cs | 33 -- ...AddFileReferenceToProjectTable.Designer.cs | 301 ------------------ ...17082653_AddFileReferenceToProjectTable.cs | 43 --- .../20200918105547_ChangedProjectModel.cs | 110 ------- ...FilesAndProjectIconReferences.Designer.cs} | 10 +- ...093942_AddFilesAndProjectIconReferences.cs | 74 +++++ .../ApplicationDbContextModelSnapshot.cs | 6 +- Models/File.cs | 3 +- 10 files changed, 86 insertions(+), 793 deletions(-) delete mode 100644 Data/Migrations/20200916082905_AddFileModel.Designer.cs delete mode 100644 Data/Migrations/20200916082905_AddFileModel.cs delete mode 100644 Data/Migrations/20200917082653_AddFileReferenceToProjectTable.Designer.cs delete mode 100644 Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs delete mode 100644 Data/Migrations/20200918105547_ChangedProjectModel.cs rename Data/Migrations/{20200918105547_ChangedProjectModel.Designer.cs => 20201016093942_AddFilesAndProjectIconReferences.Designer.cs} (97%) create mode 100644 Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index e141532c..c7e71205 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -5,12 +5,7 @@ 8 - - - - - - + diff --git a/Data/Migrations/20200916082905_AddFileModel.Designer.cs b/Data/Migrations/20200916082905_AddFileModel.Designer.cs deleted file mode 100644 index 8f692cb9..00000000 --- a/Data/Migrations/20200916082905_AddFileModel.Designer.cs +++ /dev/null @@ -1,292 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200916082905_AddFileModel")] - partial class AddFileModel - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Path") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UploadDateTime") - .HasColumnType("datetime2"); - - b.Property("UploaderId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("File"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200916082905_AddFileModel.cs b/Data/Migrations/20200916082905_AddFileModel.cs deleted file mode 100644 index e538395e..00000000 --- a/Data/Migrations/20200916082905_AddFileModel.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class AddFileModel : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "File", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Path = table.Column(nullable: false), - UploadDateTime = table.Column(nullable: false), - Name = table.Column(nullable: true), - UploaderId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_File", x => x.Id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "File"); - } - } -} diff --git a/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.Designer.cs b/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.Designer.cs deleted file mode 100644 index 3778d67f..00000000 --- a/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.Designer.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -using System; -using Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace _4_Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200917082653_AddFileReferenceToProjectTable")] - partial class AddFileReferenceToProjectTable - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("FullName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Role") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Collaborators"); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Guid") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UserId"); - - b.ToTable("EmbeddedProject"); - }); - - modelBuilder.Entity("Models.File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Path") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UploadDateTime") - .HasColumnType("datetime2"); - - b.Property("UploaderId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("File"); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Highlight"); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectIconFileIdId") - .HasColumnType("int"); - - b.Property("ShortDescription") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetime2"); - - b.Property("Uri") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProjectIconFileIdId"); - - b.HasIndex("UserId"); - - b.ToTable("Project"); - }); - - modelBuilder.Entity("Models.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Role"); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("RoleId") - .HasColumnType("int"); - - b.Property("Scope") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleScope"); - }); - - modelBuilder.Entity("Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsPublic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProfileUrl") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("User"); - }); - - modelBuilder.Entity("Models.Collaborator", b => - { - b.HasOne("Models.Project", null) - .WithMany("Collaborators") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.EmbeddedProject", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Models.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Highlight", b => - { - b.HasOne("Models.Project", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.Project", b => - { - b.HasOne("Models.File", "ProjectIconFileId") - .WithMany() - .HasForeignKey("ProjectIconFileIdId"); - - b.HasOne("Models.User", "User") - .WithMany("Projects") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.RoleScope", b => - { - b.HasOne("Models.Role", null) - .WithMany("Scopes") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Models.User", b => - { - b.HasOne("Models.Role", "Role") - .WithMany() - .HasForeignKey("RoleId"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs b/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs deleted file mode 100644 index f48b25ca..00000000 --- a/Data/Migrations/20200917082653_AddFileReferenceToProjectTable.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class AddFileReferenceToProjectTable : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ProjectIconFileIdId", - table: "Project", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Project_ProjectIconFileIdId", - table: "Project", - column: "ProjectIconFileIdId"); - - migrationBuilder.AddForeignKey( - name: "FK_Project_File_ProjectIconFileIdId", - table: "Project", - column: "ProjectIconFileIdId", - principalTable: "File", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Project_File_ProjectIconFileIdId", - table: "Project"); - - migrationBuilder.DropIndex( - name: "IX_Project_ProjectIconFileIdId", - table: "Project"); - - migrationBuilder.DropColumn( - name: "ProjectIconFileIdId", - table: "Project"); - } - } -} diff --git a/Data/Migrations/20200918105547_ChangedProjectModel.cs b/Data/Migrations/20200918105547_ChangedProjectModel.cs deleted file mode 100644 index a801b43c..00000000 --- a/Data/Migrations/20200918105547_ChangedProjectModel.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace _4_Data.Migrations -{ - public partial class ChangedProjectModel : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Project_File_ProjectIconFileIdId", - table: "Project"); - - migrationBuilder.DropIndex( - name: "IX_Project_ProjectIconFileIdId", - table: "Project"); - - migrationBuilder.DropColumn( - name: "ProjectIconFileIdId", - table: "Project"); - - migrationBuilder.AddColumn( - name: "ProjectIconId", - table: "Project", - nullable: true); - - migrationBuilder.AlterColumn( - name: "UploaderId", - table: "File", - nullable: true, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.CreateIndex( - name: "IX_Project_ProjectIconId", - table: "Project", - column: "ProjectIconId"); - - migrationBuilder.CreateIndex( - name: "IX_File_UploaderId", - table: "File", - column: "UploaderId"); - - migrationBuilder.AddForeignKey( - name: "FK_File_User_UploaderId", - table: "File", - column: "UploaderId", - principalTable: "User", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Project_File_ProjectIconId", - table: "Project", - column: "ProjectIconId", - principalTable: "File", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_File_User_UploaderId", - table: "File"); - - migrationBuilder.DropForeignKey( - name: "FK_Project_File_ProjectIconId", - table: "Project"); - - migrationBuilder.DropIndex( - name: "IX_Project_ProjectIconId", - table: "Project"); - - migrationBuilder.DropIndex( - name: "IX_File_UploaderId", - table: "File"); - - migrationBuilder.DropColumn( - name: "ProjectIconId", - table: "Project"); - - migrationBuilder.AddColumn( - name: "ProjectIconFileIdId", - table: "Project", - type: "int", - nullable: true); - - migrationBuilder.AlterColumn( - name: "UploaderId", - table: "File", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Project_ProjectIconFileIdId", - table: "Project", - column: "ProjectIconFileIdId"); - - migrationBuilder.AddForeignKey( - name: "FK_Project_File_ProjectIconFileIdId", - table: "Project", - column: "ProjectIconFileIdId", - principalTable: "File", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/Data/Migrations/20200918105547_ChangedProjectModel.Designer.cs b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.Designer.cs similarity index 97% rename from Data/Migrations/20200918105547_ChangedProjectModel.Designer.cs rename to Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.Designer.cs index 15e6a5e6..aa679b60 100644 --- a/Data/Migrations/20200918105547_ChangedProjectModel.Designer.cs +++ b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.Designer.cs @@ -10,8 +10,8 @@ namespace _4_Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20200918105547_ChangedProjectModel")] - partial class ChangedProjectModel + [Migration("20201016093942_AddFilesAndProjectIconReferences")] + partial class AddFilesAndProjectIconReferences { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -86,7 +86,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("UploadDateTime") .HasColumnType("datetime2"); - b.Property("UploaderId") + b.Property("UploaderId") .HasColumnType("int"); b.HasKey("Id"); @@ -264,7 +264,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.HasOne("Models.User", "Uploader") .WithMany() - .HasForeignKey("UploaderId"); + .HasForeignKey("UploaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Models.Highlight", b => diff --git a/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs new file mode 100644 index 00000000..45e14ef4 --- /dev/null +++ b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs @@ -0,0 +1,74 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class AddFilesAndProjectIconReferences : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectIconId", + table: "Project", + nullable: true); + + migrationBuilder.CreateTable( + name: "File", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Path = table.Column(nullable: false), + UploadDateTime = table.Column(nullable: false), + Name = table.Column(nullable: true), + UploaderId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_File", x => x.Id); + table.ForeignKey( + name: "FK_File_User_UploaderId", + column: x => x.UploaderId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Project_ProjectIconId", + table: "Project", + column: "ProjectIconId"); + + migrationBuilder.CreateIndex( + name: "IX_File_UploaderId", + table: "File", + column: "UploaderId"); + + migrationBuilder.AddForeignKey( + name: "FK_Project_File_ProjectIconId", + table: "Project", + column: "ProjectIconId", + principalTable: "File", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Project_File_ProjectIconId", + table: "Project"); + + migrationBuilder.DropTable( + name: "File"); + + migrationBuilder.DropIndex( + name: "IX_Project_ProjectIconId", + table: "Project"); + + migrationBuilder.DropColumn( + name: "ProjectIconId", + table: "Project"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index fe3ab4fa..c42c021f 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -84,7 +84,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("UploadDateTime") .HasColumnType("datetime2"); - b.Property("UploaderId") + b.Property("UploaderId") .HasColumnType("int"); b.HasKey("Id"); @@ -262,7 +262,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasOne("Models.User", "Uploader") .WithMany() - .HasForeignKey("UploaderId"); + .HasForeignKey("UploaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Models.Highlight", b => diff --git a/Models/File.cs b/Models/File.cs index a391f2e4..4739a63e 100644 --- a/Models/File.cs +++ b/Models/File.cs @@ -16,9 +16,7 @@ */ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Text; namespace Models { @@ -39,6 +37,7 @@ public File(string path, string name, User uploader, DateTime uploadDateTime) public string Path { get; set; } public DateTime UploadDateTime { get; set; } public string Name { get; set; } + [Required] public User Uploader { get; set; } } From 68e27a48e5de8d2a901f5410a2ff34680f2abd5a Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 16 Oct 2020 11:53:16 +0200 Subject: [PATCH 060/157] Show UploaderId in FileResourceResult Also cleaned up some unused imports. --- API/Configuration/MappingProfile.cs | 3 ++- API/Controllers/FileController.cs | 4 +--- API/Resources/FileResource.cs | 5 ----- API/Resources/FileResourceResult.cs | 9 +++++---- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index ff1e6a04..7bb26f6d 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -58,7 +58,8 @@ public MappingProfile() CreateMap(); CreateMap(); - CreateMap(); + CreateMap().ForMember(e => e.UploaderUserId, + opt => opt.MapFrom(e => e.Uploader.Id)); CreateMap(); CreateMap(); diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 465803a0..48c6b53b 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -20,7 +20,6 @@ using AutoMapper; using Microsoft.AspNetCore.Authorization; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Models; @@ -30,7 +29,6 @@ using System; using System.IO; using System.Net; -using System.Net.Http; using File = Models.File; namespace API.Controllers @@ -105,7 +103,7 @@ public async Task UploadSingleFile([FromForm] FileResource fileRe DateTime uploadDateTime = DateTime.Now; int fileExtPos = fileResource.File.FileName.LastIndexOf("."); string extension = fileResource.File.FileName.Substring(fileExtPos); - string newFileName = Guid.NewGuid().ToString() + extension; + string newFileName = Guid.NewGuid() + extension; User user = await HttpContext.GetContextUser(userService) .ConfigureAwait(false); File file = new File(newFileName, newFileName, user, uploadDateTime); diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs index 9f30dd42..cb4feb44 100644 --- a/API/Resources/FileResource.cs +++ b/API/Resources/FileResource.cs @@ -17,12 +17,7 @@ using API.Extensions; using Microsoft.AspNetCore.Http; -using Models; -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace API.Resources { diff --git a/API/Resources/FileResourceResult.cs b/API/Resources/FileResourceResult.cs index e16c42c9..71b9e435 100644 --- a/API/Resources/FileResourceResult.cs +++ b/API/Resources/FileResourceResult.cs @@ -16,9 +16,6 @@ */ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace API.Resources { @@ -44,6 +41,10 @@ public class FileResourceResult /// File name /// public string Name { get; set; } - + /// + /// User Id that uploaded the file + /// + public int UploaderUserId { get; set; } + } } From f5c0a3b2bfa7c34bd3eb08700ede3171698dd5b4 Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 16 Oct 2020 11:54:56 +0200 Subject: [PATCH 061/157] Small update to controller documentation --- API/Controllers/FileController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 48c6b53b..672571cd 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -34,7 +34,8 @@ namespace API.Controllers { /// - /// File controller for files + /// This class is responsible for handling HTTP requests that are related + /// to file uploading, for example creating, retrieving or deleting. /// [Route("api/[controller]")] [ApiController] From 168306b1725601fe0baad5feaaafcb327930daa6 Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 16 Oct 2020 11:58:03 +0200 Subject: [PATCH 062/157] Fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a564a265..2842499e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Added a fileuploader which gives the opportunity to upload files and icons - [#217] (https://github.com/DigitalExcellence/dex-backend/issues/217) +- Added a fileuploader which gives the opportunity to upload files and icons - [#217](https://github.com/DigitalExcellence/dex-backend/issues/217) ### Changed From f879bde2ade3809b5ec32d3da8f652c5b11fc10b Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 16 Oct 2020 14:58:23 +0200 Subject: [PATCH 063/157] Updated project highlight resource result --- API/Resources/ProjectHighlightResourceResult.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/API/Resources/ProjectHighlightResourceResult.cs b/API/Resources/ProjectHighlightResourceResult.cs index fc4cf876..b24dc21c 100644 --- a/API/Resources/ProjectHighlightResourceResult.cs +++ b/API/Resources/ProjectHighlightResourceResult.cs @@ -21,5 +21,10 @@ public class ProjectHighlightResourceResult /// This gets or sets the Short Description /// public string ShortDescription { get; set; } + + /// + /// This gets or set the file of the project + /// + public FileResourceResult ProjectIcon { get; set; } } } From 185dce72c255021ebb54c81703cedc234d332771 Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 16 Oct 2020 15:35:38 +0200 Subject: [PATCH 064/157] Updated highlight repository to include project icon --- Repositories/HighlightRepository.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Repositories/HighlightRepository.cs b/Repositories/HighlightRepository.cs index ad5f770b..2235ca20 100644 --- a/Repositories/HighlightRepository.cs +++ b/Repositories/HighlightRepository.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -80,6 +80,7 @@ public override async Task FindAsync(int id) Highlight project = await GetDbSet() .Where(s => s.Id == id) .Include(p => p.Project) + .Include(p => p.Project.ProjectIcon) .SingleOrDefaultAsync(); return RedactUser(project); @@ -95,6 +96,7 @@ public async Task> GetHighlightsAsync() .Where(s => s.StartDate <= DateTime.Now || s.StartDate == null) .Where(s => s.EndDate >= DateTime.Now || s.EndDate == null) .Include(p => p.Project) + .Include(p => p.Project.ProjectIcon) .ToListAsync(); return RedactUser(highlights); } @@ -104,6 +106,7 @@ public async Task> GetHighlightsByProjectIdAsync(int projectId) return await GetDbSet() .Where(s => s.ProjectId == projectId) .Include(p => p.Project) + .Include(p => p.Project.ProjectIcon) .ToListAsync(); } } From d109b15955262a7f663c82940db5d01a62cf330a Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 16 Oct 2020 13:25:04 +0200 Subject: [PATCH 065/157] Revert "Merge remote-tracking branch 'origin/feature/228-follow-users-projects' into feature/228-follow-users-projects" This reverts commit b01870457906642a931944e99814719d18371715. --- .github/workflows/production-deployment.yml | 11 +- .github/workflows/staging-deployment.yml | 7 +- API/Configuration/MappingProfile.cs | 5 +- API/Controllers/EmbedController.cs | 93 +++++++++------ API/Controllers/HighlightController.cs | 104 ++++++++++------- API/Controllers/ProjectController.cs | 57 +++++++--- API/Controllers/RoleController.cs | 107 +++++++++++------- API/Controllers/SearchController.cs | 24 ++-- API/Controllers/UserController.cs | 83 +++++++++----- API/Controllers/WizardController.cs | 41 +++---- API/Filters/DefaultOperationFilter.cs | 46 ++++++++ API/Resources/HighlightResourceResult.cs | 16 ++- .../ProjectHighlightResourceResult.cs | 25 ++++ API/Startup.cs | 20 ++-- CHANGELOG.md | 3 +- IdentityServer/Configuration/Config.cs | 4 + .../Configuration/IdentityConfig.cs | 12 +- IdentityServer/Dockerfile | 6 +- IdentityServer/Dockerfile.dev | 3 + IdentityServer/Startup.cs | 8 +- IdentityServer/appsettings.Development.json | 1 + IdentityServer/appsettings.json | 1 + Postman/dex.postman_collection.json | 20 +--- docker-compose.deploy.yml | 1 + 24 files changed, 462 insertions(+), 236 deletions(-) create mode 100644 API/Filters/DefaultOperationFilter.cs create mode 100644 API/Resources/ProjectHighlightResourceResult.cs diff --git a/.github/workflows/production-deployment.yml b/.github/workflows/production-deployment.yml index f4734d7e..eac32638 100644 --- a/.github/workflows/production-deployment.yml +++ b/.github/workflows/production-deployment.yml @@ -1,6 +1,6 @@ name: Production Deployment -on: +on: push: branches: [ master ] @@ -16,10 +16,15 @@ jobs: run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} - name: Push docker images to dockerhub run: docker-compose -f docker-compose.deploy.yml push - - name: Push to server + - name: Push to server uses: appleboy/ssh-action@master with: host: ${{ secrets.PRODUCTION_VPS_IP }} username: ${{ secrets.PRODUCTION_VPS_USERNAME }} password: ${{ secrets.PRODUCTION_VPS_PASSWORD }} - script: cd ~/docker_compose && docker-compose down && docker-compose pull && docker-compose up --build -d \ No newline at end of file + script: | + cd ~/docker_compose + docker-compose down + docker-compose pull + sleep 10s + docker-compose up -d diff --git a/.github/workflows/staging-deployment.yml b/.github/workflows/staging-deployment.yml index e1545dad..e6d2502d 100644 --- a/.github/workflows/staging-deployment.yml +++ b/.github/workflows/staging-deployment.yml @@ -22,4 +22,9 @@ jobs: host: ${{ secrets.STAGING_VPS_IP }} username: ${{ secrets.STAGING_VPS_USERNAME }} password: ${{ secrets.STAGING_VPS_PASSWORD }} - script: cd ~/docker_compose && docker-compose down && docker-compose pull && docker-compose up --build -d \ No newline at end of file + script: | + cd ~/docker_compose + docker-compose down + docker-compose pull + sleep 10s + docker-compose up -d \ No newline at end of file diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 76f67499..67e1f7e4 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -54,6 +54,7 @@ public MappingProfile() CreateMap(); CreateMap(); + CreateMap(); CreateMap(); CreateMap(); @@ -63,7 +64,9 @@ public MappingProfile() CreateMap(); CreateMap(); - CreateMap(); + CreateMap() + .ForMember(e => e.Project, + opt => opt.MapFrom(d => d.Project)); CreateMap(); CreateMap(); diff --git a/API/Controllers/EmbedController.cs b/API/Controllers/EmbedController.cs index 40a3ed2a..9222bffe 100644 --- a/API/Controllers/EmbedController.cs +++ b/API/Controllers/EmbedController.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -28,12 +28,15 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; +using System.Linq.Expressions; using System.Threading.Tasks; namespace API.Controllers { /// - /// Embedded iframe controller + /// This class is responsible for handling HTTP requests that are related + /// to the embedded projects, for example creating, retrieving or deleting. /// /// [Route("api/[controller]")] @@ -44,13 +47,14 @@ public class EmbedController : ControllerBase private readonly IMapper mapper; private readonly IProjectService projectService; private readonly IUserService userService; + /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class /// - /// The embed service. - /// The mapper. - /// The Project service - /// The User service + /// The embed service which is used to communicate with the logic layer. + /// The mapper which is used to convert the resources to the models to the resource results. + /// The project service which is used to communicate with the logic layer. + /// The user service which is used to communicate with the logic layer. public EmbedController(IEmbedService embedService, IMapper mapper, IProjectService projectService, IUserService userService) { this.embedService = embedService; @@ -60,34 +64,33 @@ public EmbedController(IEmbedService embedService, IMapper mapper, IProjectServi } /// - /// Gets all embedded projects. + /// This method is responsible for retrieving all embedded projects. /// - /// A list of embedded projects Resource Result. + /// This method returns a list of embedded projects resource result. + /// This endpoint returns a list with embedded projects. [HttpGet] + [ProducesResponseType(typeof(IEnumerable), (int) HttpStatusCode.OK)] [Authorize(Policy = nameof(Defaults.Scopes.EmbedRead))] public async Task GetAllEmbeddedProjects() { - IEnumerable embeddedProjects = await embedService.GetEmbeddedProjectsAsync(); + IEnumerable embeddedProjects= await embedService.GetEmbeddedProjectsAsync(); - if(!embeddedProjects.Any()) - { - ProblemDetails problem = new ProblemDetails - { - Title = "No Embedded Projects found.", - Detail = "There are no Embedded projects in the database.", - Instance = "FEA62EAE-3D3C-4CE7-BDD8-6B273D56068D" - }; - return NotFound(problem); - } return Ok(mapper.Map, IEnumerable>(embeddedProjects)); } /// - /// Gets the embedded project. + /// This method is responsible for retrieving a single embedded project. /// - /// The unique identifier. - /// The project resource result + /// The unique identifier which is used for searching the embedded project. + /// This method returns the project resource result. + /// This endpoint returns a embedded project with the specified guid. + /// The 400 Bad Request status code is returned when the guid is not specified. + /// The 404 Not Found status code is returned when no project could be + /// found with the specified guid. [HttpGet("{guid}")] + [ProducesResponseType(typeof(ProjectResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetEmbeddedProject(string guid) { if(string.IsNullOrEmpty(guid)) @@ -135,12 +138,20 @@ public async Task GetEmbeddedProject(string guid) } /// - /// Creates a embedded project + /// This method is responsible for creating an embedded project. /// - /// EmbedResource - /// The embedded project resource result. + /// The embed resource which is used to create an embedded project + /// This method return the embedded project resource result. + /// This endpoint returns the created embedded project. + /// The 400 Bad Request status code is returned when the specified + /// resource is invalid or the project could not be saved to the database. + /// The 401 Unauthorized status code is returned when the user + /// is not allowed to create an embed project. [HttpPost] [Authorize] + [ProducesResponseType(typeof(EmbeddedProjectResourceResult), (int) HttpStatusCode.Created)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] public async Task CreateEmbeddedProject(EmbeddedProjectResource embedResource) { if(embedResource == null) @@ -213,12 +224,20 @@ public async Task CreateEmbeddedProject(EmbeddedProjectResource e } /// - /// Deletes the embeddedProject. + /// This method is responsible for deleting the embedded project. /// - /// The unique identifier. - /// Status code 200 + /// The unique identifier which is used for searching the embedded project. + /// This method returns status code 200. + /// This endpoint returns status code 200. The embedded project is deleted. + /// The 401 Unauthorized status code is returned when the user + /// is not allowed to delete the embedded project . + /// The 404 Not Found status code is returned when the embedded + /// project could not be found with the specified guid. [HttpDelete("{guid}")] [Authorize] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] public async Task DeleteEmbeddedProject(string guid) { EmbeddedProject embeddedProject = await embedService.FindAsync(new Guid(guid)); diff --git a/API/Controllers/HighlightController.cs b/API/Controllers/HighlightController.cs index 6b308d04..e89670bb 100644 --- a/API/Controllers/HighlightController.cs +++ b/API/Controllers/HighlightController.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -24,29 +24,30 @@ using Models.Defaults; using Serilog; using Services.Services; +using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace API.Controllers { - /// - /// Highlight controller for highlights + /// This class is responsible for handling HTTP requests that are related + /// to the highlights, for example creating, retrieving, updating or deleting. /// [Route("api/[controller]")] [ApiController] public class HighlightController : ControllerBase { - private readonly IHighlightService highlightService; private readonly IMapper mapper; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class /// - /// The highlight service. - /// The mapper. + /// The highlight service which is used to communicate with the logic layer. + /// The mapper which is used to convert the resources to the models to resource results. public HighlightController(IHighlightService highlightService, IMapper mapper) { this.highlightService = highlightService; @@ -54,33 +55,31 @@ public HighlightController(IHighlightService highlightService, IMapper mapper) } /// - /// Get all active highlights. + /// This method is responsible for retrieving all active highlights. /// - /// A list of Highlight resource results. + /// This method returns a list of highlight resource results. + /// This endpoint returns a list highlights. [HttpGet] + [ProducesResponseType(typeof(IEnumerable), (int) HttpStatusCode.OK)] public async Task GetAllHighlights() { IEnumerable highlights = await highlightService.GetHighlightsAsync(); - if(!highlights.Any()) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting highlights.", - Detail = "The database does not contain any highlights.", - Instance = "FC6A4F97-C815-4A92-8A73-2ECF1729B161" - }; - return NotFound(problem); - } return Ok(mapper.Map, IEnumerable>(highlights)); } /// - /// Gets the highlight by the identifier. + /// This method is responsible for retrieving a single highlight by the identifier. /// - /// The highlight identifier. - /// A Highlight resource result. + /// The highlight identifier which is used to find the highlight. + /// This method returns a highlight resource result. + /// This endpoint returns the highlight with the specified identifier. + /// The 400 Bad Request status code is returned when the highlight id is not valid. + /// The 404 Not Found status code is returned when there is no highlight found with the specified id. [HttpGet("{highlightId}")] + [ProducesResponseType(typeof(HighlightResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetHighlight(int highlightId) { if(highlightId < 0) @@ -110,12 +109,18 @@ public async Task GetHighlight(int highlightId) } /// - /// Get a Highlight by project id + /// This method is responsible for retrieving all highlight by project id. /// - /// The project identifier to retrieve the corresponding highlights + /// The project identifier which is used to retrieve the corresponding highlights. /// + /// This endpoint returns a list of highlights from a project. + /// The 400 Bad Request status code is returned when the specified project id is not valid. + /// The 404 Not Found status code is return when there are no highlight found with the specified project id. [HttpGet("Project/{projectId}")] [Authorize(Policy = nameof(Defaults.Scopes.HighlightRead))] + [ProducesResponseType(typeof(IEnumerable), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetHighlightsByProjectId(int projectId) { if(projectId < 0) @@ -143,12 +148,17 @@ public async Task GetHighlightsByProjectId(int projectId) } /// - /// Creates a highlight + /// This method is responsible for creating a highlight. /// - /// The highlight resource. - /// The created highlight resource result. + /// The highlight resource which is used to create the highlight. + /// This method returns the created highlight resource result. + /// This endpoint returns the created highlight. + /// The 400 Bad Request status code is returned when the specified + /// resource is invalid or the highlight could not be saved to the database. [HttpPost] [Authorize(Policy = nameof(Defaults.Scopes.HighlightWrite))] + [ProducesResponseType(typeof(HighlightResourceResult), (int) HttpStatusCode.Created)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] public IActionResult CreateHighlight(HighlightResource highlightResource) { if(highlightResource == null) @@ -166,7 +176,6 @@ public IActionResult CreateHighlight(HighlightResource highlightResource) try { - highlightService.Add(highlight); highlightService.Save(); return Created(nameof(CreateHighlight), mapper.Map(highlight)); @@ -182,17 +191,20 @@ public IActionResult CreateHighlight(HighlightResource highlightResource) }; return BadRequest(problem); } - } /// - /// Updates the highlight. + /// This method is responsible for updating the highlight. /// - /// The highlight identifier. - /// The highlight resource. - /// The updated highlight resource result. + /// The highlight identifier which is used to find the highlight. + /// The highlight resource which is used to update the highlight. + /// This method return the updated highlight resource result + /// This endpoint returns the updated highlight. + /// The 404 Not Found status code is returned when no highlight is found with the specified highlight id. [HttpPut("{highlightId}")] [Authorize(Policy = nameof(Defaults.Scopes.HighlightWrite))] + [ProducesResponseType(typeof(HighlightResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task UpdateHighlight(int highlightId, [FromBody] HighlightResource highlightResource) { @@ -217,12 +229,16 @@ public async Task UpdateHighlight(int highlightId, } /// - /// Deletes the highlight by the identifier. + /// This method is responsible for deleting the highlight by the identifier. /// - /// The highlight identifier. - /// Status code 200. + /// The highlight identifier which is used to find the highlight. + /// This method returns status code 200. + /// This endpoint returns status code 200. The highlight is deleted. + /// The 404 Not Found status code is returned when no highlight is found with the specified id. [HttpDelete("{highlightId}")] [Authorize(Policy = nameof(Defaults.Scopes.HighlightWrite))] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task DeleteHighlight(int highlightId) { if(await highlightService.FindAsync(highlightId) == null) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 64985ba7..7d01eb9a 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -27,12 +27,14 @@ using Services.Services; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace API.Controllers { /// - /// This controller handles the CRUD projects + /// This class is responsible for handling HTTP requests that are related + /// to the projects, for example creating, retrieving, updating or deleting. /// [Route("api/[controller]")] [ApiController] @@ -60,11 +62,15 @@ public ProjectController(IProjectService projectService, IUserService userServic } /// - /// Get all projects. + /// This method is responsible for retrieving all projects. /// - /// The parameters to filter, sort and paginate the projects - /// The project result resource. + /// The parameters to filter which is used to sort and paginate the projects. + /// This method returns the project result resource. + /// This endpoint returns all projects. + /// The 400 Bad Request status code is returned when values inside project filter params resource are invalid. [HttpGet] + [ProducesResponseType(typeof(ProjectResultsResource), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] public async Task GetAllProjects([FromQuery] ProjectFilterParamsResource projectFilterParamsResource) { ProblemDetails problem = new ProblemDetails @@ -115,10 +121,16 @@ await projectService.GetProjectsTotalPages(projectFilterParams) } /// - /// Get a project. + /// This method is responsible for retrieving a single project. /// - /// The project resource result. + /// This method returns the project resource result. + /// This endpoint returns the project with the specified id. + /// The 400 Bad Request status code is returned when the specified id is invalid. + /// The 404 Not Found status code is returned when the project could not be found with the specified id. [HttpGet("{projectId}")] + [ProducesResponseType(typeof(ProjectResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetProject(int projectId) { if(projectId < 0) @@ -148,11 +160,16 @@ public async Task GetProject(int projectId) } /// - /// Create a Project. + /// This method is responsible for creating a Project. /// - /// The project resource result. + /// This method returns the project resource result. + /// This endpoint returns the created project. + /// The 400 Bad Request status code is returned when the project + /// resource is not specified or failed to save project to the database. [HttpPost] [Authorize] + [ProducesResponseType(typeof(ProjectResourceResult), (int) HttpStatusCode.Created)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] public async Task CreateProjectAsync([FromBody] ProjectResource projectResource) { if(projectResource == null) @@ -188,13 +205,19 @@ public async Task CreateProjectAsync([FromBody] ProjectResource p } /// - /// Updates the project with the specified identifier. + /// This method is responsible for updating the project with the specified identifier. /// - /// The project identifier. - /// The project resource. - /// The project resource result. + /// The project identifier which is used for searching the project. + /// The project resource which is used for updating the project. + /// This method returns the project resource result. + /// This endpoint returns the updated project. + /// The 401 Unauthorized status code is return when the user has not the correct permission to update. + /// The 404 not Found status code is returned when the project to update is not found. [HttpPut("{projectId}")] [Authorize] + [ProducesResponseType(typeof(ProjectResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task UpdateProject(int projectId, [FromBody] ProjectResource projectResource) { Project project = await projectService.FindAsync(projectId).ConfigureAwait(false); @@ -231,11 +254,17 @@ public async Task UpdateProject(int projectId, [FromBody] Project } /// - /// deletes a project. + /// This method is responsible for deleting a project. /// - /// Status code 200. + /// This method returns the status code 200. + /// This endpoint returns status code 200. The project is deleted. + /// The 401 Unauthorized status code is returned when the the user has not the correct permission to delete. + /// The 404 Not Found status code is returned when the project to delete was not found. [HttpDelete("{projectId}")] [Authorize] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task DeleteProject(int projectId) { Project project = await projectService.FindAsync(projectId).ConfigureAwait(false); diff --git a/API/Controllers/RoleController.cs b/API/Controllers/RoleController.cs index b0c761c7..63dd68ec 100644 --- a/API/Controllers/RoleController.cs +++ b/API/Controllers/RoleController.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using API.Resources; using AutoMapper; using Microsoft.AspNetCore.Authorization; @@ -10,12 +7,17 @@ using Models.Defaults; using Serilog; using Services.Services; +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; using static Models.Defaults.Defaults; namespace API.Controllers { /// - /// This controller handles the CRUD roles + /// This class is responsible for handling HTTP requests that are related + /// to the roles, for example creating, retrieving, updating or deleting. /// [Route("api/[controller]")] [ApiController] @@ -26,11 +28,11 @@ public class RoleController : ControllerBase private readonly IRoleService roleService; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class /// - /// The role service. - /// The user service. - /// The mapper. + /// The role service which is used to communicate with the logic layer. + /// The user service which is used to communicate with the logic layer. + /// The mapper which is used to convert the resources to the model to the resource result. public RoleController(IRoleService roleService, IUserService userService, IMapper mapper) { this.roleService = roleService; @@ -39,34 +41,31 @@ public RoleController(IRoleService roleService, IUserService userService, IMappe } /// - /// Get all Roles. + /// This method is responsible for retrieving all roles. /// - /// A list of role resource results. + /// This method returns a list of role resource results. + /// This endpoint returns a list of roles. [HttpGet] [Authorize(Policy = nameof(Scopes.RoleRead))] + [ProducesResponseType(typeof(IEnumerable), (int) HttpStatusCode.OK)] public async Task GetAllRoles() { - List roles = await roleService.GetAllAsync().ConfigureAwait(false); - if(roles.Count == 0) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting all roles.", - Detail = "There where no roles found in the database.", - Instance = "3EB1E953-96D7-45FE-8C5C-05306AF8D060" - }; - return NotFound(problem); - } + List roles = await roleService.GetAllAsync() + .ConfigureAwait(false); return Ok(mapper.Map, IEnumerable>(roles)); } /// - /// Get all Scopes. + /// This method is responsible for retrieving all scopes. /// - /// A list of valid scopes. + /// This method returns a list of valid scopes. + /// This endpoint returns a list of scopes. + /// The 404 Not Found status code is returned when no scopes are found. [HttpGet("Scopes")] [Authorize(Policy = nameof(Scopes.RoleRead))] + [ProducesResponseType(typeof(List), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public IActionResult GetAllPossibleScopes() { List scopeList = roleService.GetValidScopes(); @@ -80,15 +79,22 @@ public IActionResult GetAllPossibleScopes() }; return NotFound(problem); } + return Ok(scopeList); } /// - /// Get a Role. + /// This method is responsible for retrieving a single role. /// - /// The role resource result. + /// This method return the role resource result. + /// This endpoint returns the role with the specified id. + /// The 400 Bad Request status code is returned when the specified role id is invalid. + /// The 404 Not Found status code is returned when no role is found with the specified role id. [HttpGet("{roleId}")] [Authorize(Policy = nameof(Scopes.RoleRead))] + [ProducesResponseType(typeof(RoleResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetRole(int roleId) { if(roleId < 0) @@ -118,12 +124,16 @@ public async Task GetRole(int roleId) } /// - /// Creates the role asynchronous. + /// This method is responsible for creating the role. /// - /// The role resource. - /// The created role resource result. + /// The role resource which is used to create a role. + /// This method returns the created role resource result. + /// This endpoint returns the created role. + /// The 400 Bad Request status code is returned when unable to create role. [HttpPost] [Authorize(Policy = nameof(Scopes.RoleWrite))] + [ProducesResponseType(typeof(RoleResourceResult), (int) HttpStatusCode.Created)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] public async Task CreateRoleAsync([FromBody]RoleResource roleResource) { if(roleResource == null) @@ -173,13 +183,19 @@ public async Task CreateRoleAsync([FromBody]RoleResource roleReso } /// - /// Updates the role. + /// This method is responsible for updating the role. /// - /// The role identifier. - /// The role resource. - /// The updated role resource result. + /// The role identifier which is used for searching the role. + /// The role resource which is used to update the role. + /// This method returns the updated role resource result. + /// This endpoint returns the updated role. + /// The 400 Bad Request status code is returned when a role scope is not valid. + /// The 404 Not Found status code is returned when the role with the specified id could not be found. [HttpPut("{roleId}")] [Authorize(Policy = nameof(Scopes.RoleWrite))] + [ProducesResponseType(typeof(RoleResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task UpdateRole(int roleId, RoleResource roleResource) { Role currentRole = await roleService.FindAsync(roleId).ConfigureAwait(false); @@ -216,12 +232,21 @@ public async Task UpdateRole(int roleId, RoleResource roleResourc } /// - /// Deletes the role. + /// This method is responsible for deleting the role. /// - /// The role identifier. - /// Statuscode 200. + /// The role identifier which is used for searching the role. + /// This method returns status code 200. + /// This endpoint returns status code 200. Role is deleted. + /// The 400 Bad Request status code is returned when the role is assigned to a user. + /// The 401 Unauthorized status code is returned when the user is not allowed to delete roles. + /// The 404 Not Found status code is returned when the role with the specified id could not be found. [HttpDelete("{roleId}")] [Authorize(Policy = nameof(Scopes.RoleWrite))] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task DeleteRole(int roleId) { Role role = await roleService.FindAsync(roleId).ConfigureAwait(false); @@ -263,13 +288,17 @@ public async Task DeleteRole(int roleId) } /// - /// Sets the role. + /// This method is responsible for setting the role. /// - /// The user identifier. - /// The role identifier. - /// The user resource result. + /// The user identifier which is used for searching the user. + /// The role identifier which is used for searching the role. + /// This method returns the user resource result. + /// This endpoint returns the updated user. + /// The 404 Not Found status code is returned when the specified role or user could not be found. [HttpPut("setRole")] [Authorize(Policy = nameof(Scopes.RoleWrite))] + [ProducesResponseType(typeof(UserResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task SetRole(int userId, int roleId) { Role role = await roleService.FindAsync(roleId).ConfigureAwait(false); diff --git a/API/Controllers/SearchController.cs b/API/Controllers/SearchController.cs index 26a7d5f8..89b1b18c 100644 --- a/API/Controllers/SearchController.cs +++ b/API/Controllers/SearchController.cs @@ -22,19 +22,19 @@ using Services.Services; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace API.Controllers { - /// - /// The controller that handles search requests + /// This class is responsible for handling HTTP requests that are related + /// to the search requests. /// [Route("api/[controller]")] [ApiController] public class SearchController : ControllerBase { - private readonly IMapper mapper; private readonly ISearchService searchService; @@ -42,8 +42,8 @@ public class SearchController : ControllerBase /// /// Initializes a new instance of the class. /// - /// The search service. - /// The mapper. + /// The search service which is used to communicate with the logic layer. + /// The mapper which is used to convert the resource to the model to the resource result. public SearchController(ISearchService searchService, IMapper mapper) { this.searchService = searchService; @@ -51,12 +51,16 @@ public SearchController(ISearchService searchService, IMapper mapper) } /// - /// Search for projects + /// This method is responsible for searching and retrieving projects. /// - /// The search query - /// The parameters to filter, sort and paginate the projects - /// Search results + /// The search query which is used to search for a project. + /// The parameters to filter which is ued to sort and paginate the projects. + /// This method returns the search results. + /// This endpoint returns search results. + /// The 400 Bad Request status code is returned when the search request is invalid. [HttpGet("internal/{query}")] + [ProducesResponseType(typeof(ProjectResultsResource), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] public async Task SearchInternalProjects(string query, [FromQuery] ProjectFilterParamsResource projectFilterParamsResource) { @@ -113,7 +117,5 @@ await searchService.SearchInternalProjectsTotalPages(query, projectFilterParams) return Ok(searchResultsResource); } - } - } diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index b65192ac..ed9db419 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -23,16 +23,17 @@ using Microsoft.EntityFrameworkCore; using Models; using Models.Defaults; -using RestSharp; using Serilog; using Services.Services; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace API.Controllers { /// - /// This controller handles the user settings. + /// This class is responsible for handling HTTP requests that are related + /// to the users, for example creating, retrieving, updating or deleting. /// [Route("api/[controller]")] [ApiController] @@ -61,11 +62,15 @@ public UserController(IUserService userService, IMapper mapper, IRoleService rol } /// - /// Gets the current user. + /// The method is responsible for retrieving the current user. /// /// The current user as user resource result. + /// This endpoint returns the current user. + /// The 404 Not found status code is returned when the user could not be found. [HttpGet] [Authorize] + [ProducesResponseType(typeof(UserResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetCurrentUser() { string identityId = HttpContext.User.GetIdentityId(HttpContext); @@ -84,12 +89,18 @@ public async Task GetCurrentUser() } /// - /// Get a user account. + /// This method is responsible for retrieving a user account. /// - /// the useridentifier. - /// The user resource result. + /// the user identifier which is used for searching a user. + /// This method returns the user resource result. + /// This endpoint returns the user with the specified user id. + /// The 400 Bad Request status code is returned when the user id is invalid. + /// The 404 Not Found status code is returned when the user with the specified id could not be found. [HttpGet("{userId}")] [Authorize(Policy = nameof(Defaults.Scopes.UserRead))] + [ProducesResponseType(typeof(UserResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetUser(int userId) { if(userId < 0) @@ -120,12 +131,16 @@ public async Task GetUser(int userId) /// - /// Creates the account asynchronous. + /// This method is responsible for creating the account. /// - /// The account resource. - /// The created user as user resource result. + /// The account resource which is used for creating the account. + /// This method returns the created user as user resource result. + /// This endpoint returns the created user. + /// The 400 Bad Request status code is return when saving the user to the database failed. [HttpPost] [Authorize(Policy = nameof(Defaults.Scopes.UserWrite))] + [ProducesResponseType(typeof(UserResourceResult), (int) HttpStatusCode.Created)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] public async Task CreateAccountAsync([FromBody] UserResource accountResource) { User user = mapper.Map(accountResource); @@ -152,13 +167,19 @@ public async Task CreateAccountAsync([FromBody] UserResource acco } /// - /// Updates the account. + /// This method is responsible for updating the account. /// - /// The user identifier. - /// The user resource. - /// The updated user as user resource result. + /// The user identifier which is used for searching the user. + /// The user resource which is used for updating the user. + /// This method returns the updated user as user resource result. + /// This endpoint returns the updated user. + /// The 401 Unauthorized status code is returned when the user is not allowed to update the account. + /// The 404 Not Found status code is returned when the user with the specified id could not be found. [HttpPut("{userId}")] [Authorize] + [ProducesResponseType(typeof(UserResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task UpdateAccount(int userId, [FromBody] UserResource userResource) { User currentUser = await HttpContext.GetContextUser(userService).ConfigureAwait(false); @@ -196,11 +217,15 @@ public async Task UpdateAccount(int userId, [FromBody] UserResour } /// - /// Deletes the current account. + /// This method is responsible for deleting the current account. /// - /// Not found when the user does not exist. OK if everything went welll. + /// This method returns status code 200. + /// This endpoint returns status code 200. The current account is deleted. + /// The 404 Not Found status code is returned when the current account could not be found. [HttpDelete] [Authorize] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task DeleteAccount() { User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); @@ -223,11 +248,17 @@ public async Task DeleteAccount() /// - /// Delete the user account. + /// This method is responsible for deleting a user account. /// - /// Statuscode 200 + /// This method returns status code 200. + /// This endpoint returns status code 200. The account with the specified id is deleted. + /// The 401 Unauthorized status code is returned when the user is not allowed to delete the account. + /// The 404 Not Found status code is returned when the user with the specified id could not be found. [HttpDelete("{userId}")] [Authorize] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task DeleteAccount(int userId) { User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); diff --git a/API/Controllers/WizardController.cs b/API/Controllers/WizardController.cs index bbf95637..5af49746 100644 --- a/API/Controllers/WizardController.cs +++ b/API/Controllers/WizardController.cs @@ -1,35 +1,32 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ -using API.Resources; -using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Models; using Services.Services; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Net; namespace API.Controllers { /// - /// The controller that handles search requests + /// This class is responsible for handling HTTP requests that are related + /// to the wizard, for exampling retrieving. /// [Route("api/[controller]")] [ApiController] @@ -40,19 +37,25 @@ public class WizardController : ControllerBase /// /// Initializes a new instance of the class. /// - /// The source manager service. + /// The source manager service which is used to communicate with the logic layer. public WizardController(ISourceManagerService sourceManagerService) { this.sourceManagerService = sourceManagerService; } /// - /// Gets the wizard information. + /// This method is responsible for retrieving the wizard information. /// - /// The source URI. - /// The filled in Project. + /// The source URI which is used for searching the project. + /// This method returns the filled in project. + /// This endpoint returns the project with the specified source Uri. + /// The 400 Bad Request status code is returned when the source Uri is not specified. + /// The 404 Not Found status code is returned when the project could not be found with the specified source Uri. [HttpGet] [Authorize] + [ProducesResponseType(typeof(Project), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.NotFound)] public IActionResult GetWizardInformation(Uri sourceURI) { if(sourceURI == null) diff --git a/API/Filters/DefaultOperationFilter.cs b/API/Filters/DefaultOperationFilter.cs new file mode 100644 index 00000000..89ebc4e1 --- /dev/null +++ b/API/Filters/DefaultOperationFilter.cs @@ -0,0 +1,46 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; +using System.Linq; + +namespace API.Filters +{ + /// + /// Filter for all endpoints to make sure that the response + /// media type will be set to 'application/json'. + /// + public class DefaultOperationFilter : IOperationFilter + { + /// + /// Foreach http status code keep the media type for application/json + /// and remove the other media types. + /// + /// API Operation + /// Filter context + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + // If there already is a consume attribute, this won't be overridden, + // so only if nothing is configured, the default will be set to application/json. + bool hasConsumeAttribute = context.MethodInfo.GetCustomAttributes(true) + .Union(context.MethodInfo.GetCustomAttributes(true)) + .OfType() + .Count() != 0; + if(operation.RequestBody != null && !hasConsumeAttribute) + { + var mediaType = operation.RequestBody.Content["application/json"]; + operation.RequestBody.Content.Clear(); + operation.RequestBody.Content.Add("application/json", mediaType); + } + + foreach(string code in operation.Responses.Keys) + { + if(operation.Responses[code] + .Content.TryGetValue("application/json", out OpenApiMediaType mediaType)) + { + operation.Responses[code].Content.Clear(); + operation.Responses[code].Content.Add("application/json", mediaType); + } + } + } + } +} diff --git a/API/Resources/HighlightResourceResult.cs b/API/Resources/HighlightResourceResult.cs index 0ef3c227..01f8ed0b 100644 --- a/API/Resources/HighlightResourceResult.cs +++ b/API/Resources/HighlightResourceResult.cs @@ -23,19 +23,25 @@ namespace API.Resources /// /// The view model result of a highlight /// - public class HighlightResourceResult : HighlightResource + public class HighlightResourceResult { /// /// This gets or sets the the id of highlight /// public int Id { get; set; } - /// - /// This gets or sets project associated with the highlight + /// This gets or sets the id of the project that this highlight is associated with /// - public Project Project { get; set; } - + public int ProjectId { get; set; } + /// + /// This gets or sets the description of the project that this highlight is associated with + /// + public string Description { get; set; } + /// + /// This gets or sets the project of this highlight + /// + public ProjectHighlightResourceResult Project { get; set; } } } diff --git a/API/Resources/ProjectHighlightResourceResult.cs b/API/Resources/ProjectHighlightResourceResult.cs new file mode 100644 index 00000000..fc4cf876 --- /dev/null +++ b/API/Resources/ProjectHighlightResourceResult.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + /// + /// The view model result for a project that is returned when requesting highlights + /// Only information that the highlight needs is returned + /// + public class ProjectHighlightResourceResult + { + + /// + /// This gets or sets the Name + /// + public string Name { get; set; } + + /// + /// This gets or sets the Short Description + /// + public string ShortDescription { get; set; } + } +} diff --git a/API/Startup.cs b/API/Startup.cs index 52c1103a..558c3eb3 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -1,22 +1,23 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ using API.Configuration; using API.Extensions; +using API.Filters; using Data; using Data.Helpers; using FluentValidation.AspNetCore; @@ -144,6 +145,7 @@ public void ConfigureServices(IServiceCollection services) services.AddSwaggerGen(o => { + o.OperationFilter(); o.SwaggerDoc("v1", new OpenApiInfo { diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c556cc6..7f2385ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - ## [Unreleased] @@ -16,7 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - ### Deprecated ### Removed @@ -55,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed issue resulting in people being unable to sign up with a new account - [#231](https://github.com/DigitalExcellence/dex-backend/issues/231) +- Fixed issue where highlights were sending too much information. - [#205](https://github.com/DigitalExcellence/dex-backend/issues/205) ## Release v.0.6-beta - 22-06-2020 diff --git a/IdentityServer/Configuration/Config.cs b/IdentityServer/Configuration/Config.cs index 4930f6fa..24151189 100644 --- a/IdentityServer/Configuration/Config.cs +++ b/IdentityServer/Configuration/Config.cs @@ -155,6 +155,10 @@ public class FrontendConfig /// public string RedirectUriFrontend { get; set; } /// + /// Gets or sets the refresh uri of the frontend. + /// + public string RefreshUriFrontend { get; set; } + /// /// Gets or sets the redirect uri for Postman. /// public string RedirectUriPostman { get; set; } diff --git a/IdentityServer/Configuration/IdentityConfig.cs b/IdentityServer/Configuration/IdentityConfig.cs index 6767fb68..94d55eb9 100644 --- a/IdentityServer/Configuration/IdentityConfig.cs +++ b/IdentityServer/Configuration/IdentityConfig.cs @@ -98,15 +98,16 @@ public static IEnumerable Clients(Config config) { new Secret(config.Frontend.ClientSecret.Sha256()) }, - AllowedGrantTypes = GrantTypes.Implicit, + AllowedGrantTypes = GrantTypes.Code, RequirePkce = true, - + RequireClientSecret = false, RequireConsent = false, // where to redirect to after login RedirectUris = new List { config.Frontend.RedirectUriFrontend, - config.Frontend.RedirectUriPostman + config.Frontend.RedirectUriPostman, + config.Frontend.RefreshUriFrontend }, // where to redirect to after logout @@ -121,9 +122,8 @@ public static IEnumerable Clients(Config config) IdentityServerConstants.StandardScopes.Email, "dex-api" }, - AllowAccessTokensViaBrowser = true - - // AllowOfflineAccess = true + AllowAccessTokensViaBrowser = true, + AllowOfflineAccess = true }, new Client diff --git a/IdentityServer/Dockerfile b/IdentityServer/Dockerfile index c0e8749e..a480f8e7 100644 --- a/IdentityServer/Dockerfile +++ b/IdentityServer/Dockerfile @@ -18,6 +18,8 @@ ENV App__Api__ClientSecret = '' ENV App__Frontend__RedirectUriFrontend = '' +ENV App__Frontend__RefreshUriFrontend = '' + ENV App__Frontend__RedirectUriFrontendPostman = '' ENV App__Frontend__PostLogoutUrisFrontend = '' @@ -38,7 +40,7 @@ ENV App__FfhictOIDC__RedirectUri = '' ENV SENTRY_DSN = '' -RUN dotnet tool install --tool-path ./ dotnet-certificate-tool +RUN dotnet tool install --tool-path ./ dotnet-certificate-tool --version 2.0.1 RUN dotnet publish IdentityServer/6_IdentityServer.csproj -c Release -o out @@ -48,4 +50,4 @@ WORKDIR /app COPY --from=build-env /app . -ENTRYPOINT ["./certs/docker-entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["./certs/docker-entrypoint.sh"] diff --git a/IdentityServer/Dockerfile.dev b/IdentityServer/Dockerfile.dev index 949cea7f..bfe019f1 100644 --- a/IdentityServer/Dockerfile.dev +++ b/IdentityServer/Dockerfile.dev @@ -4,6 +4,8 @@ ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 ENV App__Self__IssuerUri = '' +ENV ConnectionStrings__DefaultConnection = '' + ARG BuildConfiguration=Debug WORKDIR /app @@ -19,6 +21,7 @@ FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 WORKDIR /app COPY --from=build-env /app/IdentityServer/bin/Debug/netcoreapp3.1 . +COPY --from=build-env /app/IdentityServer/wwwroot ./wwwroot COPY --from=build-env /app/dex-identity.pfx . ENTRYPOINT ["dotnet", "6_IdentityServer.dll", "--environment=Development"] \ No newline at end of file diff --git a/IdentityServer/Startup.cs b/IdentityServer/Startup.cs index 570454ac..60c36c38 100644 --- a/IdentityServer/Startup.cs +++ b/IdentityServer/Startup.cs @@ -19,6 +19,7 @@ using Data; using IdentityServer.Configuration; using IdentityServer.Quickstart; +using IdentityServer4; using IdentityServer4.Services; using IdentityServer4.Test; using Microsoft.AspNetCore.Authentication.Cookies; @@ -107,6 +108,7 @@ public void ConfigureServices(IServiceCollection services) true; options.Events.RaiseFailureEvents = true; options.Events.RaiseSuccessEvents = true; + options.PublicOrigin = Config.Self.PublicOrigin; if(Environment.IsDevelopment()) { options.IssuerUri = Config.Self.IssuerUri; @@ -122,9 +124,9 @@ public void ConfigureServices(IServiceCollection services) // sets the authentication schema. services.AddAuthentication(options => { - options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; - options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme; + options.DefaultAuthenticateScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; + options.DefaultSignInScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; + options.DefaultChallengeScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; }) // Adds Fontys Single Sign On authentication. .AddOpenIdConnect("FHICT", "Fontys", options => diff --git a/IdentityServer/appsettings.Development.json b/IdentityServer/appsettings.Development.json index 124e594a..795da23b 100644 --- a/IdentityServer/appsettings.Development.json +++ b/IdentityServer/appsettings.Development.json @@ -22,6 +22,7 @@ }, "Frontend": { "RedirectUriFrontend": "http://localhost:4200/auth-callback", + "RefreshUriFrontend": "http://localhost:4200/silent-refresh.html", "RedirectUriPostman": "https://www.postman.com/oauth2/callback", "PostLogoutUriFrontend": "http://localhost:4200/", "ClientId": "dex-frontend", diff --git a/IdentityServer/appsettings.json b/IdentityServer/appsettings.json index 0a71518a..4a9f51f1 100644 --- a/IdentityServer/appsettings.json +++ b/IdentityServer/appsettings.json @@ -29,6 +29,7 @@ }, "Frontend": { "RedirectUriFrontend": "", + "RefreshUriFrontend": "", "RedirectUriPostman": "", "PostLogoutUriFrontend": "", "ClientId": "", diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 77866026..6c299a68 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1393,7 +1393,7 @@ "", "function findProjectId(jsonData, item) {", " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].project.id == item) {", + " if (jsonData[i].projectId == item) {", " return i;", " }", " }", @@ -1510,7 +1510,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", "options": { "raw": { "language": "json" @@ -1561,14 +1561,6 @@ "", "pm.test(\"Highlight Id matches: \" + highlightId, function () {", " pm.expect(jsonData.id).to.eql(highlightId);", - "});", - "", - "pm.test(\"Highlight Start Date matches: \" + highlightUpdateTimestamp, function () {", - " pm.expect(jsonData.startDate).to.eql(highlightUpdateTimestamp.replace('Z', ''));", - "});", - "", - "pm.test(\"Highlight End Date matches: \" + highlightEndDate, function () {", - " pm.expect(jsonData.endDate).to.eql(highlightEndDate);", "});" ], "type": "text/javascript" @@ -10440,7 +10432,7 @@ "", "function findProjectId(jsonData, item) {", " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].project.id == item) {", + " if (jsonData[i].projectId == item) {", " return i;", " }", " }", @@ -10551,7 +10543,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", "options": { "raw": { "language": "json" @@ -10739,7 +10731,7 @@ "", "function findProjectId(jsonData, item) {", " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].project.id == item) {", + " if (jsonData[i].projectId == item) {", " return i;", " }", " }", @@ -10850,7 +10842,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", "options": { "raw": { "language": "json" diff --git a/docker-compose.deploy.yml b/docker-compose.deploy.yml index 1d3cd575..f290ea59 100644 --- a/docker-compose.deploy.yml +++ b/docker-compose.deploy.yml @@ -40,6 +40,7 @@ services: - App__Api__ClientId=${API_CLIENT_ID} - App__Api__ClientSecret=${API_CLIENT_SECRET} - App__Frontend__RedirectUriFrontend=${REDIRECT_URI_FRONTEND} + - App__Frontend__RefreshUriFrontend=${REFRESH_URI_FRONTEND} - App__Frontend__RedirectUriFrontendPostman=${REDIRECT_URI_FRONTEND_POSTMAN} - App__Frontend__PostLogoutUrisFrontend=${POST_LOGOUT_URIS_FRONTEND} - App__Frontend__ClientId=${FRONTEND_CLIENT_ID} From 16fb18a0176b185c5002540f1cea9cc61a51c681 Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 12:51:31 +0100 Subject: [PATCH 066/157] Added institution to the models --- Models/Institution.cs | 24 ++++++++++++++++++++++++ Models/User.cs | 6 ++++++ 2 files changed, 30 insertions(+) create mode 100644 Models/Institution.cs diff --git a/Models/Institution.cs b/Models/Institution.cs new file mode 100644 index 00000000..34cb48da --- /dev/null +++ b/Models/Institution.cs @@ -0,0 +1,24 @@ +namespace Models +{ + + public class Institution + { + + /// + /// Gets or sets a the id of the institution. + /// + public int Id { get; set; } + + /// + /// Gets or sets a value for the name of the institution. + /// + public string Name { get; set; } + + /// + /// Gets or sets a value for the description of the institution. + /// + public string Description { get; set; } + + } + +} diff --git a/Models/User.cs b/Models/User.cs index b1e9e345..862900f5 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -56,6 +56,12 @@ public User() /// true if this instance is public; otherwise, false. /// public bool IsPublic { get; set; } + + /// + /// Gets or sets the institution where the user is registered. + /// + [Required] + public Institution Institution { get; set; } } } From 14445c1ab78097a7d87c22ef3ae84f6bde78889f Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 12:52:02 +0100 Subject: [PATCH 067/157] Created new migration for updated models (institution) --- ...105110_InstitutionAddedForUser.Designer.cs | 296 ++++++++++++++++++ .../20201026105110_InstitutionAddedForUser.cs | 61 ++++ .../ApplicationDbContextModelSnapshot.cs | 29 ++ 3 files changed, 386 insertions(+) create mode 100644 Data/Migrations/20201026105110_InstitutionAddedForUser.Designer.cs create mode 100644 Data/Migrations/20201026105110_InstitutionAddedForUser.cs diff --git a/Data/Migrations/20201026105110_InstitutionAddedForUser.Designer.cs b/Data/Migrations/20201026105110_InstitutionAddedForUser.Designer.cs new file mode 100644 index 00000000..5ade1c6d --- /dev/null +++ b/Data/Migrations/20201026105110_InstitutionAddedForUser.Designer.cs @@ -0,0 +1,296 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20201026105110_InstitutionAddedForUser")] + partial class InstitutionAddedForUser + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Institution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Institution"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InstitutionId") + .HasColumnType("int"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("InstitutionId"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20201026105110_InstitutionAddedForUser.cs b/Data/Migrations/20201026105110_InstitutionAddedForUser.cs new file mode 100644 index 00000000..7c82238e --- /dev/null +++ b/Data/Migrations/20201026105110_InstitutionAddedForUser.cs @@ -0,0 +1,61 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class InstitutionAddedForUser : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "InstitutionId", + table: "User", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "Institution", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(nullable: true), + Description = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Institution", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_User_InstitutionId", + table: "User", + column: "InstitutionId"); + + migrationBuilder.AddForeignKey( + name: "FK_User_Institution_InstitutionId", + table: "User", + column: "InstitutionId", + principalTable: "Institution", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_User_Institution_InstitutionId", + table: "User"); + + migrationBuilder.DropTable( + name: "Institution"); + + migrationBuilder.DropIndex( + name: "IX_User_InstitutionId", + table: "User"); + + migrationBuilder.DropColumn( + name: "InstitutionId", + table: "User"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index ead5f215..af44de67 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -94,6 +94,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Highlight"); }); + modelBuilder.Entity("Models.Institution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Institution"); + }); + modelBuilder.Entity("Models.Project", b => { b.Property("Id") @@ -182,6 +200,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("InstitutionId") + .HasColumnType("int"); + b.Property("IsPublic") .HasColumnType("bit"); @@ -197,6 +218,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); + b.HasIndex("InstitutionId"); + b.HasIndex("RoleId"); b.ToTable("User"); @@ -255,6 +278,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Models.User", b => { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Models.Role", "Role") .WithMany() .HasForeignKey("RoleId"); From 84c26ae1c43b8f3d0266b639ccbbfbc054603eba Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 14:08:58 +0100 Subject: [PATCH 068/157] Updated migration and model --- API/Resources/UserResourceResult.cs | 4 ++++ Data/4_Data.csproj | 11 ++++++----- ...0201026125836_InstitutionAddedForUser.Designer.cs} | 8 +++----- ...r.cs => 20201026125836_InstitutionAddedForUser.cs} | 5 ++--- Data/Migrations/ApplicationDbContextModelSnapshot.cs | 6 ++---- Models/User.cs | 1 - Repositories/UserRepository.cs | 6 +++--- 7 files changed, 20 insertions(+), 21 deletions(-) rename Data/Migrations/{20201026105110_InstitutionAddedForUser.Designer.cs => 20201026125836_InstitutionAddedForUser.Designer.cs} (97%) rename Data/Migrations/{20201026105110_InstitutionAddedForUser.cs => 20201026125836_InstitutionAddedForUser.cs} (93%) diff --git a/API/Resources/UserResourceResult.cs b/API/Resources/UserResourceResult.cs index 2bd7da37..8176e232 100644 --- a/API/Resources/UserResourceResult.cs +++ b/API/Resources/UserResourceResult.cs @@ -59,6 +59,10 @@ public class UserResourceResult /// public Role Role { get; set; } + /// + /// Gets or sets the institution where the user is registered. + /// + public Institution Institution { get; set; } } } diff --git a/Data/4_Data.csproj b/Data/4_Data.csproj index 5a43bd33..2ce3e933 100644 --- a/Data/4_Data.csproj +++ b/Data/4_Data.csproj @@ -5,7 +5,12 @@ 8 - + + + + + + @@ -21,8 +26,4 @@ - - - - diff --git a/Data/Migrations/20201026105110_InstitutionAddedForUser.Designer.cs b/Data/Migrations/20201026125836_InstitutionAddedForUser.Designer.cs similarity index 97% rename from Data/Migrations/20201026105110_InstitutionAddedForUser.Designer.cs rename to Data/Migrations/20201026125836_InstitutionAddedForUser.Designer.cs index 5ade1c6d..9093b1fe 100644 --- a/Data/Migrations/20201026105110_InstitutionAddedForUser.Designer.cs +++ b/Data/Migrations/20201026125836_InstitutionAddedForUser.Designer.cs @@ -10,7 +10,7 @@ namespace _4_Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20201026105110_InstitutionAddedForUser")] + [Migration("20201026125836_InstitutionAddedForUser")] partial class InstitutionAddedForUser { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -202,7 +202,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("InstitutionId") + b.Property("InstitutionId") .HasColumnType("int"); b.Property("IsPublic") @@ -282,9 +282,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.HasOne("Models.Institution", "Institution") .WithMany() - .HasForeignKey("InstitutionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("InstitutionId"); b.HasOne("Models.Role", "Role") .WithMany() diff --git a/Data/Migrations/20201026105110_InstitutionAddedForUser.cs b/Data/Migrations/20201026125836_InstitutionAddedForUser.cs similarity index 93% rename from Data/Migrations/20201026105110_InstitutionAddedForUser.cs rename to Data/Migrations/20201026125836_InstitutionAddedForUser.cs index 7c82238e..11d1a61e 100644 --- a/Data/Migrations/20201026105110_InstitutionAddedForUser.cs +++ b/Data/Migrations/20201026125836_InstitutionAddedForUser.cs @@ -9,8 +9,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AddColumn( name: "InstitutionId", table: "User", - nullable: false, - defaultValue: 0); + nullable: true); migrationBuilder.CreateTable( name: "Institution", @@ -37,7 +36,7 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "InstitutionId", principalTable: "Institution", principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index af44de67..a16970a9 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -200,7 +200,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("InstitutionId") + b.Property("InstitutionId") .HasColumnType("int"); b.Property("IsPublic") @@ -280,9 +280,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasOne("Models.Institution", "Institution") .WithMany() - .HasForeignKey("InstitutionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("InstitutionId"); b.HasOne("Models.Role", "Role") .WithMany() diff --git a/Models/User.cs b/Models/User.cs index 862900f5..ec9c150a 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -60,7 +60,6 @@ public User() /// /// Gets or sets the institution where the user is registered. /// - [Required] public Institution Institution { get; set; } } diff --git a/Repositories/UserRepository.cs b/Repositories/UserRepository.cs index ce81bcc6..dc5df369 100644 --- a/Repositories/UserRepository.cs +++ b/Repositories/UserRepository.cs @@ -88,6 +88,7 @@ public override async Task FindAsync(int userId) .Where(s => s.Id == userId) .Include(s => s.Role) .ThenInclude(s => s.Scopes) + .Include(u => u.Institution) .SingleOrDefaultAsync(); } /// @@ -101,6 +102,7 @@ public async Task GetUserAsync(int userId) .Where(s => s.Id == userId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) + .Include(u => u.Institution) .SingleOrDefaultAsync(); } /// @@ -114,6 +116,7 @@ public async Task GetUserByIdentityIdAsync(string identityId) .Where(s => s.IdentityId == identityId) .Include(u => u.Role) .ThenInclude(u => u.Scopes) + .Include(u => u.Institution) .SingleOrDefaultAsync(); } @@ -176,8 +179,5 @@ public bool UserWithRoleExists(Role role) .Include(s => s.Role) .SingleOrDefault(r => r.Role.Id == role.Id) != null; } - - } - } From 6d4b46751df0c84f4362443a7ec5f40616c189e3 Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 14:09:52 +0100 Subject: [PATCH 069/157] Added DBSet for institution model --- Data/ApplicationDbContext.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index ad3ac839..e570b9cc 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -75,6 +75,13 @@ public ApplicationDbContext(DbContextOptions options) : ba /// The role. /// public DbSet Role { get; set; } + /// + /// Gets or sets the institution. + /// + /// + /// The institution. + /// + public DbSet Institution { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { From 80ab7ea02f222ab5b9c7a37e20cd7f86812b487e Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 14:10:53 +0100 Subject: [PATCH 070/157] Added first version of the data officer role --- API/Startup.cs | 1 + Data/Helpers/Seed.cs | 43 +++++++++++++++++++++++++++++-------- Models/Defaults/Defaults.cs | 26 ++++++++++++++-------- 3 files changed, 52 insertions(+), 18 deletions(-) diff --git a/API/Startup.cs b/API/Startup.cs index 558c3eb3..8ae2eb99 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -343,6 +343,7 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment //Seed random users context.User.Add(Seed.SeedPrUser(roles)); context.User.AddRange(Seed.SeedUsers(roles)); + context.User.Add(Seed.SeedDataOfficerUser(roles)); context.SaveChanges(); } } diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 8b035eb1..11a60eca 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -76,6 +76,17 @@ public static List SeedRoles() }; roles.Add(prRole); + Role dataOfficerRole = new Role + { + Name = nameof(Defaults.Roles.DataOfficer), + Scopes = new List + { + new RoleScope(nameof(Defaults.Scopes.RequestUserRead)), + new RoleScope(nameof(Defaults.Scopes.RequestUserDelete)) + } + }; + roles.Add(dataOfficerRole); + Role administratorRole = new Role() { Name = nameof(Defaults.Roles.Administrator), @@ -134,6 +145,20 @@ public static User SeedPrUser(List roles) return user; } + public static User SeedDataOfficerUser(List roles) + { + Role dataOfficerRole = roles.Find(role => role.Name == nameof(Defaults.Roles.DataOfficer)); + User user = new User + { + IdentityId = "919191919", + Email = "dataofficer@dex.software", + Name = "data officer Sam", + Role = dataOfficerRole + }; + + return user; + } + /// /// Seed random projects into the database using fake date from Bogus /// diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index 54f3a1cd..e586d2c0 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -44,6 +44,7 @@ public static class Roles public const string RegisteredUser = "RegisteredUser"; public const string PrUser = "PrUser"; public const string Administrator = "Administrator"; + public const string DataOfficer = "DataOfficer"; } @@ -92,6 +93,13 @@ public static class Scopes [Description("This scope gives write access to the embed namespace")] public const string EmbedRead = "embed:read"; + + [Description("This scope gives read access to user roles for other users within their institution")] + public const string RequestUserRead = "user:request-write"; + + [Description("This scope gives delete access to user roles for other users within their institution")] + public const string RequestUserDelete = "user:request-delete"; + } } From 05286f8a099c855fd2feb6d58edd44405d96b1e6 Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 14:23:19 +0100 Subject: [PATCH 071/157] Added licence text --- Models/Institution.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Models/Institution.cs b/Models/Institution.cs index 34cb48da..2fdff158 100644 --- a/Models/Institution.cs +++ b/Models/Institution.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + namespace Models { From a8a07972e3b71539526eab4e742f95de19f3101a Mon Sep 17 00:00:00 2001 From: I380210 Date: Mon, 26 Oct 2020 16:14:26 +0100 Subject: [PATCH 072/157] Added Id's to UserProject resource so Postman can do testing on Id's instead of random names which fail. --- API/Configuration/MappingProfile.cs | 1 + API/Controllers/ProjectController.cs | 2 +- API/Resources/UserProjectResourceResult.cs | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 67e1f7e4..770792a5 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -39,6 +39,7 @@ public MappingProfile() .ForAllOtherMembers(o => o.Ignore()); CreateMap() + .ForMember(q => q.Id, opt => opt.MapFrom(p => p.Project.Id)) .ForMember(q => q.Name, opt => opt.MapFrom(p => p.Project.Name)) .ForMember(q => q.ShortDescription, opt => opt.MapFrom(p => p.Project.ShortDescription)) .ForMember(q => q.Uri, opt => opt.MapFrom(p => p.Project.Uri)) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 7d01eb9a..8f84bcd8 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -53,7 +53,7 @@ public class ProjectController : ControllerBase /// The user service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. /// - public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper) + public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper, IUserProjectService userProjectService) { this.projectService = projectService; this.userService = userService; diff --git a/API/Resources/UserProjectResourceResult.cs b/API/Resources/UserProjectResourceResult.cs index ab7c377c..17659fbd 100644 --- a/API/Resources/UserProjectResourceResult.cs +++ b/API/Resources/UserProjectResourceResult.cs @@ -11,6 +11,10 @@ namespace API.Resources /// public class UserProjectResourceResult { + /// + /// gets or sets Id of the followed project + /// + public int Id { get; set; } /// /// Set or get Project /// From 8cd8ab2b5672a42c58349a616402d57e84c5bc7b Mon Sep 17 00:00:00 2001 From: I380210 Date: Mon, 26 Oct 2020 16:16:59 +0100 Subject: [PATCH 073/157] Added new postman tests to test following users and projects. Testing uses the id's instead of the names since they can be different and can not be tested. --- Postman/dex.postman_collection.json | 465 ++++++++++++------------- Postman/local.postman_environment.json | 6 +- 2 files changed, 235 insertions(+), 236 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 6c299a68..1f1a23f1 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "87bcd92b-930f-4092-aee5-59f6a37737c1", + "_postman_id": "c54de407-ffd7-40a5-ab60-256ec9aa31ca", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "3415efeb-08b1-44a9-8340-238db3c6120e", + "id": "f5d8ed44-00a2-4fd9-9294-9d50702e1bb0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "529a2b71-6558-4305-b9cf-047fc3ac6dbd", + "id": "11401a35-3e3a-4859-9956-58aea025ad01", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -137,7 +137,7 @@ { "listen": "test", "script": { - "id": "8c2c40d4-e34b-4275-9bef-24720025cbf1", + "id": "2fcd23ea-d897-420e-b7f5-5a210823e63c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = \"Hailie\"", @@ -208,7 +208,7 @@ { "listen": "test", "script": { - "id": "b26f3f9c-895e-4b40-b3d5-096ca94b0b0f", + "id": "e2f1fa52-a285-41f5-95b7-582e7a9caea2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -267,7 +267,7 @@ { "listen": "test", "script": { - "id": "9ae54e26-f32f-4e93-9ca2-f0046952b3ab", + "id": "2f6a6365-54ad-48a8-bdd2-0463b708bf42", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -336,7 +336,7 @@ { "listen": "test", "script": { - "id": "7ab5f5ae-8d87-4092-8e14-ef664094da3e", + "id": "79359131-cfda-482d-92ae-5381b693db68", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -404,7 +404,7 @@ { "listen": "test", "script": { - "id": "7ee1bd20-dd09-4f12-a414-df18d91967dc", + "id": "dbaeea3f-3e64-4183-af06-ac68531caccc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -472,7 +472,7 @@ { "listen": "test", "script": { - "id": "0ae34c24-10b2-4c98-8521-2531967cdde1", + "id": "643a9cda-fa16-4ba6-832a-298f34ece089", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -547,7 +547,7 @@ { "listen": "test", "script": { - "id": "dc34176a-f766-4622-b7fb-489d9257ab3a", + "id": "f435d3a6-e073-4186-bed4-b1ad84ff4162", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -615,7 +615,7 @@ { "listen": "test", "script": { - "id": "287acf8f-aec8-4770-ac9e-e656d54f35e7", + "id": "2dc35744-4217-4b93-bac1-88f021a42c5e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -686,7 +686,7 @@ { "listen": "test", "script": { - "id": "b3503337-aaf8-4db6-94e8-9bc0d8953cb2", + "id": "abe7d8ac-31c0-451b-9d6f-cd0696111daf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -745,7 +745,7 @@ { "listen": "test", "script": { - "id": "6f6ffe45-f584-48d2-b36b-63bb5d22dc93", + "id": "88734621-99a2-4cb1-9d67-1a5dfb3f3c18", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -823,7 +823,7 @@ { "listen": "test", "script": { - "id": "692a4bef-ba4d-40c4-88db-599b546e614b", + "id": "f5a30e3f-460e-492e-b8e7-1cf46be844a5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -896,7 +896,7 @@ { "listen": "test", "script": { - "id": "243b137c-9c9d-4c76-a62f-ff97e45bc4da", + "id": "dfad3e5e-2524-4c5f-8e84-c5dcee01598c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -965,7 +965,7 @@ { "listen": "test", "script": { - "id": "38fafdfc-6fa1-4eda-b75c-63bbfad94687", + "id": "497483c8-e04b-40f6-9722-6986ca9d3dbf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -1033,7 +1033,7 @@ { "listen": "test", "script": { - "id": "6e881525-5aec-4544-89fd-b6c2bd2578ed", + "id": "3c568dcd-375c-4b82-99eb-947f9bdcadf3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -1101,7 +1101,7 @@ { "listen": "test", "script": { - "id": "c25fafdf-d646-4931-9d6c-8c3169bb5bad", + "id": "4e57f7b0-b062-4024-b2c3-409b01144c5c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1161,7 +1161,7 @@ { "listen": "test", "script": { - "id": "99b117cd-ec8a-4c09-aa1b-e83a9bad5c20", + "id": "b9ba46a6-5b5a-4e6c-af4f-c864fb08bf9a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1190,7 +1190,7 @@ { "listen": "prerequest", "script": { - "id": "6ce4d831-9f1c-4d38-8fed-9db80d720c28", + "id": "51244c5b-b52e-4b8c-a650-bc972ece87ed", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -1240,7 +1240,7 @@ { "listen": "test", "script": { - "id": "06de7116-ef01-45b6-b11c-f7aa2378ef30", + "id": "74529bf9-808f-4f7d-9aa6-d2ac0ae6c8d1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1309,7 +1309,7 @@ { "listen": "test", "script": { - "id": "9ce218a2-1db9-47b6-82e1-721e4852ea06", + "id": "d67ed053-387c-4c48-bd0a-44057aed2ecc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1371,7 +1371,7 @@ { "listen": "test", "script": { - "id": "7620b4e0-46e5-417f-9f0a-38f70a2a27d8", + "id": "a74e186b-a1ff-4e20-a106-d8d403e1b4c4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1458,7 +1458,7 @@ { "listen": "test", "script": { - "id": "6fb79dd8-0d96-45ca-a6e6-c68f6c08aed6", + "id": "228f9b5d-f9cc-473f-bcf2-b40d755d7446", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1490,7 +1490,7 @@ { "listen": "prerequest", "script": { - "id": "6d9a50d2-ce3d-489b-969f-a2fef5c9117b", + "id": "9936a9e5-4877-45c8-8bf9-e92a6aea0f8f", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1537,7 +1537,7 @@ { "listen": "test", "script": { - "id": "58a90678-3a2a-4eb4-800c-27a7274ac14c", + "id": "a7927deb-69bc-465c-a986-06d0a65962da", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1596,7 +1596,7 @@ { "listen": "test", "script": { - "id": "43688dbf-597e-4439-a1ed-ae00851cbc02", + "id": "cde84ca8-9d89-4cd3-8a99-229cc05e223a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1657,7 +1657,7 @@ { "listen": "test", "script": { - "id": "d2d1fbd9-c0c9-401b-a86d-0c9c6bd94899", + "id": "0b9739ec-9253-464f-80c6-f6a66c076fa4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1721,7 +1721,7 @@ { "listen": "test", "script": { - "id": "cc59531f-b92f-4cff-82d3-fc0a2a17b4c7", + "id": "24db3085-598d-4407-bdb2-57b85861173c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1790,7 +1790,7 @@ { "listen": "test", "script": { - "id": "186b9cb8-7125-4b08-b316-dab397482f0c", + "id": "929a0966-608d-413c-b36c-4670cb290fdf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1848,7 +1848,7 @@ { "listen": "test", "script": { - "id": "126613ae-0354-4881-8138-93075187cecd", + "id": "b8409b0b-9d9c-44e9-8c3c-3c4c9594106c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1902,7 +1902,7 @@ { "listen": "test", "script": { - "id": "e26cf186-056e-40bd-ac3a-c4f2ec56e8d2", + "id": "42f9ee30-651e-4972-b814-c82d947947d1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1963,7 +1963,7 @@ { "listen": "test", "script": { - "id": "70355788-9a5f-4e33-b285-b1bdf43be5ab", + "id": "7146788c-cc91-4f07-92b0-7277160b211f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -2036,7 +2036,7 @@ { "listen": "test", "script": { - "id": "a42659a0-b745-4e81-b433-192af0538ff4", + "id": "a33ad515-e8a4-467a-9878-57109c8f6269", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -2109,7 +2109,7 @@ { "listen": "test", "script": { - "id": "fa83070e-6ed3-4781-be62-1a5175245e23", + "id": "ca3c5ba7-bc6c-49bb-8f80-e540555285be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2175,7 +2175,7 @@ { "listen": "test", "script": { - "id": "b744ac3b-0d32-46a1-8c70-40d6c753f2b5", + "id": "cd37e67a-dc62-4534-bb9c-b404d8946a2c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2234,7 +2234,7 @@ { "listen": "test", "script": { - "id": "557b8d8d-0a68-4e2d-b770-2b8ac1b6fd07", + "id": "86f086da-bb3f-4004-b16b-80a74c2c2721", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2301,7 +2301,7 @@ { "listen": "test", "script": { - "id": "97c83fc2-a1be-4586-9ab5-f5f670236cb8", + "id": "d98e6e6a-ef32-49d9-9947-29a48e39af60", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2359,7 +2359,7 @@ { "listen": "test", "script": { - "id": "cee7fcfc-dd5d-4f5a-8b02-7d50ccd0a3cd", + "id": "dc781e6b-e69c-40e8-ad74-59224f076cb4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2438,7 +2438,7 @@ { "listen": "test", "script": { - "id": "290c4e77-17a1-407d-b27b-d66d50df9b0a", + "id": "80be28b1-cf5b-4550-aa93-af38a632d311", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2496,7 +2496,7 @@ { "listen": "test", "script": { - "id": "28e97f5d-4d0c-462e-a1e3-604fd26d7d6c", + "id": "a1eb66cd-5051-4920-a5db-794f881fb460", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2557,7 +2557,7 @@ { "listen": "test", "script": { - "id": "e06d65ca-6bdd-4e00-8dfb-b0de09a1312b", + "id": "3696be74-2e79-4818-aa0f-ef3ac4005d45", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2623,7 +2623,7 @@ { "listen": "test", "script": { - "id": "ec4acf5f-6c92-423c-af3b-8dbcd1bbdf81", + "id": "ac1876da-467e-4890-b4c3-83cedd84b21c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2689,7 +2689,7 @@ { "listen": "test", "script": { - "id": "960c6cf7-93ab-450c-bb81-04d3f447c184", + "id": "3b8a4f45-21fe-40c5-840a-ecd8e45ed513", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2734,7 +2734,7 @@ { "listen": "test", "script": { - "id": "ccaee888-6fdc-4f95-9037-7c6e8c4cda65", + "id": "25d668c6-4cdf-485a-b5ef-72e936900a62", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2779,7 +2779,7 @@ { "listen": "test", "script": { - "id": "339fc299-a932-4e93-85dc-92b3003f5444", + "id": "c87cde56-83b3-4bd2-ac61-c49516939e7c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2824,7 +2824,7 @@ { "listen": "test", "script": { - "id": "37e25c5d-45bb-4728-b863-0a03352f07cf", + "id": "2b4710f9-ad41-44f6-a7c8-c70c12c17a6f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2869,7 +2869,7 @@ { "listen": "test", "script": { - "id": "a74e4e22-18c1-44cf-b0cd-5109a00622d2", + "id": "540dfb7e-f11e-495d-999f-e30aa54ad9e8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2914,7 +2914,7 @@ { "listen": "test", "script": { - "id": "bf62a4ee-1f18-4975-a19f-404211635efe", + "id": "285e896e-4927-461c-80d6-3a180efe5458", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2966,7 +2966,7 @@ { "listen": "test", "script": { - "id": "669fd359-8297-4cd7-8f51-f2064aae60fb", + "id": "c0330244-0d12-4947-b25c-c47d09174d24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3017,7 +3017,7 @@ { "listen": "test", "script": { - "id": "8def5c38-80f8-4ee0-b941-d74197db5104", + "id": "1b7211ff-7415-4d0f-bd56-ee51df099435", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3068,7 +3068,7 @@ { "listen": "test", "script": { - "id": "bd3137e6-09e0-458b-a89c-b6eb523a2b90", + "id": "bcd7c41b-62af-4240-9b6d-8ea31e4221b0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3119,7 +3119,7 @@ { "listen": "test", "script": { - "id": "6ffe6def-a448-46fd-a733-db362f81db95", + "id": "f673faa0-5a79-413e-9505-b1ee210ba2b1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3170,7 +3170,7 @@ { "listen": "test", "script": { - "id": "86608f26-8e4f-44cd-b1be-5a5f3f3f8170", + "id": "0cd76ed8-b149-49c4-8b25-b0f155e55937", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3235,7 +3235,7 @@ { "listen": "test", "script": { - "id": "e7c99083-8bf1-48b1-9d0d-1c77c0f0a22c", + "id": "b809dc1b-09e3-47fb-9007-9f22e6faa25b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3313,7 +3313,7 @@ { "listen": "test", "script": { - "id": "98bbcffa-0abf-4112-81e4-76f6f46c22d1", + "id": "c0754a53-460e-4a45-b84b-63871f72830f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3342,7 +3342,7 @@ { "listen": "prerequest", "script": { - "id": "43fe1d19-fa88-4b79-8dc5-29da48f30794", + "id": "94a650b4-2879-41cc-a359-b2143f580c76", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3392,7 +3392,7 @@ { "listen": "test", "script": { - "id": "fd8d86d1-228b-48e5-b212-33cb49e13a8c", + "id": "0d2b1e03-4513-43e8-b247-8599dfde6ec9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3456,7 +3456,7 @@ { "listen": "prerequest", "script": { - "id": "889aafe2-90a3-4391-81fe-2044f8db97ed", + "id": "bf012fb0-9eb4-406f-9c1c-390fe5381774", "type": "text/javascript", "exec": [ "" @@ -3466,7 +3466,7 @@ { "listen": "test", "script": { - "id": "4d2f90a8-9f8d-4b40-b408-92b5d446e8a0", + "id": "764e3569-ae6a-4a7a-ab2d-9c7a441e40b9", "type": "text/javascript", "exec": [ "" @@ -3489,10 +3489,9 @@ { "listen": "test", "script": { - "id": "9d12f59d-daa3-41cb-abb9-067bfa00bf66", + "id": "27d3729b-34f3-421b-836e-dee26879322a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = \"Hailie\"", "", "var jsonData = pm.response.json();", "", @@ -3551,7 +3550,7 @@ { "listen": "test", "script": { - "id": "5fc04efd-d264-4ec9-9c6c-42abd9e97cb4", + "id": "d97b5623-df0e-46ac-8007-57a6272e10ed", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3610,7 +3609,7 @@ { "listen": "test", "script": { - "id": "f569ba9a-6aca-417c-986d-2cd5add7f5a7", + "id": "40a8dc28-23fe-4519-a8c7-628470f84eb5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3668,7 +3667,7 @@ { "listen": "test", "script": { - "id": "d6c6e1ae-9fec-43c9-9627-ee2a0c75883d", + "id": "bbe65e41-4f5e-4efd-b537-c1235a181379", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3726,7 +3725,7 @@ { "listen": "test", "script": { - "id": "f5493b86-bfdf-4f4d-b1d8-0d0717cdc517", + "id": "37365e17-ee92-4af2-87a7-ec2006807440", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3784,7 +3783,7 @@ { "listen": "test", "script": { - "id": "aeb80cf2-6b1d-48a4-aef2-58666f80ee41", + "id": "208f18bd-4204-47a2-867c-9510df558326", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3834,7 +3833,7 @@ { "listen": "test", "script": { - "id": "e84179f0-d219-450a-94ea-b8435f7e304c", + "id": "fe44feba-987a-4bfe-97dd-d051b45eec15", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3893,7 +3892,7 @@ { "listen": "test", "script": { - "id": "275a316a-bc58-4237-b451-59181b708141", + "id": "16e8100b-43ce-4473-a77c-76c255060bce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3942,7 +3941,7 @@ { "listen": "prerequest", "script": { - "id": "1d59a311-70a5-41b4-8c7c-ec8e3970fc70", + "id": "1b7e3cac-90aa-443a-8410-3033a47a3486", "type": "text/javascript", "exec": [ "" @@ -3952,7 +3951,7 @@ { "listen": "test", "script": { - "id": "3a6c58f3-ec2e-431f-ae7d-be0c45b78228", + "id": "a50fd3bb-6f03-4677-9b4a-5f1cdc04ea13", "type": "text/javascript", "exec": [ "" @@ -3975,7 +3974,7 @@ { "listen": "test", "script": { - "id": "405bb2c3-45fb-4955-bcba-6b3ad52b0771", + "id": "bd003c13-2596-43de-a6ff-4f60717d00d3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -4037,7 +4036,7 @@ { "listen": "test", "script": { - "id": "d4fc2373-9aa7-46b7-9d12-23ef34ce9480", + "id": "c2553572-79c5-476a-8aa4-5e2f5d59381b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4096,7 +4095,7 @@ { "listen": "test", "script": { - "id": "f31eecf3-101e-45d8-896c-93b6829ef997", + "id": "5adc7ee4-89d0-4303-bbbe-7fab5cd08633", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4156,7 +4155,7 @@ { "listen": "test", "script": { - "id": "ed928136-0f9f-4517-a165-88278771235e", + "id": "7d261aa4-0677-4d3f-9249-de64f7a7d328", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4226,7 +4225,7 @@ { "listen": "test", "script": { - "id": "de8abdfd-be95-41ee-a438-880a78ed9e57", + "id": "0a40b9b1-2c2e-476e-8afa-b53e261f3961", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4281,7 +4280,7 @@ { "listen": "test", "script": { - "id": "956adc17-e4e2-481d-a319-fc563430356a", + "id": "5e173c38-02b7-4d15-b1a1-5dc99147ee12", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4338,7 +4337,7 @@ { "listen": "test", "script": { - "id": "4940a995-6afd-4045-a20f-714037ba0df7", + "id": "177b300a-dc4a-499e-b0af-570dca3d21ef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4387,7 +4386,7 @@ { "listen": "prerequest", "script": { - "id": "9cdb4743-ed03-4229-9b63-994a17209b2a", + "id": "cdf91290-dc74-4b62-a9b3-9011ab15808e", "type": "text/javascript", "exec": [ "" @@ -4397,7 +4396,7 @@ { "listen": "test", "script": { - "id": "94317dc8-4595-49eb-8ef1-4d7846c54298", + "id": "94395f2b-5826-4a5a-b11b-e33a75c14235", "type": "text/javascript", "exec": [ "" @@ -4417,7 +4416,7 @@ { "listen": "test", "script": { - "id": "d4d0d510-5377-4273-b398-4d9669311a85", + "id": "5a263b5f-5ca6-4fa1-9fd9-bad7b47ac0f9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4444,7 +4443,7 @@ { "listen": "prerequest", "script": { - "id": "b456dde9-2a41-4384-b450-4e88819292ce", + "id": "391ea137-2e81-419d-90f3-7b6e7b1de095", "exec": [ "" ], @@ -4483,7 +4482,7 @@ { "listen": "test", "script": { - "id": "9f205e7c-a6a0-4141-80ab-31561476a4c0", + "id": "12215fa1-14bd-4d6d-9af7-43218c99a013", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4528,7 +4527,7 @@ { "listen": "test", "script": { - "id": "0b25d214-e133-4301-9d50-ddb80d04e8c0", + "id": "7a6138e5-949c-44a3-80c4-d821b5888cce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4583,7 +4582,7 @@ { "listen": "test", "script": { - "id": "8a56b167-bf41-4b17-be1c-58082dec9824", + "id": "68daa9a7-c36a-40fc-bafc-aecb5d85c87e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4632,7 +4631,7 @@ { "listen": "test", "script": { - "id": "a9124968-82c1-4d18-a433-9e9a7eefa06c", + "id": "a68ddbd8-84f3-453b-93b5-c1140862b727", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4659,7 +4658,7 @@ { "listen": "prerequest", "script": { - "id": "c44a8d2d-cfde-44c5-91c0-f78ce1011a55", + "id": "ae9f46fb-1091-4b13-82ce-d5df82000504", "exec": [ "" ], @@ -4699,7 +4698,7 @@ { "listen": "test", "script": { - "id": "348f6246-fa7c-4959-90c9-73833a2506b1", + "id": "65390442-4e16-4d74-b017-769845bc1afc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4748,7 +4747,7 @@ { "listen": "prerequest", "script": { - "id": "d70f8336-aab5-41c5-86c9-21afb9b280e8", + "id": "bdde43a7-7e7d-4028-8235-d7627efe0bc5", "type": "text/javascript", "exec": [ "" @@ -4758,7 +4757,7 @@ { "listen": "test", "script": { - "id": "e75b3c22-ec2d-4e82-97ed-16158c27a16e", + "id": "d8b4be2e-4360-4720-806f-1cecc3d0b6b2", "type": "text/javascript", "exec": [ "" @@ -4778,7 +4777,7 @@ { "listen": "test", "script": { - "id": "2ad1d526-a72e-4d0f-b45a-4dc92340f58e", + "id": "2c96b4a1-3281-4f78-84e4-aa559b66558e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4833,7 +4832,7 @@ { "listen": "test", "script": { - "id": "32fe3e45-3ac4-47f2-bac2-30334702a3c6", + "id": "594d650a-1a18-4cdc-bb4a-1f94046bafae", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4879,7 +4878,7 @@ { "listen": "test", "script": { - "id": "dcd2885d-69b0-4e2a-a5f0-38b146880df5", + "id": "978860f6-5d82-4879-ae57-99f4b3c31d43", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4926,7 +4925,7 @@ { "listen": "test", "script": { - "id": "af38008a-4aff-475f-89e6-7d93aac608ff", + "id": "a94b6c8e-0076-4211-94fb-922ecd93843d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4975,7 +4974,7 @@ { "listen": "prerequest", "script": { - "id": "d3fb6133-8b0e-4b96-a0ba-06ea6fd7b479", + "id": "0267db72-7c24-42d6-a358-892c26685875", "type": "text/javascript", "exec": [ "" @@ -4985,7 +4984,7 @@ { "listen": "test", "script": { - "id": "f4dd093b-d580-4dff-9a84-a69dc44e8d1a", + "id": "a376a167-dc95-4828-ad9f-ae9c366cd6b3", "type": "text/javascript", "exec": [ "" @@ -5005,7 +5004,7 @@ { "listen": "test", "script": { - "id": "2e37d845-1719-4f49-a395-b4ea2bc33353", + "id": "3698854a-6357-4f29-8a64-c54320b154b3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5061,7 +5060,7 @@ { "listen": "test", "script": { - "id": "123a115d-e03e-4ac3-9cfb-15a1c236406a", + "id": "ea78a7b0-57f2-4aa0-a0a7-521e70d47b86", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5108,7 +5107,7 @@ { "listen": "test", "script": { - "id": "f8d87263-342b-4d32-bdde-08d3351d7813", + "id": "0cacf42a-1a5a-43e0-925c-2b5b4df03a0e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5156,7 +5155,7 @@ { "listen": "test", "script": { - "id": "788ed43b-c45a-46ec-bcf3-3ec5ac30e1b5", + "id": "579cea97-f5b4-4d69-96c0-4011dfc27d6f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5204,7 +5203,7 @@ { "listen": "test", "script": { - "id": "223451e7-b0d5-4a05-b030-66ec1003c39c", + "id": "d457dd13-513b-41fc-a2bd-db47922865c6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5261,7 +5260,7 @@ { "listen": "test", "script": { - "id": "210efb08-e192-4b27-8d2d-6cc881c952f9", + "id": "400f8790-4f3d-44d2-9f6d-e92547c9a1b3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5332,7 +5331,7 @@ { "listen": "prerequest", "script": { - "id": "927376a6-7594-4cbc-8939-fb23d6347d29", + "id": "5ae4340d-76c1-4b6e-9e61-d5d0e2de48a0", "type": "text/javascript", "exec": [ "" @@ -5342,7 +5341,7 @@ { "listen": "test", "script": { - "id": "cfd7cc0e-ae53-4786-8684-1cb0890e017a", + "id": "9132f5f6-7d6e-4e3b-ba45-6134da07aad1", "type": "text/javascript", "exec": [ "" @@ -5362,7 +5361,7 @@ { "listen": "test", "script": { - "id": "18549450-5d4c-4ff9-8a5e-ca147880c54b", + "id": "a9627585-46a2-4355-a186-32c36a3a8eb5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5413,7 +5412,7 @@ { "listen": "prerequest", "script": { - "id": "83cfd939-a951-40c5-afda-552f50ccf153", + "id": "6439f54f-b988-4403-8a44-94bfbf9e4a9e", "type": "text/javascript", "exec": [ "" @@ -5423,7 +5422,7 @@ { "listen": "test", "script": { - "id": "76a652ca-8fb0-4b77-833f-145bd5160cce", + "id": "14ec6494-667e-4b7f-a9a9-2220ae4bb61a", "type": "text/javascript", "exec": [ "" @@ -5443,7 +5442,7 @@ { "listen": "test", "script": { - "id": "2aae1abf-408d-4f0d-a3b4-9df1ca861910", + "id": "5ca14176-dd63-4ed2-a3fc-9b4a509e1fba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5499,7 +5498,7 @@ { "listen": "prerequest", "script": { - "id": "fbacf122-a3f1-4525-a1e8-88f6e29824bf", + "id": "c24994aa-1eb0-4b0e-af5f-55b662f1e5e2", "type": "text/javascript", "exec": [ "" @@ -5509,7 +5508,7 @@ { "listen": "test", "script": { - "id": "724686a9-00cc-47cd-a5ed-f778fd7c5c95", + "id": "4969e67e-c49b-413b-b9ff-7f6fc089cd8b", "type": "text/javascript", "exec": [ "" @@ -5525,7 +5524,7 @@ { "listen": "prerequest", "script": { - "id": "64a0f5f6-404f-4443-89ce-b7c470b929c3", + "id": "199a7297-862c-4753-a3ce-bade21e0acee", "type": "text/javascript", "exec": [ "" @@ -5535,7 +5534,7 @@ { "listen": "test", "script": { - "id": "d89ae775-f38f-4630-9fc1-5ac76dbab80f", + "id": "0115bb0e-2dbe-4113-bac1-fad1e1361a73", "type": "text/javascript", "exec": [ "" @@ -5558,7 +5557,7 @@ { "listen": "test", "script": { - "id": "ebb10d5b-77eb-415b-b38e-00cb24d8e3fe", + "id": "4981b31c-931a-490b-8ad0-2dd702d99822", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5627,7 +5626,7 @@ { "listen": "test", "script": { - "id": "2305df9c-9028-43ce-b1cc-5c8ed744b53a", + "id": "d20c2f9e-7d40-4051-9fa5-206e6ce55578", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5706,7 +5705,7 @@ { "listen": "test", "script": { - "id": "bfe9e171-309b-441a-8b3f-1daa3263bdd1", + "id": "e0fc8411-cee9-4b27-ae4b-7a7d63ae9fba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5735,7 +5734,7 @@ { "listen": "prerequest", "script": { - "id": "f623e1cd-0607-48c5-8568-d2475682543e", + "id": "98a24517-4b28-47a1-a59b-170623e34775", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5785,7 +5784,7 @@ { "listen": "test", "script": { - "id": "7f5b764b-0540-4a90-8297-441445fa4b99", + "id": "ed214db1-e51d-4c39-9ddc-054dc9a59b29", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5850,7 +5849,7 @@ { "listen": "test", "script": { - "id": "f41e6068-3325-4603-8e8e-cbefab149620", + "id": "21a5c5f5-9f2d-4603-bb12-9b99c53d2cc0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5923,7 +5922,7 @@ { "listen": "prerequest", "script": { - "id": "1bc765df-497e-4b29-9f9e-a9005bf5e6b0", + "id": "c57ff460-0df8-44ec-8143-0b326b89ebad", "type": "text/javascript", "exec": [ "" @@ -5933,7 +5932,7 @@ { "listen": "test", "script": { - "id": "902d672a-ef19-4744-9150-fef0718faee6", + "id": "115c72ee-9a51-4cce-a24a-a4469fdc425f", "type": "text/javascript", "exec": [ "" @@ -5956,10 +5955,10 @@ { "listen": "test", "script": { - "id": "37e84333-0a77-4d1d-bb3f-7391bd039d68", + "id": "c64c960e-5213-4e2e-811a-884341450dd5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = \"Hailie\"", + "var userId = 25", "", "var jsonData = pm.response.json();", "", @@ -5980,8 +5979,8 @@ " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", "});" ], "type": "text/javascript" @@ -6027,7 +6026,7 @@ { "listen": "test", "script": { - "id": "7178a83a-970c-4f28-8f73-778c0caf68de", + "id": "5e6ffa2e-7bdb-474a-8913-cab963128f36", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6086,7 +6085,7 @@ { "listen": "test", "script": { - "id": "91ea27d9-0be0-4e2a-8338-8b79f3d3b999", + "id": "a83eb450-c47c-45c1-98f4-44fe326a6e37", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6146,7 +6145,7 @@ { "listen": "test", "script": { - "id": "e09471c5-34ef-41cb-9d9e-fd8fb4f94358", + "id": "9f9436af-a9aa-4cf5-8783-1e938d7aad0a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6209,7 +6208,7 @@ { "listen": "test", "script": { - "id": "fc5a8c5b-7a0f-4273-a79c-5e63d9775a9c", + "id": "3c3584d3-4bd2-4e7e-a19e-1eaa662f96b4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6272,7 +6271,7 @@ { "listen": "test", "script": { - "id": "0205bcbb-5884-4ad4-8195-20b48e1084a0", + "id": "ab914c3b-d574-4675-963f-1b2722e61ff3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6329,7 +6328,7 @@ { "listen": "test", "script": { - "id": "874176a4-8f81-4bc4-98ea-aa7513bfedaf", + "id": "7b6e014d-afa9-4390-a7ac-9889a4f77765", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6382,7 +6381,7 @@ { "listen": "test", "script": { - "id": "bd897fe3-0e30-484f-bc29-d8320ed4d0da", + "id": "58cbc7a2-46c4-431c-af18-2878d5331c11", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -6440,7 +6439,7 @@ { "listen": "test", "script": { - "id": "0715648b-54ac-4979-8fa2-5217680038bf", + "id": "c55acd5f-db3a-43b4-aded-ef35a2d87941", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -6507,7 +6506,7 @@ { "listen": "test", "script": { - "id": "ccd36a14-6440-4757-81e5-792edc95c859", + "id": "b6c6710c-8195-4830-a0f5-fd3771452c24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6569,7 +6568,7 @@ { "listen": "prerequest", "script": { - "id": "99373590-b848-4271-80fe-9614ce90b4d1", + "id": "f322dcae-8b64-44fb-ae81-63b9c4a2df8b", "type": "text/javascript", "exec": [ "" @@ -6579,7 +6578,7 @@ { "listen": "test", "script": { - "id": "3a4e309f-1ff8-4e19-9800-469c5b31a755", + "id": "8cd72ace-6a62-4323-873d-f24785dd692c", "type": "text/javascript", "exec": [ "" @@ -6602,7 +6601,7 @@ { "listen": "test", "script": { - "id": "7532e929-2bca-4537-86e8-532d2442cd73", + "id": "72cea572-ec07-443a-9e04-c8448d2f4f24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -6673,7 +6672,7 @@ { "listen": "test", "script": { - "id": "17328367-b943-4634-a860-c6d14cc434bc", + "id": "e473501e-5c09-455a-b9f7-e12f648d0a9d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6732,7 +6731,7 @@ { "listen": "test", "script": { - "id": "da27776b-00ab-4e24-81c2-3d9005c7c766", + "id": "21b3f89d-de83-40f0-abb9-21ee66350267", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6798,7 +6797,7 @@ { "listen": "test", "script": { - "id": "70a289b4-2136-4521-9ed7-f3f5d3c16e6b", + "id": "82dd5e58-f1ba-4ee3-9558-610d49a69088", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6871,7 +6870,7 @@ { "listen": "test", "script": { - "id": "7d78523e-e636-4cb0-b65c-2f2b71a339e4", + "id": "34496339-0b51-4e06-acbe-01a892edd397", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6929,7 +6928,7 @@ { "listen": "test", "script": { - "id": "6f1e9d16-dba9-484e-b3dd-9c8b6bc85a36", + "id": "a9d945f2-96ab-4085-af9f-770fbc9d5cc8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6979,7 +6978,7 @@ { "listen": "test", "script": { - "id": "88436bbe-4b0f-4893-bc32-7adc6abd3e60", + "id": "9af6a8fe-a32c-4e60-a335-443c28a98baa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -7046,7 +7045,7 @@ { "listen": "test", "script": { - "id": "dbec3f69-9895-4a36-a768-de9011126769", + "id": "0bb02801-b093-4457-80ba-e68aec868ff9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7113,7 +7112,7 @@ { "listen": "test", "script": { - "id": "0de8a2b0-618d-4727-9dfc-9c1774dc9d4e", + "id": "5d073d92-d652-4928-97db-694030da9c2f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7177,7 +7176,7 @@ { "listen": "test", "script": { - "id": "298f55fa-20ae-4c0a-92de-a3aba255250f", + "id": "dddad3a8-dfd5-49ea-9e09-f89721332731", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7238,7 +7237,7 @@ { "listen": "test", "script": { - "id": "598e788e-0a2b-4878-beca-e91776535040", + "id": "4a39d382-13f4-4906-814a-bf5d12eb36ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7290,7 +7289,7 @@ { "listen": "test", "script": { - "id": "df306696-978d-4cd3-acd1-adfed80be4cf", + "id": "ffac37e7-bec5-4391-80bb-3fa99da28ee3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -7355,7 +7354,7 @@ { "listen": "test", "script": { - "id": "a51481bd-e084-4e02-91b4-0f1fac1ea5d7", + "id": "4dfd3735-5c20-470f-b1ad-88b31a819c0d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7381,7 +7380,7 @@ { "listen": "prerequest", "script": { - "id": "049169a7-0260-4cf4-875d-213c39f8da39", + "id": "973ba179-b34a-42e2-a931-45fc0b3de03c", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -7431,7 +7430,7 @@ { "listen": "test", "script": { - "id": "3358c856-c92c-441f-8f0d-ba566c7d7960", + "id": "720e5304-d7fe-49a8-8073-3c2a38011dbc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -7500,7 +7499,7 @@ { "listen": "test", "script": { - "id": "e610ffdd-f207-4e52-9611-7064eec1c536", + "id": "8c0272e6-0fa1-4ae2-b2d1-cea59632016b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -7562,7 +7561,7 @@ { "listen": "test", "script": { - "id": "de8f304d-d695-409c-9e66-715252b8bc10", + "id": "8cde6133-d1d0-4c45-8a21-d7547648da98", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7617,7 +7616,7 @@ { "listen": "test", "script": { - "id": "19a444c3-d12d-4231-8782-4b66f605688a", + "id": "14ef97de-bd75-4269-81be-a28aa2306d12", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7686,7 +7685,7 @@ { "listen": "test", "script": { - "id": "13d4e71b-c891-4808-9e6f-3212f7077cb0", + "id": "dea07047-e4ad-4228-960e-47d57df939a8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7747,7 +7746,7 @@ { "listen": "test", "script": { - "id": "ab6b88f5-f7cd-41a6-9214-146b77507ed4", + "id": "1fd2431e-da52-4dd8-a268-328bf4471c57", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7799,7 +7798,7 @@ { "listen": "test", "script": { - "id": "67b24c11-d444-4a05-9322-a3cadfba54c5", + "id": "c052239f-a84d-4f61-b163-4f8ea834782f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7852,7 +7851,7 @@ { "listen": "test", "script": { - "id": "1ad43cc3-177c-414c-a8a2-b20b12b56d73", + "id": "90b02be2-2104-4804-8eff-7e4b4acb5d21", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7905,7 +7904,7 @@ { "listen": "test", "script": { - "id": "99426315-de87-4ae4-a0ad-955e357c04f3", + "id": "dd24b0d8-a25c-4bac-acf3-c1377d5f2ba2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7967,7 +7966,7 @@ { "listen": "test", "script": { - "id": "73e8d65c-73fd-406e-852c-1de0268991df", + "id": "62ddb0dd-aae9-4546-a3f4-723f1e055161", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8048,7 +8047,7 @@ { "listen": "test", "script": { - "id": "3f6441c9-b36a-4722-a2d8-5f5cd57dc49f", + "id": "e09d43d8-4c7b-4ad1-8fdb-a408b3def6a8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8107,7 +8106,7 @@ { "listen": "test", "script": { - "id": "3cd95667-559d-4c69-ad32-90c664b290e0", + "id": "dd9fee6b-2ef8-4559-ae1d-f8637f70fbda", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -8173,7 +8172,7 @@ { "listen": "test", "script": { - "id": "f4574f79-0fd2-4c66-beb2-18518b3e3be0", + "id": "cb4c4db4-03aa-45f7-81c6-c139324c2c5f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8222,7 +8221,7 @@ { "listen": "test", "script": { - "id": "69b175b0-45c4-4036-add9-2632f98869c6", + "id": "a990b20c-4fc3-4d0a-95d7-6b7866f09f47", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8273,7 +8272,7 @@ { "listen": "test", "script": { - "id": "f5dbb78e-bff0-44e6-952b-471c8c1fbe04", + "id": "6ae93808-2567-4259-b37c-1336cda83a7f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8324,7 +8323,7 @@ { "listen": "test", "script": { - "id": "14192d70-5ab7-46fb-a5e7-e5ed0bedc424", + "id": "b539add5-4d0c-4adf-9ab6-9ecf41a4e69e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8369,7 +8368,7 @@ { "listen": "test", "script": { - "id": "1cee0e3a-ac3b-455b-8701-d2747a121bd4", + "id": "48e99a28-8d4a-4bc6-9cf9-b78fede7f41d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8420,7 +8419,7 @@ { "listen": "test", "script": { - "id": "73060625-c1e1-4a96-ba30-b307d75a308a", + "id": "c9004983-af54-4c19-8954-8a818c19bfa0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8471,7 +8470,7 @@ { "listen": "test", "script": { - "id": "6cb284d4-7a70-4942-950b-ce7f243b2882", + "id": "37387301-1a79-4f1b-a579-74bdc699bdc0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8536,7 +8535,7 @@ { "listen": "test", "script": { - "id": "86d75a7e-2ba4-4313-b4c1-a876fe24eb32", + "id": "a1bdaaef-5c2c-4eda-b501-b9d0bc2baf47", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8605,7 +8604,7 @@ { "listen": "test", "script": { - "id": "a7c80da4-0c6b-461a-a50b-6c58a4edebfa", + "id": "487207ca-1558-4bc9-b039-11737d626d42", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8684,7 +8683,7 @@ { "listen": "test", "script": { - "id": "d1681d9f-d9eb-400d-9a6d-fd8ecca7c79e", + "id": "0eefb976-2fdd-4d25-9e80-05ab89844ea5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8713,7 +8712,7 @@ { "listen": "prerequest", "script": { - "id": "3fab5196-9963-4a65-9b97-cb12e74f1fd8", + "id": "efc8ea84-8e3b-4143-8a03-4cbe232eb1d5", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8763,7 +8762,7 @@ { "listen": "test", "script": { - "id": "4bd15b0e-9b23-4e37-9557-c74f94052c5a", + "id": "e023c0e5-ccf5-4322-a4b2-2962d9e7fdea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8827,7 +8826,7 @@ { "listen": "test", "script": { - "id": "a1a717be-5b52-4c13-b130-74532a5562e8", + "id": "39b9160f-f620-4a24-b38a-4cc4ae798ae3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8900,7 +8899,7 @@ { "listen": "prerequest", "script": { - "id": "3073b7ea-cdc2-46fe-bdd7-8fccd41d9c16", + "id": "fed9ee17-94d4-41e7-9599-2019c7e514cf", "type": "text/javascript", "exec": [ "" @@ -8910,7 +8909,7 @@ { "listen": "test", "script": { - "id": "9962391e-6a04-4b9d-b2ea-28a93844e89f", + "id": "727be0aa-423e-4663-8919-69176e7fc878", "type": "text/javascript", "exec": [ "" @@ -8933,10 +8932,10 @@ { "listen": "test", "script": { - "id": "4584d09c-d869-4f99-8bbd-2d8ea7db7e91", + "id": "88dfed2e-a666-4628-852f-cfb44aaac80b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = \"Hailie\"", + "var userId = 25", "", "var jsonData = pm.response.json();", "", @@ -8957,8 +8956,8 @@ " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", "});" ], "type": "text/javascript" @@ -9004,7 +9003,7 @@ { "listen": "test", "script": { - "id": "b1db8446-b232-432f-825b-cc90c8414906", + "id": "136e8b41-6dd0-441f-a07c-dea9aadb8cc6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9063,7 +9062,7 @@ { "listen": "test", "script": { - "id": "e4564fe6-7891-489b-a24d-1ba47346d128", + "id": "60738091-6dde-42e4-a497-a8c026a521da", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9123,7 +9122,7 @@ { "listen": "test", "script": { - "id": "7ca4c33d-d336-4cd3-adba-395f4884199d", + "id": "600daa22-b83b-4fc3-9c8a-81773f80052a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9183,7 +9182,7 @@ { "listen": "test", "script": { - "id": "d45e0960-0000-4056-98a0-c28087fcc4b4", + "id": "b4b5f98f-a09b-492e-b511-c2f7b7a60d77", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9236,7 +9235,7 @@ { "listen": "test", "script": { - "id": "9cf3cc38-154e-4839-bb34-8b765e865793", + "id": "04e02e09-653e-4bc8-99cd-63f643708f7c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -9294,7 +9293,7 @@ { "listen": "test", "script": { - "id": "a53ccfcf-83b7-4a54-8ff2-9fd47fdbf207", + "id": "3f7c96f0-290e-4ebd-b976-997052befb28", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -9361,7 +9360,7 @@ { "listen": "test", "script": { - "id": "aa729705-c6f9-48a2-9fc2-e75d48b7bb39", + "id": "f2eff21a-d7fc-4cf0-b283-1f63e48888ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9423,7 +9422,7 @@ { "listen": "prerequest", "script": { - "id": "0eb4be27-3b1e-4140-af7e-8aa76f42e299", + "id": "e98fec99-fbe4-4918-bae9-4d033a1c8b58", "type": "text/javascript", "exec": [ "" @@ -9433,7 +9432,7 @@ { "listen": "test", "script": { - "id": "32db062f-6a84-4131-a715-7d63bc2feb13", + "id": "b17c5854-12e4-4341-a601-8f9d02469bf6", "type": "text/javascript", "exec": [ "" @@ -9456,7 +9455,7 @@ { "listen": "test", "script": { - "id": "a72b41af-06e1-4c17-968c-da98431ecde8", + "id": "5378b1d1-53c7-4fb1-8e6b-b1ef3c39ee06", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -9527,7 +9526,7 @@ { "listen": "test", "script": { - "id": "a4723ae3-89c8-40f5-b1ca-44f1f10eee7b", + "id": "9a1e5bed-b4f4-4ae9-8a74-a50406115154", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9586,7 +9585,7 @@ { "listen": "test", "script": { - "id": "626162f1-0517-4f7d-b5c7-7d718f65bc2f", + "id": "31140aed-1e65-4478-9d1e-1db0210c9181", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -9652,7 +9651,7 @@ { "listen": "test", "script": { - "id": "4041da04-18c8-42be-badf-512516b7fa53", + "id": "16a83ccb-2390-45a5-9a32-1e97b3ab1b21", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9725,7 +9724,7 @@ { "listen": "test", "script": { - "id": "f8b70da0-78ca-4b7d-820d-00f609531e0e", + "id": "dfe0aa8f-9b2f-46d4-8b37-81c2658aba85", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9783,7 +9782,7 @@ { "listen": "test", "script": { - "id": "c5c011bc-40db-41d4-9222-6a246956826d", + "id": "15540a03-7de0-4287-8cba-3e40199ca923", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -9833,7 +9832,7 @@ { "listen": "test", "script": { - "id": "b900bf7d-099e-4ae5-935b-173e6e04612a", + "id": "a4e84ff2-6f1f-4bdb-9434-da59c3c4f44e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -9900,7 +9899,7 @@ { "listen": "test", "script": { - "id": "0f35f244-ac36-44d3-8913-7a5b017ed57f", + "id": "3be52a6a-d7c4-4dfc-854d-7ad2fea0d507", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9967,7 +9966,7 @@ { "listen": "test", "script": { - "id": "078e1158-12d7-48cf-a5c7-201fb5a1deb5", + "id": "da77376d-bc92-4c5b-928a-d923ce79ca06", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10031,7 +10030,7 @@ { "listen": "test", "script": { - "id": "b0c4ed4b-f882-41d9-b17a-e59ded461fbe", + "id": "670d4d07-adde-4866-969d-e093cbd7d4dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10095,7 +10094,7 @@ { "listen": "test", "script": { - "id": "92efd26c-c091-4972-851f-509e94753019", + "id": "2257b5e6-57b1-47f9-9769-cff532f98aea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10147,7 +10146,7 @@ { "listen": "test", "script": { - "id": "45eb84a1-ddcf-4bfc-bd2f-7f845d99452f", + "id": "2a0d8b41-64ca-4b23-b526-64bfba1b98f0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -10205,7 +10204,7 @@ { "listen": "test", "script": { - "id": "10ad0812-48d9-488f-b60d-2238169c981d", + "id": "5695f8f9-237d-49e2-a415-09fa9886d528", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -10270,7 +10269,7 @@ { "listen": "test", "script": { - "id": "e6cc5d02-3b27-47a5-9a7b-ffbfbb5716cf", + "id": "c6b8aad7-092c-4226-a18c-2c64974c655c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10298,7 +10297,7 @@ { "listen": "prerequest", "script": { - "id": "e73d5684-8a33-421c-a298-5a679635136e", + "id": "b901fc38-90f8-45e9-9907-c34944acb6a5", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10348,7 +10347,7 @@ { "listen": "test", "script": { - "id": "78e143b3-fa97-417a-a77f-aa69bd1b89a9", + "id": "40607808-dd37-46ad-91e9-4b76ce0690f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10410,7 +10409,7 @@ { "listen": "test", "script": { - "id": "2870f74a-1eb4-4c5f-9873-29d0deacae94", + "id": "c23f6d89-f9ab-4ff6-83fd-40086d1daa09", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10497,7 +10496,7 @@ { "listen": "test", "script": { - "id": "95833f0f-c9ec-43db-9554-58875a6b860f", + "id": "31cc74bd-2bf8-4717-84f9-01564c704942", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10523,7 +10522,7 @@ { "listen": "prerequest", "script": { - "id": "5e62987a-59d2-49a4-8fbe-70773a257969", + "id": "9d27652b-60bf-48b8-a48c-50d063e720ba", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10570,7 +10569,7 @@ { "listen": "test", "script": { - "id": "3ac7cacd-fd54-4259-9f64-91ce1ef8d0c7", + "id": "a0793976-b8a8-4c95-abb5-9be767e390b0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10597,7 +10596,7 @@ { "listen": "prerequest", "script": { - "id": "2672a24f-9794-45ac-960c-c2642b8f79f5", + "id": "980453fa-850b-4b71-8e77-208287610b1d", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10647,7 +10646,7 @@ { "listen": "test", "script": { - "id": "41c18b70-27f3-4cba-9577-d4b032fe3d6d", + "id": "7f68d01c-c465-4294-9e6b-1954347fbebc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10709,7 +10708,7 @@ { "listen": "test", "script": { - "id": "c267e17a-ca35-4ec9-8829-b37fcbedb421", + "id": "f68fe8be-866c-4647-8419-1f5793aa5bef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10796,7 +10795,7 @@ { "listen": "test", "script": { - "id": "4b24201b-fd5b-4fb7-803c-67d6b038ad7b", + "id": "a99dc595-4212-4909-8776-c74457087e17", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10822,7 +10821,7 @@ { "listen": "prerequest", "script": { - "id": "2198fd5a-c82b-4f40-bcf1-446422e89706", + "id": "748b4426-4cb5-4914-b8ba-b01cb3e82cdf", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10869,7 +10868,7 @@ { "listen": "test", "script": { - "id": "f88bc669-dfb4-4981-b62d-77260e639d70", + "id": "5f6b625c-74fb-4cda-9044-72fd9ae38299", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10945,7 +10944,7 @@ { "listen": "test", "script": { - "id": "6ca1d0dc-3f40-48dc-b9f2-562995303c27", + "id": "98d9749e-fe1c-424b-a91b-150465c37e4d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11006,7 +11005,7 @@ { "listen": "test", "script": { - "id": "5deee44c-c2c2-4fa1-8577-038884b39f8e", + "id": "3b41c3c7-acea-4107-8612-7aba6a9be859", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11058,7 +11057,7 @@ { "listen": "test", "script": { - "id": "dfb8591c-ef03-4d0d-9a4e-f497e2ef0e8f", + "id": "22082968-3b02-49b0-8b31-85cef05c7ca5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11111,7 +11110,7 @@ { "listen": "test", "script": { - "id": "49933d24-e3b5-4a0a-ab4c-cba2aacafea9", + "id": "88caac75-664d-4cdb-80a2-ddb035a498d4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11164,7 +11163,7 @@ { "listen": "test", "script": { - "id": "5cca3606-27e6-4fd2-a914-508c74712e83", + "id": "de491597-1b5d-4d65-89ce-fe44c3b28439", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11226,7 +11225,7 @@ { "listen": "test", "script": { - "id": "1cc59e35-94f1-41d2-bab6-0afea72309d0", + "id": "f7b61ce1-a006-4678-8f3c-2051406382f3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11307,7 +11306,7 @@ { "listen": "test", "script": { - "id": "e79fea6d-d632-4af4-9365-93efde82c9e1", + "id": "e9aa62ee-58a4-4aa9-b142-7ac067eda855", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11366,7 +11365,7 @@ { "listen": "test", "script": { - "id": "f3788638-93cc-458c-bdb0-882321ea2475", + "id": "8689424b-f1a4-4301-a481-e9b19dfb3dd3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -11432,7 +11431,7 @@ { "listen": "test", "script": { - "id": "8074834b-c21b-4c02-bd49-a21fc1597e4a", + "id": "335c1132-aba4-4f26-af02-ea70638d7b5b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11481,7 +11480,7 @@ { "listen": "test", "script": { - "id": "c8e0d889-e8d3-4d7a-b3dd-fc24d8662ff8", + "id": "01088b66-4c7d-4eda-876f-6b235b63cdeb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11530,7 +11529,7 @@ { "listen": "test", "script": { - "id": "58a882b6-ef2a-454d-be84-e405e7312d76", + "id": "a90dfb3f-7902-42fa-8392-5cbfcdb7a272", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11575,7 +11574,7 @@ { "listen": "test", "script": { - "id": "bc19e128-cec0-4fdb-a7ca-8607181df075", + "id": "8fd8b0a3-6b6a-45dd-9d18-a23ccad0ae82", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11620,7 +11619,7 @@ { "listen": "test", "script": { - "id": "a0da056f-24ff-4c9d-a012-e1493a4094e7", + "id": "63275d2a-5d61-46fe-9d1e-0ea05f30876f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11665,7 +11664,7 @@ { "listen": "test", "script": { - "id": "b5cd2c3e-1e1f-466d-9dba-d94d901114d5", + "id": "7a3d1e42-0f9a-477e-a4a0-5024d942f183", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11718,7 +11717,7 @@ { "listen": "test", "script": { - "id": "8ddc5b02-3443-4c34-bcef-3bf76205d7d3", + "id": "2b2bcdb6-4a7c-46c2-886d-9473c157bc5a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11771,7 +11770,7 @@ { "listen": "test", "script": { - "id": "3b1e1f73-6bb8-406d-9e0a-e179d4ab869e", + "id": "8e333512-be53-4228-a0ea-5102199a2b80", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11854,7 +11853,7 @@ { "listen": "prerequest", "script": { - "id": "65f53329-1549-483c-8c7b-513f37c1ca29", + "id": "4412aad6-a67e-494b-81af-78d59ddba2b0", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11898,7 +11897,7 @@ { "listen": "test", "script": { - "id": "cac65308-248d-4c31-be9f-b1186e7b3b72", + "id": "41ba7edc-a1c1-469e-83cb-e5f3229e3495", "type": "text/javascript", "exec": [ "" diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index b867d483..0b588f43 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "26248cfc-ce96-4e40-be23-1383bf1ba4ab", + "id": "e38979d7-ba53-46a0-bbf9-11d075b593e9", "name": "Local", "values": [ { @@ -219,6 +219,6 @@ } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-10-08T17:59:49.823Z", - "_postman_exported_using": "Postman/7.33.1" + "_postman_exported_at": "2020-10-26T15:16:10.089Z", + "_postman_exported_using": "Postman/7.34.0" } \ No newline at end of file From da940cff794fa7a650fcbf193c16831caddb9452 Mon Sep 17 00:00:00 2001 From: I380210 Date: Mon, 26 Oct 2020 16:19:34 +0100 Subject: [PATCH 074/157] Update ProjectController.cs --- API/Controllers/ProjectController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 8f84bcd8..7b6265ba 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -52,7 +52,7 @@ public class ProjectController : ControllerBase /// The project service which is used to communicate with the logic layer. /// The user service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. - /// + /// The user project service which is used to communicate with the logic layer.> public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper, IUserProjectService userProjectService) { this.projectService = projectService; From 1dd5bf43f70305a50194d083ca9915a3d1108224 Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 16:30:18 +0100 Subject: [PATCH 075/157] Created first version for the controller implementation --- API/Controllers/UserController.cs | 23 +++++++++++++++++++++-- Models/Institution.cs | 2 +- Services/Services/UserService.cs | 9 +++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 2c2ab064..4623e582 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -25,6 +25,7 @@ using Models.Defaults; using Serilog; using Services.Services; +using System; using System.Linq; using System.Net; using System.Threading.Tasks; @@ -92,12 +93,31 @@ public async Task GetCurrentUser() /// The 400 Bad Request status code is returned when the user id is invalid. /// The 404 Not Found status code is returned when the user with the specified id could not be found. [HttpGet("{userId}")] - [Authorize(Policy = nameof(Defaults.Scopes.UserRead))] + [Authorize] [ProducesResponseType(typeof(UserResourceResult), (int) HttpStatusCode.OK)] [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task GetUser(int userId) { + User currentUser = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + + bool hasUserReadScope = userService.UserHasScope(currentUser.IdentityId, nameof(Defaults.Scopes.UserRead)); + bool hasCorrectDataOfficerRights = + userService.UserHasScope(currentUser.IdentityId, nameof(Defaults.Scopes.RequestUserRead)) && + await userService.HasSameInstitution(currentUser.Id, userId); + bool isAllowed = hasUserReadScope || hasCorrectDataOfficerRights; + + if(!isAllowed) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed to retrieve the user.", + Detail = "The user is not allowed to retrieve this user.", + Instance = "09D64E7C-DF87-4CBD-9B2E-ECE00670DB35" + }; + return Unauthorized(problem); + } + if(userId < 0) { ProblemDetails problem = new ProblemDetails @@ -124,7 +144,6 @@ public async Task GetUser(int userId) return Ok(mapper.Map(user)); } - /// /// This method is responsible for creating the account. /// diff --git a/Models/Institution.cs b/Models/Institution.cs index 2fdff158..f277798f 100644 --- a/Models/Institution.cs +++ b/Models/Institution.cs @@ -13,7 +13,7 @@ * You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt -*/ +*/ namespace Models { diff --git a/Services/Services/UserService.cs b/Services/Services/UserService.cs index f1e38293..f8a013fd 100644 --- a/Services/Services/UserService.cs +++ b/Services/Services/UserService.cs @@ -34,6 +34,8 @@ public interface IUserService : IService bool UserHasScope(string identityId, string scope); + Task HasSameInstitution(int ownUserId, int requestUserId); + bool UserWithRoleExists(Role role); } @@ -68,6 +70,13 @@ public bool UserHasScope(string identityId, string scope) return Repository.UserHasScope(identityId, scope); } + public async Task HasSameInstitution(int ownUserId, int requestUserId) + { + var ownUserInfo = await Repository.FindAsync(ownUserId); + var userRequestInfo = await Repository.FindAsync(requestUserId); + return ownUserInfo.Institution == userRequestInfo.Institution; + } + public bool UserWithRoleExists(Role role) { return Repository.UserWithRoleExists(role); From 1608815ec70b897073181bf1197d26c9109a73be Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 16:37:42 +0100 Subject: [PATCH 076/157] Created first version of for the controller implementation for the DeleteAccount method --- API/Controllers/UserController.cs | 7 +++++++ Data/Helpers/Seed.cs | 2 +- Models/Defaults/Defaults.cs | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 4623e582..04e135cf 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -277,6 +277,13 @@ public async Task DeleteAccount(int userId) User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.UserWrite)); + + bool hasUserWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.UserWrite)); + bool hasCorrectDataOfficerRights = + userService.UserHasScope(currentUser.IdentityId, nameof(Defaults.Scopes.RequestUserRead)) && + await userService.HasSameInstitution(currentUser.Id, userId); + bool isAllowed = hasUserReadScope || hasCorrectDataOfficerRights; + if(user.Id != userId && !isAllowed) { ProblemDetails problem = new ProblemDetails diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 11a60eca..58d9c9a9 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -82,7 +82,7 @@ public static List SeedRoles() Scopes = new List { new RoleScope(nameof(Defaults.Scopes.RequestUserRead)), - new RoleScope(nameof(Defaults.Scopes.RequestUserDelete)) + new RoleScope(nameof(Defaults.Scopes.RequestUserWrite)) } }; roles.Add(dataOfficerRole); diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index e586d2c0..59c0571c 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -94,11 +94,11 @@ public static class Scopes [Description("This scope gives write access to the embed namespace")] public const string EmbedRead = "embed:read"; - [Description("This scope gives read access to user roles for other users within their institution")] + [Description("This scope gives read access to user roles for other users within their institution to the User namespace")] public const string RequestUserRead = "user:request-write"; - [Description("This scope gives delete access to user roles for other users within their institution")] - public const string RequestUserDelete = "user:request-delete"; + [Description("This scope gives write access to user roles for other users within their institution to the User namespace")] + public const string RequestUserWrite = "user:request-delete"; } From 74944ac4d4cb093d564a9afc75095ecc64b168ef Mon Sep 17 00:00:00 2001 From: I380210 Date: Mon, 26 Oct 2020 17:13:06 +0100 Subject: [PATCH 077/157] fixed some tests regarding following users and projects --- Postman/dex.postman_collection.json | 484 ++++++++++++------------- Postman/local.postman_environment.json | 4 +- 2 files changed, 244 insertions(+), 244 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 1f1a23f1..079da398 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "c54de407-ffd7-40a5-ab60-256ec9aa31ca", + "_postman_id": "ff29eab8-de3b-4e93-88ef-f6ab66404d8b", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "f5d8ed44-00a2-4fd9-9294-9d50702e1bb0", + "id": "b827a93b-2a6d-47e5-9c88-408c119101f8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "11401a35-3e3a-4859-9956-58aea025ad01", + "id": "17613765-0415-4e11-8ebc-373f96e7b631", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -137,10 +137,10 @@ { "listen": "test", "script": { - "id": "2fcd23ea-d897-420e-b7f5-5a210823e63c", + "id": "dab19e4b-17d8-4c2e-8029-762be0ef2f7e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = \"Hailie\"", + "var userId = 25", "", "var jsonData = pm.response.json();", "", @@ -161,8 +161,8 @@ " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", "});" ], "type": "text/javascript" @@ -208,7 +208,7 @@ { "listen": "test", "script": { - "id": "e2f1fa52-a285-41f5-95b7-582e7a9caea2", + "id": "e214fd50-1593-430d-854f-6ff42d4b2c25", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -267,7 +267,7 @@ { "listen": "test", "script": { - "id": "2f6a6365-54ad-48a8-bdd2-0463b708bf42", + "id": "3472dd38-3639-4000-85bf-327d76ff8bff", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -336,7 +336,7 @@ { "listen": "test", "script": { - "id": "79359131-cfda-482d-92ae-5381b693db68", + "id": "52aa0280-14a9-4195-a7f6-d232e199dbc6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -404,7 +404,7 @@ { "listen": "test", "script": { - "id": "dbaeea3f-3e64-4183-af06-ac68531caccc", + "id": "f23ab553-b3c9-4412-95f4-10036357bcd1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -472,7 +472,7 @@ { "listen": "test", "script": { - "id": "643a9cda-fa16-4ba6-832a-298f34ece089", + "id": "fb897acc-7440-4cd3-9719-44fec1b5dc96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -547,7 +547,7 @@ { "listen": "test", "script": { - "id": "f435d3a6-e073-4186-bed4-b1ad84ff4162", + "id": "7a39f69f-9301-4e3a-8244-58ccaf92456b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -615,10 +615,10 @@ { "listen": "test", "script": { - "id": "2dc35744-4217-4b93-bac1-88f021a42c5e", + "id": "9fd04b7b-60e7-44ae-be53-f202ce1cfd89", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = \"Generic Metal Ball\"", + "var projectName = 3", "", "var jsonData = pm.response.json();", "", @@ -640,7 +640,7 @@ "});", "", "pm.test(\"Check if created Username matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + " pm.expect(jsonData.id).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -686,7 +686,7 @@ { "listen": "test", "script": { - "id": "abe7d8ac-31c0-451b-9d6f-cd0696111daf", + "id": "3f426063-1c8b-4d32-9777-bea283d13747", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -745,7 +745,7 @@ { "listen": "test", "script": { - "id": "88734621-99a2-4cb1-9d67-1a5dfb3f3c18", + "id": "db4582ed-ccd9-4fad-9bc5-9eb796ab82b2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -823,7 +823,7 @@ { "listen": "test", "script": { - "id": "f5a30e3f-460e-492e-b8e7-1cf46be844a5", + "id": "b7dc3c89-e99d-481a-9349-5a99cb721acb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -896,7 +896,7 @@ { "listen": "test", "script": { - "id": "dfad3e5e-2524-4c5f-8e84-c5dcee01598c", + "id": "580ea907-b7bb-404c-be99-db89133abc92", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -965,7 +965,7 @@ { "listen": "test", "script": { - "id": "497483c8-e04b-40f6-9722-6986ca9d3dbf", + "id": "4429b1cd-f857-4557-b003-6fce43fb2944", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -1033,7 +1033,7 @@ { "listen": "test", "script": { - "id": "3c568dcd-375c-4b82-99eb-947f9bdcadf3", + "id": "4e1093dc-1ba7-434b-b60f-71399f9fdb5f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -1101,7 +1101,7 @@ { "listen": "test", "script": { - "id": "4e57f7b0-b062-4024-b2c3-409b01144c5c", + "id": "9ca4b874-8ae5-4ba8-b2d7-1e6f8670d9fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1161,7 +1161,7 @@ { "listen": "test", "script": { - "id": "b9ba46a6-5b5a-4e6c-af4f-c864fb08bf9a", + "id": "35a3168e-d144-43f4-8f06-4e213df479d0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1190,7 +1190,7 @@ { "listen": "prerequest", "script": { - "id": "51244c5b-b52e-4b8c-a650-bc972ece87ed", + "id": "05bcfb21-723e-4269-bec5-ea28fa381201", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -1240,7 +1240,7 @@ { "listen": "test", "script": { - "id": "74529bf9-808f-4f7d-9aa6-d2ac0ae6c8d1", + "id": "313c98ec-33aa-4e88-97ad-591ae71a7f2e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1309,7 +1309,7 @@ { "listen": "test", "script": { - "id": "d67ed053-387c-4c48-bd0a-44057aed2ecc", + "id": "eed3be18-11d8-4f23-8ced-71ebad388e53", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1371,7 +1371,7 @@ { "listen": "test", "script": { - "id": "a74e186b-a1ff-4e20-a106-d8d403e1b4c4", + "id": "5fefd285-9c8e-4fa0-acc9-5cba93154363", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1458,7 +1458,7 @@ { "listen": "test", "script": { - "id": "228f9b5d-f9cc-473f-bcf2-b40d755d7446", + "id": "33330cd9-7f81-4523-a8ae-8d450611fc95", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1490,7 +1490,7 @@ { "listen": "prerequest", "script": { - "id": "9936a9e5-4877-45c8-8bf9-e92a6aea0f8f", + "id": "b42fd126-77fe-4567-aa47-2189736defed", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1537,7 +1537,7 @@ { "listen": "test", "script": { - "id": "a7927deb-69bc-465c-a986-06d0a65962da", + "id": "15a4479c-2351-4837-8951-b7d3bb9b8436", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1596,7 +1596,7 @@ { "listen": "test", "script": { - "id": "cde84ca8-9d89-4cd3-8a99-229cc05e223a", + "id": "b82ef281-95dc-4291-ad9b-fbb0e0d96197", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1657,7 +1657,7 @@ { "listen": "test", "script": { - "id": "0b9739ec-9253-464f-80c6-f6a66c076fa4", + "id": "bcc14b8e-3fa0-402f-9549-4a068c822f24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1721,7 +1721,7 @@ { "listen": "test", "script": { - "id": "24db3085-598d-4407-bdb2-57b85861173c", + "id": "f56c0169-0f3b-433e-b208-7140288f7bea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1790,7 +1790,7 @@ { "listen": "test", "script": { - "id": "929a0966-608d-413c-b36c-4670cb290fdf", + "id": "537d6005-f6f6-4b6c-aad0-5d2ef6fa8fcf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1848,7 +1848,7 @@ { "listen": "test", "script": { - "id": "b8409b0b-9d9c-44e9-8c3c-3c4c9594106c", + "id": "dcd0fc71-f927-4d22-87f4-56cd768ddbb7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1902,7 +1902,7 @@ { "listen": "test", "script": { - "id": "42f9ee30-651e-4972-b814-c82d947947d1", + "id": "c834c84a-7e0e-4bd6-976e-f212271af58d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1963,7 +1963,7 @@ { "listen": "test", "script": { - "id": "7146788c-cc91-4f07-92b0-7277160b211f", + "id": "8dd40497-eab0-4e6d-b814-d24fe9a60768", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -2036,7 +2036,7 @@ { "listen": "test", "script": { - "id": "a33ad515-e8a4-467a-9878-57109c8f6269", + "id": "e629d9dc-4815-4b72-b8dc-d3ce6099c6e8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -2109,7 +2109,7 @@ { "listen": "test", "script": { - "id": "ca3c5ba7-bc6c-49bb-8f80-e540555285be", + "id": "c70013ba-7ba6-4b9a-8f66-5404ba2db7a2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2175,7 +2175,7 @@ { "listen": "test", "script": { - "id": "cd37e67a-dc62-4534-bb9c-b404d8946a2c", + "id": "2072f24b-8dfa-42ca-85f8-e1ba9b8130c8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2234,7 +2234,7 @@ { "listen": "test", "script": { - "id": "86f086da-bb3f-4004-b16b-80a74c2c2721", + "id": "18bfab81-d57b-420d-8ba9-d6f9d3e1d5ee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2301,7 +2301,7 @@ { "listen": "test", "script": { - "id": "d98e6e6a-ef32-49d9-9947-29a48e39af60", + "id": "38f386d2-8004-4f82-83bb-97396404817a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2359,7 +2359,7 @@ { "listen": "test", "script": { - "id": "dc781e6b-e69c-40e8-ad74-59224f076cb4", + "id": "e8523c11-db8c-413b-9baa-cfc6726efddb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2438,7 +2438,7 @@ { "listen": "test", "script": { - "id": "80be28b1-cf5b-4550-aa93-af38a632d311", + "id": "c8ff9189-d69d-4ee8-ac71-6c4dd90f1b7d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2496,7 +2496,7 @@ { "listen": "test", "script": { - "id": "a1eb66cd-5051-4920-a5db-794f881fb460", + "id": "6525c4c0-7e5a-4abf-ba98-e8838f7bc9b7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2557,7 +2557,7 @@ { "listen": "test", "script": { - "id": "3696be74-2e79-4818-aa0f-ef3ac4005d45", + "id": "12c1b164-3095-4c82-b334-d95a5b34dd22", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2623,7 +2623,7 @@ { "listen": "test", "script": { - "id": "ac1876da-467e-4890-b4c3-83cedd84b21c", + "id": "b1389398-ceaa-4fe9-8492-111582f0ea11", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2689,7 +2689,7 @@ { "listen": "test", "script": { - "id": "3b8a4f45-21fe-40c5-840a-ecd8e45ed513", + "id": "af8a646b-d41e-4bea-902d-441605339831", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2734,7 +2734,7 @@ { "listen": "test", "script": { - "id": "25d668c6-4cdf-485a-b5ef-72e936900a62", + "id": "92b2144a-64b5-47aa-8de0-9e6b63b70fcb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2779,7 +2779,7 @@ { "listen": "test", "script": { - "id": "c87cde56-83b3-4bd2-ac61-c49516939e7c", + "id": "6b8fa039-601b-4c4f-b82a-d123073ee70e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2824,7 +2824,7 @@ { "listen": "test", "script": { - "id": "2b4710f9-ad41-44f6-a7c8-c70c12c17a6f", + "id": "c20a5d1e-0882-4ff0-89b2-0fa4916c75da", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2869,7 +2869,7 @@ { "listen": "test", "script": { - "id": "540dfb7e-f11e-495d-999f-e30aa54ad9e8", + "id": "395595a7-30a2-47d4-b6b3-f7d22bbcbec3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2914,7 +2914,7 @@ { "listen": "test", "script": { - "id": "285e896e-4927-461c-80d6-3a180efe5458", + "id": "a561d994-fadb-486d-b4e7-3d21bed8af8e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2966,7 +2966,7 @@ { "listen": "test", "script": { - "id": "c0330244-0d12-4947-b25c-c47d09174d24", + "id": "bd260b5c-5ae2-4f1a-8da3-2bfb2bbbce67", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3017,7 +3017,7 @@ { "listen": "test", "script": { - "id": "1b7211ff-7415-4d0f-bd56-ee51df099435", + "id": "af9ecf6f-b733-4359-92d9-9326448a2a84", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3068,7 +3068,7 @@ { "listen": "test", "script": { - "id": "bcd7c41b-62af-4240-9b6d-8ea31e4221b0", + "id": "2eeebc99-fcea-4719-9aa4-4a6ecf90d442", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3119,7 +3119,7 @@ { "listen": "test", "script": { - "id": "f673faa0-5a79-413e-9505-b1ee210ba2b1", + "id": "a2ad9aa4-38ac-4ab6-8558-63365272be84", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3170,7 +3170,7 @@ { "listen": "test", "script": { - "id": "0cd76ed8-b149-49c4-8b25-b0f155e55937", + "id": "52ee3c8d-d39e-45a2-9a4d-bba0d652cd30", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3235,7 +3235,7 @@ { "listen": "test", "script": { - "id": "b809dc1b-09e3-47fb-9007-9f22e6faa25b", + "id": "5865a8d0-29bf-48fd-b922-8f6e47379e6e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3313,7 +3313,7 @@ { "listen": "test", "script": { - "id": "c0754a53-460e-4a45-b84b-63871f72830f", + "id": "803becd8-ac1b-4258-a45b-1e57b10ce9ec", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3342,7 +3342,7 @@ { "listen": "prerequest", "script": { - "id": "94a650b4-2879-41cc-a359-b2143f580c76", + "id": "09739f37-dc6b-4725-83e1-c744e1c2d241", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3392,7 +3392,7 @@ { "listen": "test", "script": { - "id": "0d2b1e03-4513-43e8-b247-8599dfde6ec9", + "id": "687b3ec9-992e-4f87-a3d7-c5e0a15a2078", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3456,7 +3456,7 @@ { "listen": "prerequest", "script": { - "id": "bf012fb0-9eb4-406f-9c1c-390fe5381774", + "id": "590a39b4-f6f8-4ad7-9b7d-6a80b54d560b", "type": "text/javascript", "exec": [ "" @@ -3466,7 +3466,7 @@ { "listen": "test", "script": { - "id": "764e3569-ae6a-4a7a-ab2d-9c7a441e40b9", + "id": "6a5ee161-8976-4900-92b5-4cf1399f1fe2", "type": "text/javascript", "exec": [ "" @@ -3489,7 +3489,7 @@ { "listen": "test", "script": { - "id": "27d3729b-34f3-421b-836e-dee26879322a", + "id": "742d4fdb-4d8f-4f3d-b247-16fa9d27f05d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3550,12 +3550,12 @@ { "listen": "test", "script": { - "id": "d97b5623-df0e-46ac-8007-57a6272e10ed", + "id": "59aadf05-d21e-4582-aad7-5a117d726be2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3609,7 +3609,7 @@ { "listen": "test", "script": { - "id": "40a8dc28-23fe-4519-a8c7-628470f84eb5", + "id": "3373f452-fc4a-4111-be3a-91e60f8ad5f3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3667,7 +3667,7 @@ { "listen": "test", "script": { - "id": "bbe65e41-4f5e-4efd-b537-c1235a181379", + "id": "eb90ea5e-7646-4cf0-9ac7-2fc1e9e9d438", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3725,7 +3725,7 @@ { "listen": "test", "script": { - "id": "37365e17-ee92-4af2-87a7-ec2006807440", + "id": "169cdff7-a82c-45fc-b83a-d953588f1119", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3783,7 +3783,7 @@ { "listen": "test", "script": { - "id": "208f18bd-4204-47a2-867c-9510df558326", + "id": "b36559aa-f7c2-4ea1-af84-e34e0c57f244", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3833,7 +3833,7 @@ { "listen": "test", "script": { - "id": "fe44feba-987a-4bfe-97dd-d051b45eec15", + "id": "2aaa4a0e-4979-4f8b-a3ba-fb0c953ff8be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3892,7 +3892,7 @@ { "listen": "test", "script": { - "id": "16e8100b-43ce-4473-a77c-76c255060bce", + "id": "dff749b2-8de7-40ad-af4c-e7c85e8a03bb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3941,7 +3941,7 @@ { "listen": "prerequest", "script": { - "id": "1b7e3cac-90aa-443a-8410-3033a47a3486", + "id": "7f52857e-7070-4799-92fe-4367a0e8ee89", "type": "text/javascript", "exec": [ "" @@ -3951,7 +3951,7 @@ { "listen": "test", "script": { - "id": "a50fd3bb-6f03-4677-9b4a-5f1cdc04ea13", + "id": "da51ae44-57da-4198-bbe2-dd8a0e779e78", "type": "text/javascript", "exec": [ "" @@ -3974,7 +3974,7 @@ { "listen": "test", "script": { - "id": "bd003c13-2596-43de-a6ff-4f60717d00d3", + "id": "ce1cbb6b-5415-4e3a-8777-aba4c977aa96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = \"Generic Metal Ball\"", @@ -4036,7 +4036,7 @@ { "listen": "test", "script": { - "id": "c2553572-79c5-476a-8aa4-5e2f5d59381b", + "id": "0aef8ac3-b0d1-49bf-a244-e5574e5849a1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4095,7 +4095,7 @@ { "listen": "test", "script": { - "id": "5adc7ee4-89d0-4303-bbbe-7fab5cd08633", + "id": "38028375-2c71-4851-848b-2996514dc408", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4155,7 +4155,7 @@ { "listen": "test", "script": { - "id": "7d261aa4-0677-4d3f-9249-de64f7a7d328", + "id": "02432018-39c4-44a4-bde5-1bf559af3927", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4225,7 +4225,7 @@ { "listen": "test", "script": { - "id": "0a40b9b1-2c2e-476e-8afa-b53e261f3961", + "id": "7e1dc145-9d14-4e43-979d-b55dc9f716ad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4280,7 +4280,7 @@ { "listen": "test", "script": { - "id": "5e173c38-02b7-4d15-b1a1-5dc99147ee12", + "id": "482a9f22-10c9-4cce-9c1d-49c0dbaeee4b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4337,7 +4337,7 @@ { "listen": "test", "script": { - "id": "177b300a-dc4a-499e-b0af-570dca3d21ef", + "id": "47b2e7fe-4550-4e08-8825-075cd03191f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4386,7 +4386,7 @@ { "listen": "prerequest", "script": { - "id": "cdf91290-dc74-4b62-a9b3-9011ab15808e", + "id": "7a8992b6-9cc8-4704-b573-a54f54c6a77a", "type": "text/javascript", "exec": [ "" @@ -4396,7 +4396,7 @@ { "listen": "test", "script": { - "id": "94395f2b-5826-4a5a-b11b-e33a75c14235", + "id": "e840a81d-f500-4fa4-b995-396f25f9eb58", "type": "text/javascript", "exec": [ "" @@ -4416,7 +4416,7 @@ { "listen": "test", "script": { - "id": "5a263b5f-5ca6-4fa1-9fd9-bad7b47ac0f9", + "id": "429d06f0-dbbf-4ceb-bf2e-b62c2271677c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4443,7 +4443,7 @@ { "listen": "prerequest", "script": { - "id": "391ea137-2e81-419d-90f3-7b6e7b1de095", + "id": "8f885ecd-9e60-4378-8e97-66994d852372", "exec": [ "" ], @@ -4482,7 +4482,7 @@ { "listen": "test", "script": { - "id": "12215fa1-14bd-4d6d-9af7-43218c99a013", + "id": "edd3e007-31fb-42e9-a8be-d0ccba9a0f37", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4527,7 +4527,7 @@ { "listen": "test", "script": { - "id": "7a6138e5-949c-44a3-80c4-d821b5888cce", + "id": "14771859-2a73-4509-9d31-cfc031b63c6f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4582,7 +4582,7 @@ { "listen": "test", "script": { - "id": "68daa9a7-c36a-40fc-bafc-aecb5d85c87e", + "id": "c8985640-31cd-4e43-a258-fe3737f0ebf0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4631,7 +4631,7 @@ { "listen": "test", "script": { - "id": "a68ddbd8-84f3-453b-93b5-c1140862b727", + "id": "ca58145d-4c4c-485b-9cba-4dda9a9473cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4658,7 +4658,7 @@ { "listen": "prerequest", "script": { - "id": "ae9f46fb-1091-4b13-82ce-d5df82000504", + "id": "429d96de-1074-424c-bafd-b92f920ef008", "exec": [ "" ], @@ -4698,7 +4698,7 @@ { "listen": "test", "script": { - "id": "65390442-4e16-4d74-b017-769845bc1afc", + "id": "83eb198d-e1b3-498a-9d94-a67dc53ff2a6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4747,7 +4747,7 @@ { "listen": "prerequest", "script": { - "id": "bdde43a7-7e7d-4028-8235-d7627efe0bc5", + "id": "5c28bc07-b68d-4a8e-966a-97b9cc00b925", "type": "text/javascript", "exec": [ "" @@ -4757,7 +4757,7 @@ { "listen": "test", "script": { - "id": "d8b4be2e-4360-4720-806f-1cecc3d0b6b2", + "id": "a415c3f3-897c-4b44-a0db-d449582cabd0", "type": "text/javascript", "exec": [ "" @@ -4777,7 +4777,7 @@ { "listen": "test", "script": { - "id": "2c96b4a1-3281-4f78-84e4-aa559b66558e", + "id": "00b89cb8-4655-4cfe-bfef-99c71075384c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4832,7 +4832,7 @@ { "listen": "test", "script": { - "id": "594d650a-1a18-4cdc-bb4a-1f94046bafae", + "id": "72161f42-8fda-481a-818d-202b0dfca488", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4878,7 +4878,7 @@ { "listen": "test", "script": { - "id": "978860f6-5d82-4879-ae57-99f4b3c31d43", + "id": "e7181385-3925-4b3f-9ed4-9c3e7bd79378", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4925,7 +4925,7 @@ { "listen": "test", "script": { - "id": "a94b6c8e-0076-4211-94fb-922ecd93843d", + "id": "b2d72f1f-0908-4a03-8784-a64093c34d5b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4974,7 +4974,7 @@ { "listen": "prerequest", "script": { - "id": "0267db72-7c24-42d6-a358-892c26685875", + "id": "53dbee05-b741-4d8b-bcef-e600802e2410", "type": "text/javascript", "exec": [ "" @@ -4984,7 +4984,7 @@ { "listen": "test", "script": { - "id": "a376a167-dc95-4828-ad9f-ae9c366cd6b3", + "id": "9ad98cb4-7b19-49fe-84b7-18ff4951f402", "type": "text/javascript", "exec": [ "" @@ -5004,7 +5004,7 @@ { "listen": "test", "script": { - "id": "3698854a-6357-4f29-8a64-c54320b154b3", + "id": "52a8e434-7893-4773-b2e8-d08f09009880", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5060,7 +5060,7 @@ { "listen": "test", "script": { - "id": "ea78a7b0-57f2-4aa0-a0a7-521e70d47b86", + "id": "197c334a-1027-40bf-9d6c-d87aba60c897", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5107,7 +5107,7 @@ { "listen": "test", "script": { - "id": "0cacf42a-1a5a-43e0-925c-2b5b4df03a0e", + "id": "f58cadd9-e1d4-4688-bf4c-1edc1ad5cc14", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5155,7 +5155,7 @@ { "listen": "test", "script": { - "id": "579cea97-f5b4-4d69-96c0-4011dfc27d6f", + "id": "5cde50b7-c620-4711-ad89-17483c974f5e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5203,7 +5203,7 @@ { "listen": "test", "script": { - "id": "d457dd13-513b-41fc-a2bd-db47922865c6", + "id": "e9cfb930-370c-41a2-ade6-06a8744ce2ca", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5260,7 +5260,7 @@ { "listen": "test", "script": { - "id": "400f8790-4f3d-44d2-9f6d-e92547c9a1b3", + "id": "a8c725b1-ec1e-4ab6-ad7c-95e43d0bf816", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5331,7 +5331,7 @@ { "listen": "prerequest", "script": { - "id": "5ae4340d-76c1-4b6e-9e61-d5d0e2de48a0", + "id": "d4dc0f6a-9e81-473b-a6d2-4d182236fda2", "type": "text/javascript", "exec": [ "" @@ -5341,7 +5341,7 @@ { "listen": "test", "script": { - "id": "9132f5f6-7d6e-4e3b-ba45-6134da07aad1", + "id": "3b5d73cb-3c05-49e9-a8eb-a807af0cfbd1", "type": "text/javascript", "exec": [ "" @@ -5361,7 +5361,7 @@ { "listen": "test", "script": { - "id": "a9627585-46a2-4355-a186-32c36a3a8eb5", + "id": "70bffee9-98ac-4bfc-be9b-77e7644ff635", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5412,7 +5412,7 @@ { "listen": "prerequest", "script": { - "id": "6439f54f-b988-4403-8a44-94bfbf9e4a9e", + "id": "d0d4b573-2d72-4a2d-9380-d3a5d3d9734c", "type": "text/javascript", "exec": [ "" @@ -5422,7 +5422,7 @@ { "listen": "test", "script": { - "id": "14ec6494-667e-4b7f-a9a9-2220ae4bb61a", + "id": "d1ca2211-e512-4890-900d-4e0a620ef322", "type": "text/javascript", "exec": [ "" @@ -5442,7 +5442,7 @@ { "listen": "test", "script": { - "id": "5ca14176-dd63-4ed2-a3fc-9b4a509e1fba", + "id": "2b50fd0a-2b1f-49f8-a466-14a866f9be33", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5498,7 +5498,7 @@ { "listen": "prerequest", "script": { - "id": "c24994aa-1eb0-4b0e-af5f-55b662f1e5e2", + "id": "199676e9-7ea5-4644-af7a-6399476a51c2", "type": "text/javascript", "exec": [ "" @@ -5508,7 +5508,7 @@ { "listen": "test", "script": { - "id": "4969e67e-c49b-413b-b9ff-7f6fc089cd8b", + "id": "7037d025-d6b0-4b54-af59-e789dae637eb", "type": "text/javascript", "exec": [ "" @@ -5524,7 +5524,7 @@ { "listen": "prerequest", "script": { - "id": "199a7297-862c-4753-a3ce-bade21e0acee", + "id": "ba686cb3-fc8e-4b07-b65f-397ee8d6cae3", "type": "text/javascript", "exec": [ "" @@ -5534,7 +5534,7 @@ { "listen": "test", "script": { - "id": "0115bb0e-2dbe-4113-bac1-fad1e1361a73", + "id": "d2be4adb-c820-4ce9-a0ef-8e0c3c9b6fd8", "type": "text/javascript", "exec": [ "" @@ -5557,7 +5557,7 @@ { "listen": "test", "script": { - "id": "4981b31c-931a-490b-8ad0-2dd702d99822", + "id": "db8920d2-e557-4ee8-a709-a8b3eb886618", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5626,7 +5626,7 @@ { "listen": "test", "script": { - "id": "d20c2f9e-7d40-4051-9fa5-206e6ce55578", + "id": "d1cc5ca3-b0d1-4e10-b934-831d60fcc422", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5705,7 +5705,7 @@ { "listen": "test", "script": { - "id": "e0fc8411-cee9-4b27-ae4b-7a7d63ae9fba", + "id": "64ecbf57-2189-4ff9-92a1-2abeb6c252d9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5734,7 +5734,7 @@ { "listen": "prerequest", "script": { - "id": "98a24517-4b28-47a1-a59b-170623e34775", + "id": "f03e3714-6b31-4dbe-8be4-68b7770dfe7a", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5784,7 +5784,7 @@ { "listen": "test", "script": { - "id": "ed214db1-e51d-4c39-9ddc-054dc9a59b29", + "id": "e931ecd1-7d4d-4fe2-b8d2-9f3fc9e5f4b3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5849,7 +5849,7 @@ { "listen": "test", "script": { - "id": "21a5c5f5-9f2d-4603-bb12-9b99c53d2cc0", + "id": "2a454f15-069f-46aa-9e24-0046f3aa8842", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5922,7 +5922,7 @@ { "listen": "prerequest", "script": { - "id": "c57ff460-0df8-44ec-8143-0b326b89ebad", + "id": "d5a985fd-8009-4ced-a2e1-9f37a6c87c39", "type": "text/javascript", "exec": [ "" @@ -5932,7 +5932,7 @@ { "listen": "test", "script": { - "id": "115c72ee-9a51-4cce-a24a-a4469fdc425f", + "id": "d0d24d95-5d68-4270-be27-657eddadd685", "type": "text/javascript", "exec": [ "" @@ -5955,7 +5955,7 @@ { "listen": "test", "script": { - "id": "c64c960e-5213-4e2e-811a-884341450dd5", + "id": "ab0be218-be02-40fe-8845-ed0d3a932de7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userId = 25", @@ -6026,7 +6026,7 @@ { "listen": "test", "script": { - "id": "5e6ffa2e-7bdb-474a-8913-cab963128f36", + "id": "15ed1ba0-acbf-4048-b358-06ad38987428", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6085,7 +6085,7 @@ { "listen": "test", "script": { - "id": "a83eb450-c47c-45c1-98f4-44fe326a6e37", + "id": "01024392-f907-4c82-9735-846dbbde0579", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6145,7 +6145,7 @@ { "listen": "test", "script": { - "id": "9f9436af-a9aa-4cf5-8783-1e938d7aad0a", + "id": "406c789b-d0ed-4830-b3c5-46078bf1be33", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6208,7 +6208,7 @@ { "listen": "test", "script": { - "id": "3c3584d3-4bd2-4e7e-a19e-1eaa662f96b4", + "id": "7574a3ab-ce99-4450-b403-eb56351a3068", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6271,7 +6271,7 @@ { "listen": "test", "script": { - "id": "ab914c3b-d574-4675-963f-1b2722e61ff3", + "id": "e6ce4254-72ec-4fff-8eac-88c467be2bfc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6328,7 +6328,7 @@ { "listen": "test", "script": { - "id": "7b6e014d-afa9-4390-a7ac-9889a4f77765", + "id": "4f457db6-b4d4-456b-8145-b1a1230e35bf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6381,7 +6381,7 @@ { "listen": "test", "script": { - "id": "58cbc7a2-46c4-431c-af18-2878d5331c11", + "id": "d18ed922-1c29-4a9e-8416-f83bc22a974c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -6439,7 +6439,7 @@ { "listen": "test", "script": { - "id": "c55acd5f-db3a-43b4-aded-ef35a2d87941", + "id": "5e8c5cec-4806-4c2e-9525-da46af199d07", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -6506,7 +6506,7 @@ { "listen": "test", "script": { - "id": "b6c6710c-8195-4830-a0f5-fd3771452c24", + "id": "99dbabe3-4d8f-41cb-8bce-1c944ad96a29", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6568,7 +6568,7 @@ { "listen": "prerequest", "script": { - "id": "f322dcae-8b64-44fb-ae81-63b9c4a2df8b", + "id": "582ea3c3-5a17-451b-b5be-b1e734fef8eb", "type": "text/javascript", "exec": [ "" @@ -6578,7 +6578,7 @@ { "listen": "test", "script": { - "id": "8cd72ace-6a62-4323-873d-f24785dd692c", + "id": "278af5fc-7c82-4bcf-a361-cf9d6745f6bd", "type": "text/javascript", "exec": [ "" @@ -6601,10 +6601,10 @@ { "listen": "test", "script": { - "id": "72cea572-ec07-443a-9e04-c8448d2f4f24", + "id": "22970b7f-2de6-41a2-8f26-3848803bae89", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = \"Generic Metal Ball\"", + "var projectId = 3", "", "var jsonData = pm.response.json();", "", @@ -6625,8 +6625,8 @@ " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Check if created Username matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + "pm.test(\"Check if created Username matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", "});" ], "type": "text/javascript" @@ -6672,7 +6672,7 @@ { "listen": "test", "script": { - "id": "e473501e-5c09-455a-b9f7-e12f648d0a9d", + "id": "67efdc2b-2f9a-48a1-95d7-e593637c202c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6731,7 +6731,7 @@ { "listen": "test", "script": { - "id": "21b3f89d-de83-40f0-abb9-21ee66350267", + "id": "3b9fc86d-9853-4594-a1ec-137bacc84275", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6797,7 +6797,7 @@ { "listen": "test", "script": { - "id": "82dd5e58-f1ba-4ee3-9558-610d49a69088", + "id": "59515132-4a17-4233-9ac3-758bdecfceae", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6870,7 +6870,7 @@ { "listen": "test", "script": { - "id": "34496339-0b51-4e06-acbe-01a892edd397", + "id": "8216b6be-a07b-4496-9a9d-2dd8873245f0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6928,7 +6928,7 @@ { "listen": "test", "script": { - "id": "a9d945f2-96ab-4085-af9f-770fbc9d5cc8", + "id": "f481301c-4f17-4ecc-8136-be43fd0607ec", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6978,7 +6978,7 @@ { "listen": "test", "script": { - "id": "9af6a8fe-a32c-4e60-a335-443c28a98baa", + "id": "547c4a5c-6a3f-4117-ad34-8a368531d556", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -7045,7 +7045,7 @@ { "listen": "test", "script": { - "id": "0bb02801-b093-4457-80ba-e68aec868ff9", + "id": "e3f6d06e-c777-4b0a-8d49-85640c2d3202", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7112,7 +7112,7 @@ { "listen": "test", "script": { - "id": "5d073d92-d652-4928-97db-694030da9c2f", + "id": "43f20175-6465-4796-9774-a7d8c46b13f7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7176,7 +7176,7 @@ { "listen": "test", "script": { - "id": "dddad3a8-dfd5-49ea-9e09-f89721332731", + "id": "6db9b959-e218-47b1-b2a3-317faef4797e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7237,7 +7237,7 @@ { "listen": "test", "script": { - "id": "4a39d382-13f4-4906-814a-bf5d12eb36ab", + "id": "08292766-5d01-4f64-9046-315a3b711974", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7289,7 +7289,7 @@ { "listen": "test", "script": { - "id": "ffac37e7-bec5-4391-80bb-3fa99da28ee3", + "id": "e6d9018c-b68b-4a02-8322-91622ed92517", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -7354,7 +7354,7 @@ { "listen": "test", "script": { - "id": "4dfd3735-5c20-470f-b1ad-88b31a819c0d", + "id": "15860a63-ec78-44f4-84b6-99a5d7ac493a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7380,7 +7380,7 @@ { "listen": "prerequest", "script": { - "id": "973ba179-b34a-42e2-a931-45fc0b3de03c", + "id": "7af04590-c7d8-4f65-a24c-97162b36b7f8", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -7430,7 +7430,7 @@ { "listen": "test", "script": { - "id": "720e5304-d7fe-49a8-8073-3c2a38011dbc", + "id": "156df0e0-bd6c-4011-8ead-e8dc22791271", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -7499,7 +7499,7 @@ { "listen": "test", "script": { - "id": "8c0272e6-0fa1-4ae2-b2d1-cea59632016b", + "id": "79c3e397-d4c3-4aec-a1e5-8bd0213b1053", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -7561,7 +7561,7 @@ { "listen": "test", "script": { - "id": "8cde6133-d1d0-4c45-8a21-d7547648da98", + "id": "99faab17-d5f8-4891-80fb-269141c7143d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7616,7 +7616,7 @@ { "listen": "test", "script": { - "id": "14ef97de-bd75-4269-81be-a28aa2306d12", + "id": "a6f6d147-1f70-470a-9e2e-89ba6de5e81a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7685,7 +7685,7 @@ { "listen": "test", "script": { - "id": "dea07047-e4ad-4228-960e-47d57df939a8", + "id": "36180131-3f19-4be3-9263-392399ad025c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7746,7 +7746,7 @@ { "listen": "test", "script": { - "id": "1fd2431e-da52-4dd8-a268-328bf4471c57", + "id": "43c11a89-656b-469c-8cb0-bacdf6575798", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7798,7 +7798,7 @@ { "listen": "test", "script": { - "id": "c052239f-a84d-4f61-b163-4f8ea834782f", + "id": "ae43fd3d-cfd8-4bdf-9729-075d257daca2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7851,7 +7851,7 @@ { "listen": "test", "script": { - "id": "90b02be2-2104-4804-8eff-7e4b4acb5d21", + "id": "803b1054-777f-4b36-b8ae-fd15bca56bf4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7904,7 +7904,7 @@ { "listen": "test", "script": { - "id": "dd24b0d8-a25c-4bac-acf3-c1377d5f2ba2", + "id": "f833467b-9316-4252-98fd-b0266a7ddd96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7966,7 +7966,7 @@ { "listen": "test", "script": { - "id": "62ddb0dd-aae9-4546-a3f4-723f1e055161", + "id": "b28a0f11-948b-4e1a-ab5d-43e5505f72e1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8047,7 +8047,7 @@ { "listen": "test", "script": { - "id": "e09d43d8-4c7b-4ad1-8fdb-a408b3def6a8", + "id": "4e238c07-790f-4932-97f6-a5c250d59547", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8106,7 +8106,7 @@ { "listen": "test", "script": { - "id": "dd9fee6b-2ef8-4559-ae1d-f8637f70fbda", + "id": "56e9b270-b3d3-4055-9c2d-a182042df9a5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -8172,7 +8172,7 @@ { "listen": "test", "script": { - "id": "cb4c4db4-03aa-45f7-81c6-c139324c2c5f", + "id": "06a7f923-cf89-4029-9640-a391dbc40465", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8221,7 +8221,7 @@ { "listen": "test", "script": { - "id": "a990b20c-4fc3-4d0a-95d7-6b7866f09f47", + "id": "b582a147-3c96-4ae0-aba0-3242856c7d61", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8272,7 +8272,7 @@ { "listen": "test", "script": { - "id": "6ae93808-2567-4259-b37c-1336cda83a7f", + "id": "cc83fc60-a31a-4242-bcf1-e6d8a074bf38", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8323,7 +8323,7 @@ { "listen": "test", "script": { - "id": "b539add5-4d0c-4adf-9ab6-9ecf41a4e69e", + "id": "0202e0ad-2287-4f53-bfa8-9d47c51ae0db", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8368,7 +8368,7 @@ { "listen": "test", "script": { - "id": "48e99a28-8d4a-4bc6-9cf9-b78fede7f41d", + "id": "eef0f020-d6cf-4914-a9c0-35bea8e04245", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8419,7 +8419,7 @@ { "listen": "test", "script": { - "id": "c9004983-af54-4c19-8954-8a818c19bfa0", + "id": "3a80339f-2305-4ecb-99ad-144499de5711", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8470,7 +8470,7 @@ { "listen": "test", "script": { - "id": "37387301-1a79-4f1b-a579-74bdc699bdc0", + "id": "047b16e2-fda2-4592-a6fe-a7a41018ac96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8535,7 +8535,7 @@ { "listen": "test", "script": { - "id": "a1bdaaef-5c2c-4eda-b501-b9d0bc2baf47", + "id": "96444922-e42d-4a75-845e-34c3a884255e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8604,7 +8604,7 @@ { "listen": "test", "script": { - "id": "487207ca-1558-4bc9-b039-11737d626d42", + "id": "9ba6e788-0364-4f5e-a316-ddfe997c5948", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8683,7 +8683,7 @@ { "listen": "test", "script": { - "id": "0eefb976-2fdd-4d25-9e80-05ab89844ea5", + "id": "02c1ba2d-2d5a-4402-b403-818f901129c4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8712,7 +8712,7 @@ { "listen": "prerequest", "script": { - "id": "efc8ea84-8e3b-4143-8a03-4cbe232eb1d5", + "id": "4f9fd25d-b62b-4c34-91b7-d6be61424072", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8762,7 +8762,7 @@ { "listen": "test", "script": { - "id": "e023c0e5-ccf5-4322-a4b2-2962d9e7fdea", + "id": "ac2b6251-c664-4f34-a5e8-3926ca6fc757", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8826,7 +8826,7 @@ { "listen": "test", "script": { - "id": "39b9160f-f620-4a24-b38a-4cc4ae798ae3", + "id": "e9688d3f-a405-4144-9e1f-8cd9daf1684f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8899,7 +8899,7 @@ { "listen": "prerequest", "script": { - "id": "fed9ee17-94d4-41e7-9599-2019c7e514cf", + "id": "c7d754cb-9f76-46b3-8ca0-a5bb7bba6d8c", "type": "text/javascript", "exec": [ "" @@ -8909,7 +8909,7 @@ { "listen": "test", "script": { - "id": "727be0aa-423e-4663-8919-69176e7fc878", + "id": "585a1f57-bf11-42eb-87e8-3903f4289b42", "type": "text/javascript", "exec": [ "" @@ -8932,7 +8932,7 @@ { "listen": "test", "script": { - "id": "88dfed2e-a666-4628-852f-cfb44aaac80b", + "id": "e033e234-2d1a-449f-8149-025fb6900cfe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userId = 25", @@ -8942,8 +8942,8 @@ "pm.environment.set(\"createdUserId\", jsonData.id);", "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", @@ -9003,12 +9003,12 @@ { "listen": "test", "script": { - "id": "136e8b41-6dd0-441f-a07c-dea9aadb8cc6", + "id": "e9d15f60-51ee-45d5-84cb-0ffae4eefc8e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -9062,7 +9062,7 @@ { "listen": "test", "script": { - "id": "60738091-6dde-42e4-a497-a8c026a521da", + "id": "91e39857-10ee-41ba-ace1-5dc1b770c096", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9122,7 +9122,7 @@ { "listen": "test", "script": { - "id": "600daa22-b83b-4fc3-9c8a-81773f80052a", + "id": "c216c5da-e108-4581-a7b5-45483c8f2201", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9182,7 +9182,7 @@ { "listen": "test", "script": { - "id": "b4b5f98f-a09b-492e-b511-c2f7b7a60d77", + "id": "6ad4f08f-a3b2-4586-b646-6d9e32923c83", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9235,7 +9235,7 @@ { "listen": "test", "script": { - "id": "04e02e09-653e-4bc8-99cd-63f643708f7c", + "id": "44220256-3a66-459f-9ac2-cb9f34c4dd83", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -9293,7 +9293,7 @@ { "listen": "test", "script": { - "id": "3f7c96f0-290e-4ebd-b976-997052befb28", + "id": "fd9c0740-02b3-4e4b-805f-d931a3c00d2f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -9360,7 +9360,7 @@ { "listen": "test", "script": { - "id": "f2eff21a-d7fc-4cf0-b283-1f63e48888ab", + "id": "fecaf8bf-320e-437b-a403-b0190734c79e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9422,7 +9422,7 @@ { "listen": "prerequest", "script": { - "id": "e98fec99-fbe4-4918-bae9-4d033a1c8b58", + "id": "b0d4d151-ee9d-49e6-b1d5-7ddbfa5ace61", "type": "text/javascript", "exec": [ "" @@ -9432,7 +9432,7 @@ { "listen": "test", "script": { - "id": "b17c5854-12e4-4341-a601-8f9d02469bf6", + "id": "2efd592c-826e-4d55-8a4c-4d630fa1f9b6", "type": "text/javascript", "exec": [ "" @@ -9455,10 +9455,10 @@ { "listen": "test", "script": { - "id": "5378b1d1-53c7-4fb1-8e6b-b1ef3c39ee06", + "id": "1d856d10-c630-4b60-840f-8039fa0f71c3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = \"Generic Metal Ball\"", + "var projectName = 3", "", "var jsonData = pm.response.json();", "", @@ -9480,7 +9480,7 @@ "});", "", "pm.test(\"Check if created Username matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + " pm.expect(jsonData.id).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -9526,7 +9526,7 @@ { "listen": "test", "script": { - "id": "9a1e5bed-b4f4-4ae9-8a74-a50406115154", + "id": "7656fde1-7848-4cb5-87b8-2f68ffe90481", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9585,7 +9585,7 @@ { "listen": "test", "script": { - "id": "31140aed-1e65-4478-9d1e-1db0210c9181", + "id": "9ca0c0d2-9408-4f4b-a1f3-1e60711dacdb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -9651,7 +9651,7 @@ { "listen": "test", "script": { - "id": "16a83ccb-2390-45a5-9a32-1e97b3ab1b21", + "id": "27d3ab62-f7c3-4854-a6e7-141364f6eea5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9724,7 +9724,7 @@ { "listen": "test", "script": { - "id": "dfe0aa8f-9b2f-46d4-8b37-81c2658aba85", + "id": "8f6f2297-a515-4c7f-9f44-700017fc3e45", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9782,7 +9782,7 @@ { "listen": "test", "script": { - "id": "15540a03-7de0-4287-8cba-3e40199ca923", + "id": "2c44ff08-5189-4ce2-b0c7-1ac71f72bb51", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -9832,7 +9832,7 @@ { "listen": "test", "script": { - "id": "a4e84ff2-6f1f-4bdb-9434-da59c3c4f44e", + "id": "5d8846b2-6d2d-4fab-94cd-1765ff572f07", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -9899,7 +9899,7 @@ { "listen": "test", "script": { - "id": "3be52a6a-d7c4-4dfc-854d-7ad2fea0d507", + "id": "aeb54c50-08b5-43cb-859b-4cc219378efa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9966,7 +9966,7 @@ { "listen": "test", "script": { - "id": "da77376d-bc92-4c5b-928a-d923ce79ca06", + "id": "5de0dbce-1c85-4fcc-956d-1f95113d08c7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10030,7 +10030,7 @@ { "listen": "test", "script": { - "id": "670d4d07-adde-4866-969d-e093cbd7d4dd", + "id": "4dac6757-e25c-40a8-a5b7-ced1d3f54c28", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10094,7 +10094,7 @@ { "listen": "test", "script": { - "id": "2257b5e6-57b1-47f9-9769-cff532f98aea", + "id": "9ae6ab51-6f8a-4125-bf07-87d62ba791dc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10146,7 +10146,7 @@ { "listen": "test", "script": { - "id": "2a0d8b41-64ca-4b23-b526-64bfba1b98f0", + "id": "fbfab176-2361-445b-8210-cbef4aca5ccf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -10204,7 +10204,7 @@ { "listen": "test", "script": { - "id": "5695f8f9-237d-49e2-a415-09fa9886d528", + "id": "a215f69e-965f-4dd5-80c7-27c1eae7ca79", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -10269,7 +10269,7 @@ { "listen": "test", "script": { - "id": "c6b8aad7-092c-4226-a18c-2c64974c655c", + "id": "3a92482a-eced-4ee9-a04b-b0a3a7401b82", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10297,7 +10297,7 @@ { "listen": "prerequest", "script": { - "id": "b901fc38-90f8-45e9-9907-c34944acb6a5", + "id": "6d2d6eea-f0f5-45af-9ae1-d4582b12a776", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10347,7 +10347,7 @@ { "listen": "test", "script": { - "id": "40607808-dd37-46ad-91e9-4b76ce0690f1", + "id": "874b00a5-205d-4e72-a7b4-160f4d1f8791", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10409,7 +10409,7 @@ { "listen": "test", "script": { - "id": "c23f6d89-f9ab-4ff6-83fd-40086d1daa09", + "id": "97535220-1176-494d-b4f4-a4a7e709e7b4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10496,7 +10496,7 @@ { "listen": "test", "script": { - "id": "31cc74bd-2bf8-4717-84f9-01564c704942", + "id": "8248083b-87a6-495d-b1bd-c4f5b16a53bb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10522,7 +10522,7 @@ { "listen": "prerequest", "script": { - "id": "9d27652b-60bf-48b8-a48c-50d063e720ba", + "id": "27cedae2-47bb-4a16-81d3-44028c354993", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10569,7 +10569,7 @@ { "listen": "test", "script": { - "id": "a0793976-b8a8-4c95-abb5-9be767e390b0", + "id": "bb670b70-a39f-4cd4-adc9-d9c3481c6ead", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10596,7 +10596,7 @@ { "listen": "prerequest", "script": { - "id": "980453fa-850b-4b71-8e77-208287610b1d", + "id": "54a6efb9-2b62-41c8-b2f5-54e89c86c7ea", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10646,7 +10646,7 @@ { "listen": "test", "script": { - "id": "7f68d01c-c465-4294-9e6b-1954347fbebc", + "id": "58b30145-c908-441b-9e33-ccc204a28f3c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10708,7 +10708,7 @@ { "listen": "test", "script": { - "id": "f68fe8be-866c-4647-8419-1f5793aa5bef", + "id": "57306014-34c8-40d6-9e17-df77e745535a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10795,7 +10795,7 @@ { "listen": "test", "script": { - "id": "a99dc595-4212-4909-8776-c74457087e17", + "id": "e40405c2-ca3b-4361-a553-71fccc659884", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10821,7 +10821,7 @@ { "listen": "prerequest", "script": { - "id": "748b4426-4cb5-4914-b8ba-b01cb3e82cdf", + "id": "a2218cd0-ea9a-42c8-8b95-3bdfac11f956", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10868,7 +10868,7 @@ { "listen": "test", "script": { - "id": "5f6b625c-74fb-4cda-9044-72fd9ae38299", + "id": "5ad8ee5c-5eac-4716-8a75-bc7750515f30", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10944,7 +10944,7 @@ { "listen": "test", "script": { - "id": "98d9749e-fe1c-424b-a91b-150465c37e4d", + "id": "6118d144-de52-4ff4-879a-2b7d8a12d19b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11005,7 +11005,7 @@ { "listen": "test", "script": { - "id": "3b41c3c7-acea-4107-8612-7aba6a9be859", + "id": "96498358-ff50-4f99-8353-55b7f9deec68", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11057,7 +11057,7 @@ { "listen": "test", "script": { - "id": "22082968-3b02-49b0-8b31-85cef05c7ca5", + "id": "25fd2cb2-01e7-4ce1-ba9b-07d4258669de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11110,7 +11110,7 @@ { "listen": "test", "script": { - "id": "88caac75-664d-4cdb-80a2-ddb035a498d4", + "id": "c90137c5-1598-4b83-bddb-89f014d104a6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11163,7 +11163,7 @@ { "listen": "test", "script": { - "id": "de491597-1b5d-4d65-89ce-fe44c3b28439", + "id": "9b61635b-c683-4c8a-bc15-6b6c6fd7b865", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11225,7 +11225,7 @@ { "listen": "test", "script": { - "id": "f7b61ce1-a006-4678-8f3c-2051406382f3", + "id": "4c7d50f7-edca-44fb-bead-c4e84f2bc81a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11306,7 +11306,7 @@ { "listen": "test", "script": { - "id": "e9aa62ee-58a4-4aa9-b142-7ac067eda855", + "id": "7e670af1-8086-4b65-b96e-df0175e7135d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11365,7 +11365,7 @@ { "listen": "test", "script": { - "id": "8689424b-f1a4-4301-a481-e9b19dfb3dd3", + "id": "1cd71ba7-bbca-4b13-80d5-5bbfe10c0662", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -11431,7 +11431,7 @@ { "listen": "test", "script": { - "id": "335c1132-aba4-4f26-af02-ea70638d7b5b", + "id": "aed618d6-29e4-4bd7-928c-8170d41faa74", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11480,7 +11480,7 @@ { "listen": "test", "script": { - "id": "01088b66-4c7d-4eda-876f-6b235b63cdeb", + "id": "38fb700d-778d-4077-91b7-5b57baa850ae", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11529,7 +11529,7 @@ { "listen": "test", "script": { - "id": "a90dfb3f-7902-42fa-8392-5cbfcdb7a272", + "id": "9cd807f1-fb83-48d3-bbde-e00c8d96ebf5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11574,7 +11574,7 @@ { "listen": "test", "script": { - "id": "8fd8b0a3-6b6a-45dd-9d18-a23ccad0ae82", + "id": "4a2a41aa-621d-424c-8f2d-5c8ea241b8ec", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11619,7 +11619,7 @@ { "listen": "test", "script": { - "id": "63275d2a-5d61-46fe-9d1e-0ea05f30876f", + "id": "f0d625fc-937b-4004-96e1-9f4704283ea8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11664,7 +11664,7 @@ { "listen": "test", "script": { - "id": "7a3d1e42-0f9a-477e-a4a0-5024d942f183", + "id": "7b8663b4-b140-4187-972f-3d2205896d5d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11717,7 +11717,7 @@ { "listen": "test", "script": { - "id": "2b2bcdb6-4a7c-46c2-886d-9473c157bc5a", + "id": "8bfa8b54-767b-4617-82d6-31920b9e440c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11770,7 +11770,7 @@ { "listen": "test", "script": { - "id": "8e333512-be53-4228-a0ea-5102199a2b80", + "id": "14206cca-c9ce-4abc-bc62-a773ccf14747", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11853,7 +11853,7 @@ { "listen": "prerequest", "script": { - "id": "4412aad6-a67e-494b-81af-78d59ddba2b0", + "id": "27cd2b77-ecf3-44cd-b4ab-eb40f0fcdbf1", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11897,7 +11897,7 @@ { "listen": "test", "script": { - "id": "41ba7edc-a1c1-469e-83cb-e5f3229e3495", + "id": "0a2e5a58-b3d9-4f1a-9d62-d3a31efa8d00", "type": "text/javascript", "exec": [ "" diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 0b588f43..73edc07e 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "e38979d7-ba53-46a0-bbf9-11d075b593e9", + "id": "536afbc3-3e38-4fdb-9b5a-df4194d8181b", "name": "Local", "values": [ { @@ -219,6 +219,6 @@ } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-10-26T15:16:10.089Z", + "_postman_exported_at": "2020-10-26T16:12:46.005Z", "_postman_exported_using": "Postman/7.34.0" } \ No newline at end of file From 38b256507f25b02249ed6a3f53ad9944301a57cf Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 26 Oct 2020 19:19:19 +0100 Subject: [PATCH 078/157] Updated DeleteAccount method --- API/Controllers/UserController.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 04e135cf..615b2d46 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -275,14 +275,12 @@ public async Task DeleteAccount() public async Task DeleteAccount(int userId) { User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.UserWrite)); - bool hasUserWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.UserWrite)); bool hasCorrectDataOfficerRights = - userService.UserHasScope(currentUser.IdentityId, nameof(Defaults.Scopes.RequestUserRead)) && - await userService.HasSameInstitution(currentUser.Id, userId); - bool isAllowed = hasUserReadScope || hasCorrectDataOfficerRights; + userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestUserWrite)) && + await userService.HasSameInstitution(user.Id, userId); + bool isAllowed = hasUserWriteScope || hasCorrectDataOfficerRights; if(user.Id != userId && !isAllowed) { From c3735922e68aa1c934d55985d68e9168a4aea52d Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 28 Oct 2020 14:00:22 +0100 Subject: [PATCH 079/157] Updated identity id --- Data/Helpers/Seed.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 58d9c9a9..5cc0e0f3 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -150,7 +150,7 @@ public static User SeedDataOfficerUser(List roles) Role dataOfficerRole = roles.Find(role => role.Name == nameof(Defaults.Roles.DataOfficer)); User user = new User { - IdentityId = "919191919", + IdentityId = "954654861", Email = "dataofficer@dex.software", Name = "data officer Sam", Role = dataOfficerRole From 442e24e3ab2895580267a5c089b59c5adf2413ef Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 28 Oct 2020 14:41:11 +0100 Subject: [PATCH 080/157] Added licence --- API/Filters/DefaultOperationFilter.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/API/Filters/DefaultOperationFilter.cs b/API/Filters/DefaultOperationFilter.cs index 89ebc4e1..97cced52 100644 --- a/API/Filters/DefaultOperationFilter.cs +++ b/API/Filters/DefaultOperationFilter.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Microsoft.AspNetCore.Mvc; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; From f626b0ed3bb028ad34943b1ebf06bbb1a4bbce3f Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 28 Oct 2020 14:41:39 +0100 Subject: [PATCH 081/157] Extended to all personal data --- API/Controllers/EmbedController.cs | 15 +++++++++++++-- API/Controllers/ProjectController.cs | 6 +++++- Models/Defaults/Defaults.cs | 13 +++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/API/Controllers/EmbedController.cs b/API/Controllers/EmbedController.cs index 9222bffe..8fc642ab 100644 --- a/API/Controllers/EmbedController.cs +++ b/API/Controllers/EmbedController.cs @@ -179,9 +179,14 @@ public async Task CreateEmbeddedProject(EmbeddedProjectResource e } string identity = HttpContext.User.GetIdentityId(HttpContext); - bool isAllowed = userService.UserHasScope(identity, nameof(Defaults.Scopes.EmbedWrite)); User user = await userService.GetUserByIdentityIdAsync(identity); + bool hasEmbedWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.EmbedWrite)); + bool hasCorrectDataOfficerRights = + userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestEmbedWrite)) && + await userService.HasSameInstitution(user.Id, project.UserId); + bool isAllowed = hasEmbedWriteScope || hasCorrectDataOfficerRights; + if(!(project.UserId == user.Id || isAllowed)) { ProblemDetails problem = new ProblemDetails @@ -253,7 +258,13 @@ public async Task DeleteEmbeddedProject(string guid) } string identity = HttpContext.User.GetIdentityId(HttpContext); - bool isAllowed = userService.UserHasScope(identity, nameof(Defaults.Scopes.EmbedWrite)); + User user = await userService.GetUserByIdentityIdAsync(identity); + + bool hasEmbedWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.EmbedWrite)); + bool hasCorrectDataOfficerRights = + userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestEmbedWrite)) && + await userService.HasSameInstitution(user.Id, embeddedProject.UserId); + bool isAllowed = hasEmbedWriteScope || hasCorrectDataOfficerRights; if(!(embeddedProject.User.IdentityId == identity || isAllowed)) { diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index f153261b..1bc77b8e 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -276,7 +276,11 @@ public async Task DeleteProject(int projectId) } User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.ProjectWrite)); + bool hasProjectWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.ProjectWrite)); + bool hasCorrectDataOfficerRights = + userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestProjectWrite)) && + await userService.HasSameInstitution(user.Id, project.UserId); + bool isAllowed = hasProjectWriteScope || hasCorrectDataOfficerRights; if(!(project.UserId == user.Id || isAllowed)) { diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index 59c0571c..5ea55626 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -94,11 +94,16 @@ public static class Scopes [Description("This scope gives write access to the embed namespace")] public const string EmbedRead = "embed:read"; - [Description("This scope gives read access to user roles for other users within their institution to the User namespace")] - public const string RequestUserRead = "user:request-write"; + [Description("This scope gives read access to user roles for other users within their institution to the User namespace.")] + public const string RequestUserRead = "user:request-read"; - [Description("This scope gives write access to user roles for other users within their institution to the User namespace")] - public const string RequestUserWrite = "user:request-delete"; + [Description("This scope gives write access to user roles for other users within their institution to the User namespace.")] + public const string RequestUserWrite = "user:request-write"; + + [Description("this scope gives write access to user roles for other users within their institution to the Project namespace.")] + public const string RequestProjectWrite = "user:request-write"; + + public const string RequestEmbedWrite = "embed:request-write"; } From 603c3713a94810acda4d2bf963d153f1a877b066 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 28 Oct 2020 21:52:23 +0100 Subject: [PATCH 082/157] Updated role with new rolescopes --- Data/Helpers/Seed.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 5cc0e0f3..4ab92d64 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -82,7 +82,9 @@ public static List SeedRoles() Scopes = new List { new RoleScope(nameof(Defaults.Scopes.RequestUserRead)), - new RoleScope(nameof(Defaults.Scopes.RequestUserWrite)) + new RoleScope(nameof(Defaults.Scopes.RequestUserWrite)), + new RoleScope(nameof(Defaults.Scopes.RequestEmbedWrite)), + new RoleScope(nameof(Defaults.Scopes.RequestProjectWrite)), } }; roles.Add(dataOfficerRole); From 297cd2e6beb3c866368988316bbbbb34b478d6d6 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 28 Oct 2020 21:57:43 +0100 Subject: [PATCH 083/157] Return forbid instead of unauthorized for wrong scope --- API/Controllers/UserController.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 615b2d46..542954e1 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -108,15 +108,7 @@ public async Task GetUser(int userId) bool isAllowed = hasUserReadScope || hasCorrectDataOfficerRights; if(!isAllowed) - { - ProblemDetails problem = new ProblemDetails - { - Title = "Failed to retrieve the user.", - Detail = "The user is not allowed to retrieve this user.", - Instance = "09D64E7C-DF87-4CBD-9B2E-ECE00670DB35" - }; - return Unauthorized(problem); - } + return Forbid(); if(userId < 0) { From 1108a4f4e785495cdbd4cb2ee6a94564be9ee4cb Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 10:49:37 +0100 Subject: [PATCH 084/157] Same institution doesn't mean both null --- Services/Services/UserService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Services/Services/UserService.cs b/Services/Services/UserService.cs index f8a013fd..edc57a85 100644 --- a/Services/Services/UserService.cs +++ b/Services/Services/UserService.cs @@ -74,7 +74,7 @@ public async Task HasSameInstitution(int ownUserId, int requestUserId) { var ownUserInfo = await Repository.FindAsync(ownUserId); var userRequestInfo = await Repository.FindAsync(requestUserId); - return ownUserInfo.Institution == userRequestInfo.Institution; + return ownUserInfo.Institution == userRequestInfo.Institution && ownUserInfo.Institution != null; } public bool UserWithRoleExists(Role role) From 8cb893067b9fa7e38c1efde54b00d713142cc497 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 11:41:06 +0100 Subject: [PATCH 085/157] Added basic authorization helper to implement DRY principles better --- API/Controllers/EmbedController.cs | 25 ++++++++++++------------- API/Controllers/ProjectController.cs | 14 ++++++++------ API/Controllers/UserController.cs | 25 ++++++++++++------------- API/Startup.cs | 2 ++ 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/API/Controllers/EmbedController.cs b/API/Controllers/EmbedController.cs index 8fc642ab..829b78c9 100644 --- a/API/Controllers/EmbedController.cs +++ b/API/Controllers/EmbedController.cs @@ -15,6 +15,7 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.Common; using API.Extensions; using API.Resources; using AutoMapper; @@ -47,6 +48,7 @@ public class EmbedController : ControllerBase private readonly IMapper mapper; private readonly IProjectService projectService; private readonly IUserService userService; + private readonly IAuthorizationHelper authorizationHelper; /// /// Initializes a new instance of the class @@ -55,12 +57,13 @@ public class EmbedController : ControllerBase /// The mapper which is used to convert the resources to the models to the resource results. /// The project service which is used to communicate with the logic layer. /// The user service which is used to communicate with the logic layer. - public EmbedController(IEmbedService embedService, IMapper mapper, IProjectService projectService, IUserService userService) + public EmbedController(IEmbedService embedService, IMapper mapper, IProjectService projectService, IUserService userService, IAuthorizationHelper authorizationHelper) { this.embedService = embedService; this.mapper = mapper; this.projectService = projectService; this.userService = userService; + this.authorizationHelper = authorizationHelper; } /// @@ -180,12 +183,10 @@ public async Task CreateEmbeddedProject(EmbeddedProjectResource e string identity = HttpContext.User.GetIdentityId(HttpContext); User user = await userService.GetUserByIdentityIdAsync(identity); - - bool hasEmbedWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.EmbedWrite)); - bool hasCorrectDataOfficerRights = - userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestEmbedWrite)) && - await userService.HasSameInstitution(user.Id, project.UserId); - bool isAllowed = hasEmbedWriteScope || hasCorrectDataOfficerRights; + bool isAllowed = await authorizationHelper.UserIsAllowed(user, + nameof(Defaults.Scopes.EmbedWrite), + nameof(Defaults.Scopes.RequestEmbedWrite), + project.UserId); if(!(project.UserId == user.Id || isAllowed)) { @@ -259,12 +260,10 @@ public async Task DeleteEmbeddedProject(string guid) string identity = HttpContext.User.GetIdentityId(HttpContext); User user = await userService.GetUserByIdentityIdAsync(identity); - - bool hasEmbedWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.EmbedWrite)); - bool hasCorrectDataOfficerRights = - userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestEmbedWrite)) && - await userService.HasSameInstitution(user.Id, embeddedProject.UserId); - bool isAllowed = hasEmbedWriteScope || hasCorrectDataOfficerRights; + bool isAllowed = await authorizationHelper.UserIsAllowed(user, + nameof(Defaults.Scopes.EmbedWrite), + nameof(Defaults.Scopes.RequestEmbedWrite), + embeddedProject.UserId); if(!(embeddedProject.User.IdentityId == identity || isAllowed)) { diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 1bc77b8e..622395dd 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -15,6 +15,7 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.Common; using API.Extensions; using API.Resources; using AutoMapper; @@ -43,6 +44,7 @@ public class ProjectController : ControllerBase private readonly IMapper mapper; private readonly IProjectService projectService; private readonly IUserService userService; + private readonly IAuthorizationHelper authorizationHelper; /// /// Initializes a new instance of the class @@ -50,11 +52,12 @@ public class ProjectController : ControllerBase /// The project service which is used to communicate with the logic layer. /// The user service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. - public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper) + public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper, IAuthorizationHelper authorizationHelper) { this.projectService = projectService; this.userService = userService; this.mapper = mapper; + this.authorizationHelper = authorizationHelper; } /// @@ -276,11 +279,10 @@ public async Task DeleteProject(int projectId) } User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - bool hasProjectWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.ProjectWrite)); - bool hasCorrectDataOfficerRights = - userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestProjectWrite)) && - await userService.HasSameInstitution(user.Id, project.UserId); - bool isAllowed = hasProjectWriteScope || hasCorrectDataOfficerRights; + bool isAllowed = await authorizationHelper.UserIsAllowed(user, + nameof(Defaults.Scopes.ProjectWrite), + nameof(Defaults.Scopes.RequestProjectWrite), + project.UserId); if(!(project.UserId == user.Id || isAllowed)) { diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 542954e1..c3726b5b 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -15,6 +15,7 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.Common; using API.Extensions; using API.Resources; using AutoMapper; @@ -43,6 +44,7 @@ public class UserController : ControllerBase private readonly IMapper mapper; private readonly IUserService userService; private readonly IRoleService roleService; + private readonly IAuthorizationHelper authorizationHelper; /// /// Initializes a new instance of the class @@ -50,11 +52,12 @@ public class UserController : ControllerBase /// The user service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. /// The role service which is used to communicate with the logic layer. - public UserController(IUserService userService, IMapper mapper, IRoleService roleService) + public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IAuthorizationHelper authorizationHelper) { this.userService = userService; this.mapper = mapper; this.roleService = roleService; + this.authorizationHelper = authorizationHelper; } /// @@ -100,12 +103,10 @@ public async Task GetCurrentUser() public async Task GetUser(int userId) { User currentUser = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - - bool hasUserReadScope = userService.UserHasScope(currentUser.IdentityId, nameof(Defaults.Scopes.UserRead)); - bool hasCorrectDataOfficerRights = - userService.UserHasScope(currentUser.IdentityId, nameof(Defaults.Scopes.RequestUserRead)) && - await userService.HasSameInstitution(currentUser.Id, userId); - bool isAllowed = hasUserReadScope || hasCorrectDataOfficerRights; + bool isAllowed = await authorizationHelper.UserIsAllowed(currentUser, + nameof(Defaults.Scopes.UserRead), + nameof(Defaults.Scopes.RequestUserRead), + userId); if(!isAllowed) return Forbid(); @@ -267,12 +268,10 @@ public async Task DeleteAccount() public async Task DeleteAccount(int userId) { User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); - - bool hasUserWriteScope = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.UserWrite)); - bool hasCorrectDataOfficerRights = - userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.RequestUserWrite)) && - await userService.HasSameInstitution(user.Id, userId); - bool isAllowed = hasUserWriteScope || hasCorrectDataOfficerRights; + bool isAllowed = await authorizationHelper.UserIsAllowed(user, + nameof(Defaults.Scopes.UserWrite), + nameof(Defaults.Scopes.RequestUserWrite), + userId); if(user.Id != userId && !isAllowed) { diff --git a/API/Startup.cs b/API/Startup.cs index 8ae2eb99..2b758cac 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -15,6 +15,7 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.Common; using API.Configuration; using API.Extensions; using API.Filters; @@ -197,6 +198,7 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(Config); services.AddServicesAndRepositories(); services.AddProblemDetails(); + services.AddTransient(); } /// From 2b43f4cb1e37afe14cd7eb9df4b535f8ae6a1b6d Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 11:41:35 +0100 Subject: [PATCH 086/157] Updated warning to avoid var for OpenApiMediaType --- API/Filters/DefaultOperationFilter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/Filters/DefaultOperationFilter.cs b/API/Filters/DefaultOperationFilter.cs index 97cced52..92f09361 100644 --- a/API/Filters/DefaultOperationFilter.cs +++ b/API/Filters/DefaultOperationFilter.cs @@ -44,7 +44,7 @@ public void Apply(OpenApiOperation operation, OperationFilterContext context) .Count() != 0; if(operation.RequestBody != null && !hasConsumeAttribute) { - var mediaType = operation.RequestBody.Content["application/json"]; + OpenApiMediaType mediaType = operation.RequestBody.Content["application/json"]; operation.RequestBody.Content.Clear(); operation.RequestBody.Content.Add("application/json", mediaType); } From 1c660927bec39e347a9537a480f1f518389fb20c Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 11:42:08 +0100 Subject: [PATCH 087/157] Added Authorization helper --- API/Common/AuthorizationHelper.cs | 44 ++++++++++++++++++++++++++++++ API/Common/IAuthorizationHelper.cs | 26 ++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 API/Common/AuthorizationHelper.cs create mode 100644 API/Common/IAuthorizationHelper.cs diff --git a/API/Common/AuthorizationHelper.cs b/API/Common/AuthorizationHelper.cs new file mode 100644 index 00000000..80e8bb33 --- /dev/null +++ b/API/Common/AuthorizationHelper.cs @@ -0,0 +1,44 @@ +using Models; +using Services.Services; +using System.Threading.Tasks; + +namespace API.Common +{ + /// + /// + /// + public class AuthorizationHelper : IAuthorizationHelper + { + + private readonly IUserService userService; + + /// + /// + /// + /// + public AuthorizationHelper(IUserService userService) + { + this.userService = userService; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public async Task UserIsAllowed(User loggedInUser, string scope, string dataOfficerScope, int propertyOfUserId) + { + bool hasUserWriteScope = userService.UserHasScope(loggedInUser.IdentityId, scope); + bool hasCorrectDataOfficerRights = + userService.UserHasScope(loggedInUser.IdentityId, dataOfficerScope) && + await userService.HasSameInstitution(loggedInUser.Id, propertyOfUserId); + bool isAllowed = hasUserWriteScope || hasCorrectDataOfficerRights; + return isAllowed; + } + + } + +} diff --git a/API/Common/IAuthorizationHelper.cs b/API/Common/IAuthorizationHelper.cs new file mode 100644 index 00000000..2158b817 --- /dev/null +++ b/API/Common/IAuthorizationHelper.cs @@ -0,0 +1,26 @@ +using Models; +using System.Threading.Tasks; + +namespace API.Common +{ + /// + /// + /// + public interface IAuthorizationHelper + { + /// + /// + /// + /// + /// + /// + /// + /// + public Task UserIsAllowed(User loggedInUser, + string scope, + string dataOfficerScope, + int propertyOfUserId); + + } + +} From e53c9a5bd171fe37e39f3facc100c18c008e2a99 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 11:49:17 +0100 Subject: [PATCH 088/157] Added documentation for the authorization helper --- API/Common/AuthorizationHelper.cs | 39 +++++++++++++++++++++++------- API/Common/IAuthorizationHelper.cs | 35 +++++++++++++++++++++------ 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/API/Common/AuthorizationHelper.cs b/API/Common/AuthorizationHelper.cs index 80e8bb33..d2814a11 100644 --- a/API/Common/AuthorizationHelper.cs +++ b/API/Common/AuthorizationHelper.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Services.Services; using System.Threading.Tasks; @@ -5,7 +22,7 @@ namespace API.Common { /// - /// + /// The implementation for the authorization helper. /// public class AuthorizationHelper : IAuthorizationHelper { @@ -13,22 +30,26 @@ public class AuthorizationHelper : IAuthorizationHelper private readonly IUserService userService; /// - /// + /// Initializes a new instance of the class. /// - /// + /// The user service for communicating with the logic layer. public AuthorizationHelper(IUserService userService) { this.userService = userService; } /// - /// + /// This method checks if a user has the correct scope to use the endpoint. + /// This method checks for a normal scope and the data officer scope within the + /// same institution. /// - /// - /// - /// - /// - /// + /// The user model of the logged in user. + /// The required scope for accessing this endpoint. + /// The required scope for accessing this + /// endpoint for data officers within the same institution. + /// The id of the user owner of the property + /// which the logged in user wants to access. + /// bool: true if the user is allowed, false if the user is not allowed. public async Task UserIsAllowed(User loggedInUser, string scope, string dataOfficerScope, int propertyOfUserId) { bool hasUserWriteScope = userService.UserHasScope(loggedInUser.IdentityId, scope); diff --git a/API/Common/IAuthorizationHelper.cs b/API/Common/IAuthorizationHelper.cs index 2158b817..33a8091d 100644 --- a/API/Common/IAuthorizationHelper.cs +++ b/API/Common/IAuthorizationHelper.cs @@ -1,21 +1,42 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using System.Threading.Tasks; namespace API.Common { /// - /// + /// The interface for the authorization helper /// public interface IAuthorizationHelper { /// - /// + /// This method checks if a user has the correct scope to use the endpoint. + /// This method checks for a normal scope and the data officer scope within the + /// same institution. /// - /// - /// - /// - /// - /// + /// The user model of the logged in user. + /// The required scope for accessing this endpoint. + /// The required scope for accessing this + /// endpoint for data officers within the same institution. + /// The id of the user owner of the property + /// which the logged in user wants to access. + /// bool: true if the user is allowed, false if the user is not allowed. public Task UserIsAllowed(User loggedInUser, string scope, string dataOfficerScope, From e74a0cf06775bc19316a90b6699087e8cab6cdb8 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 11:52:29 +0100 Subject: [PATCH 089/157] Added documentation in the controllers for the authorization helper --- API/Controllers/EmbedController.cs | 9 ++++++--- API/Controllers/ProjectController.cs | 6 +++++- API/Controllers/UserController.cs | 7 +++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/API/Controllers/EmbedController.cs b/API/Controllers/EmbedController.cs index 829b78c9..d7b232b0 100644 --- a/API/Controllers/EmbedController.cs +++ b/API/Controllers/EmbedController.cs @@ -28,9 +28,7 @@ using Services.Services; using System; using System.Collections.Generic; -using System.Linq; using System.Net; -using System.Linq.Expressions; using System.Threading.Tasks; namespace API.Controllers @@ -57,7 +55,12 @@ public class EmbedController : ControllerBase /// The mapper which is used to convert the resources to the models to the resource results. /// The project service which is used to communicate with the logic layer. /// The user service which is used to communicate with the logic layer. - public EmbedController(IEmbedService embedService, IMapper mapper, IProjectService projectService, IUserService userService, IAuthorizationHelper authorizationHelper) + /// The authorization helper which is used to communicate with the authorization helper class. + public EmbedController(IEmbedService embedService, + IMapper mapper, + IProjectService projectService, + IUserService userService, + IAuthorizationHelper authorizationHelper) { this.embedService = embedService; this.mapper = mapper; diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 622395dd..f853cefe 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -52,7 +52,11 @@ public class ProjectController : ControllerBase /// The project service which is used to communicate with the logic layer. /// The user service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. - public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper, IAuthorizationHelper authorizationHelper) + /// The authorization helper which is used to communicate with the authorization helper class. + public ProjectController(IProjectService projectService, + IUserService userService, + IMapper mapper, + IAuthorizationHelper authorizationHelper) { this.projectService = projectService; this.userService = userService; diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index c3726b5b..1eea2c7b 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -26,7 +26,6 @@ using Models.Defaults; using Serilog; using Services.Services; -using System; using System.Linq; using System.Net; using System.Threading.Tasks; @@ -52,7 +51,11 @@ public class UserController : ControllerBase /// The user service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. /// The role service which is used to communicate with the logic layer. - public UserController(IUserService userService, IMapper mapper, IRoleService roleService, IAuthorizationHelper authorizationHelper) + /// The authorization helper which is used to communicate with the authorization helper class. + public UserController(IUserService userService, + IMapper mapper, + IRoleService roleService, + IAuthorizationHelper authorizationHelper) { this.userService = userService; this.mapper = mapper; From fdbce8f38b799f09c8f3ea886693f7f14754479a Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 13:44:49 +0100 Subject: [PATCH 090/157] Updated seed to add test Fontys institution --- API/Startup.cs | 4 ++++ Data/Helpers/Seed.cs | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/API/Startup.cs b/API/Startup.cs index 2b758cac..ed3c9c35 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -352,6 +352,10 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment if(!env.IsProduction()) { + // Seed institutions + context.Institution.Add(Seed.SeedInstitution()); + context.SaveChanges(); + if(!context.Project.Any()) { //Seed projects diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 4ab92d64..9ac67d93 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -129,6 +129,19 @@ public static User SeedAdminUser(List roles) return user; } /// + /// This method seeds a test institution in the database. + /// + /// Returns the institution that will be seeded in the databse. + public static Institution SeedInstitution() + { + Institution institution = new Institution + { + Name = "Fontys", + Description = "Description for Fontys" + }; + return institution; + } + /// /// Seeds the pr user. /// /// The roles. From 5dd18b462d177d1af57269e1fa730d11103e076d Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 13:45:17 +0100 Subject: [PATCH 091/157] Updated return type to show added institution --- API/Controllers/UserController.cs | 2 +- API/Resources/UserResource.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 1eea2c7b..d0930417 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -161,7 +161,7 @@ public async Task CreateAccountAsync([FromBody] UserResource acco { userService.Add(user); userService.Save(); - return Created(nameof(CreateAccountAsync), mapper.Map(user)); + return Created(nameof(CreateAccountAsync), await GetUser(user.Id)); } catch(DbUpdateException e) { Log.Logger.Error(e, "Database exception"); diff --git a/API/Resources/UserResource.cs b/API/Resources/UserResource.cs index e62ca997..95b8ddc0 100644 --- a/API/Resources/UserResource.cs +++ b/API/Resources/UserResource.cs @@ -44,6 +44,11 @@ public class UserResource /// public string ProfileUrl { get; set; } + /// + /// This gets or sets the Institution Id. + /// + public int? InstitutionId { get; set; } + } } From fef85f07030af480e607078cb16dcb43b7ecf377 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 13:45:37 +0100 Subject: [PATCH 092/157] Created first version for the institution repository --- Repositories/InstitutionRepository.cs | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Repositories/InstitutionRepository.cs diff --git a/Repositories/InstitutionRepository.cs b/Repositories/InstitutionRepository.cs new file mode 100644 index 00000000..70eec1b6 --- /dev/null +++ b/Repositories/InstitutionRepository.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore; +using Models; +using Repositories.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Repositories +{ + + /// + /// The institution repository interface + /// + /// + public interface IInstitutionRepository : IRepository + { + + /// + /// This method returns all the institutions. + /// + /// This method returns a collection of institutions. + Task> GetInstitutionsAsync(); + + } + + /// + /// The implementation for the institution repository + /// + /// + /// + public class InstitutionRepository : Repository, IInstitutionRepository + { + + public InstitutionRepository(DbContext dbContext) : base(dbContext) { } + + public async Task> GetInstitutionsAsync() + { + return await GetDbSet() + .ToListAsync(); + } + + } + +} From fab170de793cded3c90e6f741abd9f09e2fcffa5 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 13:45:55 +0100 Subject: [PATCH 093/157] Updated user model to store institution id for adding an institution --- Models/User.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Models/User.cs b/Models/User.cs index ec9c150a..f38a8853 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -57,6 +57,11 @@ public User() /// public bool IsPublic { get; set; } + /// + /// Gets or sets a value for the Id of the institution where the user is registered. + /// + public int? InstitutionId { get; set; } + /// /// Gets or sets the institution where the user is registered. /// From 37c55ef55d83439bd7c100919624d3e27e125bfa Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 13:54:45 +0100 Subject: [PATCH 094/157] Created first version for the institution service --- Services/Services/InstitutionService.cs | 54 +++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Services/Services/InstitutionService.cs diff --git a/Services/Services/InstitutionService.cs b/Services/Services/InstitutionService.cs new file mode 100644 index 00000000..cf45c1cb --- /dev/null +++ b/Services/Services/InstitutionService.cs @@ -0,0 +1,54 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Models; +using Repositories; +using Repositories.Base; +using Services.Base; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Services.Services +{ + + public interface IInstitutionService : IService + { + + /// + /// This method gets the institution with the specified id asynchronous. + /// + /// The id of the institution used for searching the institution. + /// This method returns the found institution with the specified id. + Task> GetInstitutionsAsync(); + + } + + public class InstitutionService : Service, IInstitutionService + { + + public InstitutionService(IRepository repository) : base(repository) { } + + protected new IInstitutionRepository Repository => (IInstitutionRepository) base.Repository; + + public async Task> GetInstitutionsAsync() + { + return await Repository.GetInstitutionsAsync(); + } + + } + +} From ab61daff4befa6c301649af9862c472ef4bf3d5e Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 13:55:39 +0100 Subject: [PATCH 095/157] Updated parameter documentation --- Services/Services/InstitutionService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Services/Services/InstitutionService.cs b/Services/Services/InstitutionService.cs index cf45c1cb..401e7739 100644 --- a/Services/Services/InstitutionService.cs +++ b/Services/Services/InstitutionService.cs @@ -31,7 +31,6 @@ public interface IInstitutionService : IService /// /// This method gets the institution with the specified id asynchronous. /// - /// The id of the institution used for searching the institution. /// This method returns the found institution with the specified id. Task> GetInstitutionsAsync(); From 35599d780a7da7a0ea8cfd787d5d199385761e31 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 14:09:18 +0100 Subject: [PATCH 096/157] Added institution resource --- API/Resources/InstitutionResource.cs | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 API/Resources/InstitutionResource.cs diff --git a/API/Resources/InstitutionResource.cs b/API/Resources/InstitutionResource.cs new file mode 100644 index 00000000..efe8256c --- /dev/null +++ b/API/Resources/InstitutionResource.cs @@ -0,0 +1,39 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +namespace API.Resources +{ + + /// + /// The viewmodel of a Institution model + /// + public class InstitutionResource + { + + /// + /// Gets or sets a value for the name of the institution. + /// + public string Name { get; set; } + + /// + /// Gets or sets a value for the description of the institution. + /// + public string Description { get; set; } + + } + +} From 58b18c9b0806077af86ed341a67a94ff7d8e8291 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 14:09:24 +0100 Subject: [PATCH 097/157] Added institution resource result --- API/Resources/InstitutionResourceResult.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 API/Resources/InstitutionResourceResult.cs diff --git a/API/Resources/InstitutionResourceResult.cs b/API/Resources/InstitutionResourceResult.cs new file mode 100644 index 00000000..d94eee5a --- /dev/null +++ b/API/Resources/InstitutionResourceResult.cs @@ -0,0 +1,34 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +namespace API.Resources +{ + + /// + /// Resource Result of the Institution model + /// + public class InstitutionResourceResult : InstitutionResource + { + + /// + /// Gets or sets a the id of the institution. + /// + public int Id { get; set; } + + } + +} From d37baf476adb34d70db32a58e2425c94da92af6c Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 14:25:45 +0100 Subject: [PATCH 098/157] Improve embed controller grammar documentation --- API/Controllers/EmbedController.cs | 2 +- Models/Defaults/Defaults.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/API/Controllers/EmbedController.cs b/API/Controllers/EmbedController.cs index d7b232b0..5a42e343 100644 --- a/API/Controllers/EmbedController.cs +++ b/API/Controllers/EmbedController.cs @@ -89,7 +89,7 @@ public async Task GetAllEmbeddedProjects() /// /// The unique identifier which is used for searching the embedded project. /// This method returns the project resource result. - /// This endpoint returns a embedded project with the specified guid. + /// This endpoint returns an embedded project with the specified guid. /// The 400 Bad Request status code is returned when the guid is not specified. /// The 404 Not Found status code is returned when no project could be /// found with the specified guid. diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index 5ea55626..45eb1eb1 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -100,11 +100,18 @@ public static class Scopes [Description("This scope gives write access to user roles for other users within their institution to the User namespace.")] public const string RequestUserWrite = "user:request-write"; - [Description("this scope gives write access to user roles for other users within their institution to the Project namespace.")] + [Description("This scope gives write access to user roles for other users within their institution to the Project namespace.")] public const string RequestProjectWrite = "user:request-write"; + [Description("This scope gives write access to user roles for other users within their institution to the Embed namespace.")] public const string RequestEmbedWrite = "embed:request-write"; + [Description("This scope gives read access to the Insitution namespace.")] + public const string InstitutionRead = "institution:read"; + + [Description("This scope gives write access to the Insitution namespace.")] + public const string InstitutionWrite = "institution:write"; + } } From 4d6d911539005aa21e3fce49f9bf652d66975886 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 14:48:56 +0100 Subject: [PATCH 099/157] Created institution controller --- API/Controllers/InstitutionController.cs | 247 +++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 API/Controllers/InstitutionController.cs diff --git a/API/Controllers/InstitutionController.cs b/API/Controllers/InstitutionController.cs new file mode 100644 index 00000000..4205c7dc --- /dev/null +++ b/API/Controllers/InstitutionController.cs @@ -0,0 +1,247 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using API.Resources; +using AutoMapper; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Models; +using Models.Defaults; +using Serilog; +using Services.Services; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; + +namespace API.Controllers +{ + + /// + /// This class is responsible for handling HTTP requests that are related + /// to the institutions, for example creating, retrieving, updating or deleting. + /// + /// + [Route("api/[controller]")] + [ApiController] + public class InstitutionController : ControllerBase + { + + private readonly IInstitutionService institutionService; + private readonly IMapper mapper; + + /// + /// Initializes a new instance of the class. + /// + /// The institution service which is used to communicate with the logic layer. + /// The mapper which is used to convert the resources to the models to the resource results. + public InstitutionController(IInstitutionService institutionService, IMapper mapper) + { + this.institutionService = institutionService; + this.mapper = mapper; + } + + /// + /// This method is responsible for retrieving all the institutions. + /// + /// This method returns a list of institution resource results. + /// This endpoint returns a list of institutions. + /// The 404 Not Found status code is returned when no institutions are found. + [HttpGet] + [ProducesResponseType(typeof(IEnumerable), (int) HttpStatusCode.OK)] + [Authorize(Policy = nameof(Defaults.Scopes.InstitutionRead))] + public async Task GetAllInstitutions() + { + IEnumerable institutions = await institutionService.GetInstitutionsAsync(); + + if(!institutions.Any()) + { + ProblemDetails problem = new ProblemDetails + { + Title = "No Institutions found", + Detail = "There where no institutions scopes found.", + Instance = "7736D583-3263-4946-BF48-35299812AA56" + }; + return NotFound(problem); + } + + IEnumerable model = + mapper.Map, IEnumerable>(institutions); + return Ok(model); + } + + /// + /// This method is responsible for retrieving a single institution by id. + /// + /// The unique identifier which is used for searching the institution. + /// This method returns the institution resource result. + /// This endpoint returns an institution with the specified id. + /// The 400 Bad Request status code is returned when the id is invalid. + /// The 404 Not Found status code is returned when no institution could be + /// found with the specified id. + [HttpGet("{id}")] + [ProducesResponseType(typeof(InstitutionResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] + [Authorize(Policy = nameof(Defaults.Scopes.InstitutionRead))] + public async Task GetInstitution(int id) + { + if(id <= 0) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Invalid id specified.", + Detail = "The specified id is invalid.", + Instance = "17DE6E26-6759-423D-A33B-8CEC38F158A3" + }; + return BadRequest(problem); + } + + Institution institution = await institutionService.FindAsync(id); + if(institution == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the institution.", + Detail = "The database does not contain an institution with the specified id.", + Instance = "89378B11-601A-4512-BFF9-F02FC510DF03" + }; + return NotFound(problem); + } + + InstitutionResourceResult model = mapper.Map(institution); + return Ok(model); + } + + /// + /// This method is responsible for creating an institution. + /// + /// The institution resource which is used to create the institution. + /// This method returns the created institution resource result. + /// This endpoint returns the created institution. + /// The 400 Bad Request status code is returned when the specified + /// resource is invalid or the institution could not be saved to the database. + [HttpPost] + [Authorize(Policy = nameof(Defaults.Scopes.InstitutionWrite))] + [ProducesResponseType(typeof(InstitutionResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + public IActionResult CreateInstitution(InstitutionResource institutionResource) + { + if(institutionResource == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed creating the institution.", + Detail = "The institution resource is null.", + Instance = "E80F9611-EE07-4FF0-8D53-7693CE1AE26E" + }; + return BadRequest(problem); + } + + Institution institution = mapper.Map(institutionResource); + + try + { + institutionService.Add(institution); + institutionService.Save(); + InstitutionResourceResult model = mapper.Map(institution); + return Created(nameof(CreateInstitution), model); + } + catch(DbUpdateException e) + { + Log.Logger.Error(e, "Database exception"); + + ProblemDetails problem = new ProblemDetails + { + Title = "Failed Saving the institution.", + Detail = "Failed saving the institution to the database.", + Instance = "20C197B7-24E1-4112-8999-6BB3DFD03FB6" + }; + return BadRequest(problem); + } + } + + /// + /// This method is responsible for updating the institution. + /// + /// The institution identifier which is used to find the institution. + /// The institution resource which is used to update the institution. + /// This method return the updated institution resource result + /// This endpoint returns the updated institution. + /// The 404 Not Found status code is returned when no institution is found with the specified institution id. + [HttpPut("{institutionId}")] + [Authorize(Policy = nameof(Defaults.Scopes.InstitutionWrite))] + [ProducesResponseType(typeof(InstitutionResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] + public async Task UpdateInstitution(int institutionId, + [FromBody] InstitutionResource institutionResource) + { + Institution institution = await institutionService.FindAsync(institutionId); + if(institution == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the institution.", + Detail = "The database does not contain an institution with that id.", + Instance = "FA51F980-D114-44B3-85BD-9419B58D68F2" + }; + return NotFound(problem); + } + + mapper.Map(institutionResource, institution); + + institutionService.Update(institution); + institutionService.Save(); + + return Ok(mapper.Map(institution)); + } + + /// + /// This method is responsible for deleting the institution by the identifier. + /// + /// The institution identifier which is used to find the institution. + /// This method returns status code 200. + /// This endpoint returns status code 200. The institution is deleted. + /// The 404 Not Found status code is returned when no institution is found with the specified id. + [HttpDelete("{institutionId}")] + [Authorize(Policy = nameof(Defaults.Scopes.InstitutionWrite))] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] + public async Task DeleteInsitution(int institutionId) + { + Institution institution = await institutionService.FindAsync(institutionId); + if(institution == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting the institution.", + Detail = "The database does not contain an institution with that id.", + Instance = "9981200A-B22C-42B3-8035-5D3A6B9696C8" + }; + return NotFound(problem); + } + + await institutionService.RemoveAsync(institutionId); + institutionService.Save(); + return Ok(); + + } + + } + +} From c428a0f4bd9e271b362c7f5670768b2d2819218e Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 15:32:17 +0100 Subject: [PATCH 100/157] Added licence text for each service test --- Services.Tests/EmbedServiceTest.cs | 23 +++++++++++++++++----- Services.Tests/GitHubSourceTest.cs | 19 ++++++++++++++++-- Services.Tests/GitLabSourceTest.cs | 17 ++++++++++++++++ Services.Tests/HighlightServiceTest.cs | 19 ++++++++++++++++-- Services.Tests/ProjectServiceTest.cs | 17 ++++++++++++++++ Services.Tests/RoleServiceTest.cs | 19 ++++++++++++++++-- Services.Tests/SearchServiceTest.cs | 18 ++++++++++++++++- Services.Tests/SourceManagerServiceTest.cs | 21 ++++++++++++++++---- Services.Tests/UserServiceTest.cs | 19 ++++++++++++++++-- 9 files changed, 154 insertions(+), 18 deletions(-) diff --git a/Services.Tests/EmbedServiceTest.cs b/Services.Tests/EmbedServiceTest.cs index e6a4f487..438bb8bb 100644 --- a/Services.Tests/EmbedServiceTest.cs +++ b/Services.Tests/EmbedServiceTest.cs @@ -1,14 +1,27 @@ -using Microsoft.EntityFrameworkCore; +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Moq; using NUnit.Framework; using Repositories; -using Repositories.Base; using Repositories.Tests.DataSources; using Services.Services; using Services.Tests.Base; -using System; -using System.Collections; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -48,7 +61,7 @@ public async Task IsNonExistingGuidAsync_guid_exists([EmbeddedDataSource]Embedde Assert.DoesNotThrow(() => { RepositoryMock.Verify(repository => repository.IsNonExistingGuidAsync(project.Guid), Times.Once); }); - + Assert.IsFalse(projectWithGuidDoesNotExist); } diff --git a/Services.Tests/GitHubSourceTest.cs b/Services.Tests/GitHubSourceTest.cs index ddb013de..c0a4e20c 100644 --- a/Services.Tests/GitHubSourceTest.cs +++ b/Services.Tests/GitHubSourceTest.cs @@ -1,9 +1,24 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using NUnit.Framework; using Services.Sources; using Services.Tests.Base; using System; -using System.Collections.Generic; -using System.Text; namespace Services.Tests { diff --git a/Services.Tests/GitLabSourceTest.cs b/Services.Tests/GitLabSourceTest.cs index 1b4652da..6358fdec 100644 --- a/Services.Tests/GitLabSourceTest.cs +++ b/Services.Tests/GitLabSourceTest.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Moq; using Newtonsoft.Json; diff --git a/Services.Tests/HighlightServiceTest.cs b/Services.Tests/HighlightServiceTest.cs index 873de193..4cef63e8 100644 --- a/Services.Tests/HighlightServiceTest.cs +++ b/Services.Tests/HighlightServiceTest.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Moq; using NUnit.Framework; @@ -5,9 +22,7 @@ using Repositories.Tests.DataSources; using Services.Services; using Services.Tests.Base; -using System; using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace Services.Tests diff --git a/Services.Tests/ProjectServiceTest.cs b/Services.Tests/ProjectServiceTest.cs index 8f25d11b..46909acc 100644 --- a/Services.Tests/ProjectServiceTest.cs +++ b/Services.Tests/ProjectServiceTest.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Moq; using NUnit.Framework; diff --git a/Services.Tests/RoleServiceTest.cs b/Services.Tests/RoleServiceTest.cs index 387e229c..4f8645cd 100644 --- a/Services.Tests/RoleServiceTest.cs +++ b/Services.Tests/RoleServiceTest.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Moq; using NUnit.Framework; @@ -5,9 +22,7 @@ using Repositories.Tests.DataSources; using Services.Services; using Services.Tests.Base; -using System; using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace Services.Tests diff --git a/Services.Tests/SearchServiceTest.cs b/Services.Tests/SearchServiceTest.cs index 309bbd93..b10523ff 100644 --- a/Services.Tests/SearchServiceTest.cs +++ b/Services.Tests/SearchServiceTest.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Moq; using NUnit.Framework; @@ -8,7 +25,6 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; -using System.Reflection; using System.Threading.Tasks; namespace Services.Tests diff --git a/Services.Tests/SourceManagerServiceTest.cs b/Services.Tests/SourceManagerServiceTest.cs index 8498bc6f..749ab4d8 100644 --- a/Services.Tests/SourceManagerServiceTest.cs +++ b/Services.Tests/SourceManagerServiceTest.cs @@ -1,13 +1,26 @@ using Models; using Moq; -using Newtonsoft.Json; +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using NUnit.Framework; using Services.Services; using Services.Sources; using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; namespace Services.Tests { diff --git a/Services.Tests/UserServiceTest.cs b/Services.Tests/UserServiceTest.cs index 60d71b35..a14fcbd1 100644 --- a/Services.Tests/UserServiceTest.cs +++ b/Services.Tests/UserServiceTest.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using Moq; using NUnit.Framework; @@ -5,9 +22,7 @@ using Repositories.Tests.DataSources; using Services.Services; using Services.Tests.Base; -using System; using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace Services.Tests From 44aaeb0818d96c047ef919f33f6caa9173f8df16 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 15:33:20 +0100 Subject: [PATCH 101/157] Added licnece text to base service test class --- Services.Tests/Base/ServiceTest.cs | 17 +++++++++++++++++ Services.Tests/Base/SourceTest.cs | 22 +++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Services.Tests/Base/ServiceTest.cs b/Services.Tests/Base/ServiceTest.cs index 45f2e965..885204ee 100644 --- a/Services.Tests/Base/ServiceTest.cs +++ b/Services.Tests/Base/ServiceTest.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Moq; using NUnit.Framework; using Repositories.Base; diff --git a/Services.Tests/Base/SourceTest.cs b/Services.Tests/Base/SourceTest.cs index fa6440c9..4ea99043 100644 --- a/Services.Tests/Base/SourceTest.cs +++ b/Services.Tests/Base/SourceTest.cs @@ -1,15 +1,27 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Moq; -using Newtonsoft.Json; using NUnit.Framework; -using Repositories.Base; using RestSharp; -using Services.Base; using Services.Sources; using System; -using System.Collections.Generic; using System.Net; using System.Reflection; -using System.Threading.Tasks; namespace Services.Tests.Base { From 06912066483492973e5d929e51d9e51bbdec11ab Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 15:33:35 +0100 Subject: [PATCH 102/157] Added licence text to repository test classes --- Repositories/IdentityUserRepository.cs | 18 +++++++++++++++++- Repositories/InstitutionRepository.cs | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Repositories/IdentityUserRepository.cs b/Repositories/IdentityUserRepository.cs index 95398fe4..7a3d66a4 100644 --- a/Repositories/IdentityUserRepository.cs +++ b/Repositories/IdentityUserRepository.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Microsoft.EntityFrameworkCore; using Models; using Repositories.Base; @@ -5,7 +22,6 @@ using System.Collections.Generic; using System.Linq; using System.Security.Claims; -using System.Text; using System.Threading.Tasks; namespace Repositories diff --git a/Repositories/InstitutionRepository.cs b/Repositories/InstitutionRepository.cs index 70eec1b6..394f62ce 100644 --- a/Repositories/InstitutionRepository.cs +++ b/Repositories/InstitutionRepository.cs @@ -1,9 +1,24 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Microsoft.EntityFrameworkCore; using Models; using Repositories.Base; -using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace Repositories From baea20690362935fcbb94470e7055e3f7735d0f1 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 15:49:58 +0100 Subject: [PATCH 103/157] Created Institution data generator --- .../InstitutionDataGenerator.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Repositories.Tests/DataGenerators/InstitutionDataGenerator.cs diff --git a/Repositories.Tests/DataGenerators/InstitutionDataGenerator.cs b/Repositories.Tests/DataGenerators/InstitutionDataGenerator.cs new file mode 100644 index 00000000..b7164fe3 --- /dev/null +++ b/Repositories.Tests/DataGenerators/InstitutionDataGenerator.cs @@ -0,0 +1,37 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Bogus; +using Models; +using Repositories.Tests.DataGenerators.Base; + +namespace Repositories.Tests.DataGenerators +{ + + public class InstitutionDataGenerator : FakeDataGenerator + { + + public InstitutionDataGenerator() + { + Faker = new Faker() + .RuleFor(institution => institution.Name, faker => faker.Company.CompanyName()) + .RuleFor(institution => institution.Description, faker => faker.Company.CatchPhrase()); + } + + } + +} From 44d4e85735d055f48750dc5de4e3355851c3ef9f Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 15:51:34 +0100 Subject: [PATCH 104/157] Added licence text to every data generator class --- .../CollaboratorDataGenerator.cs | 17 +++++++++++++++ .../EmbeddedProjectDataGenerator.cs | 17 +++++++++++++++ .../DataGenerators/HighlightDataGenerator.cs | 20 +++++++++++++++--- .../DataGenerators/ProjectDataGenerator.cs | 17 +++++++++++++++ .../DataGenerators/RoleDataGenerator.cs | 21 +++++++++++++++---- .../DataGenerators/UserDataGenerator.cs | 17 +++++++++++++++ 6 files changed, 102 insertions(+), 7 deletions(-) diff --git a/Repositories.Tests/DataGenerators/CollaboratorDataGenerator.cs b/Repositories.Tests/DataGenerators/CollaboratorDataGenerator.cs index 0fffefe7..5cc4f2f8 100644 --- a/Repositories.Tests/DataGenerators/CollaboratorDataGenerator.cs +++ b/Repositories.Tests/DataGenerators/CollaboratorDataGenerator.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Bogus; using Models; using Repositories.Tests.DataGenerators.Base; diff --git a/Repositories.Tests/DataGenerators/EmbeddedProjectDataGenerator.cs b/Repositories.Tests/DataGenerators/EmbeddedProjectDataGenerator.cs index 19587a32..688625af 100644 --- a/Repositories.Tests/DataGenerators/EmbeddedProjectDataGenerator.cs +++ b/Repositories.Tests/DataGenerators/EmbeddedProjectDataGenerator.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Bogus; using Models; using Repositories.Tests.DataGenerators.Base; diff --git a/Repositories.Tests/DataGenerators/HighlightDataGenerator.cs b/Repositories.Tests/DataGenerators/HighlightDataGenerator.cs index 464b35f8..7c7599ec 100644 --- a/Repositories.Tests/DataGenerators/HighlightDataGenerator.cs +++ b/Repositories.Tests/DataGenerators/HighlightDataGenerator.cs @@ -1,10 +1,24 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Bogus; using Models; -using Repositories.Tests.DataGenerators; using Repositories.Tests.DataGenerators.Base; using System; -using System.Collections.Generic; -using System.Text; namespace Repositories.Tests.DataGenerators { diff --git a/Repositories.Tests/DataGenerators/ProjectDataGenerator.cs b/Repositories.Tests/DataGenerators/ProjectDataGenerator.cs index a59a566c..e5bd8731 100644 --- a/Repositories.Tests/DataGenerators/ProjectDataGenerator.cs +++ b/Repositories.Tests/DataGenerators/ProjectDataGenerator.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Bogus; using Models; using Repositories.Tests.DataGenerators.Base; diff --git a/Repositories.Tests/DataGenerators/RoleDataGenerator.cs b/Repositories.Tests/DataGenerators/RoleDataGenerator.cs index 43ebc356..2549a726 100644 --- a/Repositories.Tests/DataGenerators/RoleDataGenerator.cs +++ b/Repositories.Tests/DataGenerators/RoleDataGenerator.cs @@ -1,11 +1,24 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Bogus; -using Bogus.DataSets; using Models; -using Repositories.Tests.DataGenerators; using Repositories.Tests.DataGenerators.Base; -using System; using System.Collections.Generic; -using System.Text; namespace Repositories.Tests.DataGenerators { diff --git a/Repositories.Tests/DataGenerators/UserDataGenerator.cs b/Repositories.Tests/DataGenerators/UserDataGenerator.cs index aaacacfd..6e7d9b5e 100644 --- a/Repositories.Tests/DataGenerators/UserDataGenerator.cs +++ b/Repositories.Tests/DataGenerators/UserDataGenerator.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Bogus; using Models; using Repositories.Tests.DataGenerators.Base; From 2b605a41fffa4ade790cfb80a8f0782841472615 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 15:55:32 +0100 Subject: [PATCH 105/157] Created institution data source attribute --- .../InstitutionDataSourceAttribute.cs | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Repositories.Tests/DataSources/InstitutionDataSourceAttribute.cs diff --git a/Repositories.Tests/DataSources/InstitutionDataSourceAttribute.cs b/Repositories.Tests/DataSources/InstitutionDataSourceAttribute.cs new file mode 100644 index 00000000..02712287 --- /dev/null +++ b/Repositories.Tests/DataSources/InstitutionDataSourceAttribute.cs @@ -0,0 +1,70 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Models; +using NUnit.Framework.Interfaces; +using Repositories.Tests.DataGenerators; +using Repositories.Tests.DataGenerators.Base; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Repositories.Tests.DataSources +{ + /// + /// This class is an attribute used for generating institutions. + /// + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] + public class InstitutionDataSourceAttribute : Attribute, IParameterDataSource + { + + private readonly IFakeDataGenerator fakeDataGenerator; + private readonly int amountToGenerate = 0; + + /// + /// Initializes InstitutionDataSourceAttribute + /// + public InstitutionDataSourceAttribute() + { + fakeDataGenerator = new InstitutionDataGenerator(); + } + + public InstitutionDataSourceAttribute(int amount) + : this() + { + amountToGenerate = amount; + } + + /// + /// This method generates the data and returns it; + /// + /// Extra parameters given in the attribute, not in use but required due to inheritance. + /// This method returns the generated data. + public IEnumerable GetData(IParameterInfo parameter) + { + if(amountToGenerate <= 1) + { + return new[] { fakeDataGenerator.Generate() }; + } + List projects = fakeDataGenerator.GenerateRange(amountToGenerate).ToList(); + return new[] { projects }; + } + + } + +} From 69fd59969d6d2cf2c1040ffee14269106072472e Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 15:56:55 +0100 Subject: [PATCH 106/157] Added licence text to each data source attribute class --- .../CollaboratorDataSourceAttribute.cs | 17 +++++++++++++++++ .../EmbeddedProjectDataSourceAttribute.cs | 17 +++++++++++++++++ .../HighlightDataSourceAttribute.cs | 18 +++++++++++++++++- .../DataSources/ProjectDataSourceAttribute.cs | 17 +++++++++++++++++ .../DataSources/RoleDataSourceAttribute.cs | 18 +++++++++++++++++- .../DataSources/UserDataSourceAttribute.cs | 17 +++++++++++++++++ 6 files changed, 102 insertions(+), 2 deletions(-) diff --git a/Repositories.Tests/DataSources/CollaboratorDataSourceAttribute.cs b/Repositories.Tests/DataSources/CollaboratorDataSourceAttribute.cs index e2363074..3f35441b 100644 --- a/Repositories.Tests/DataSources/CollaboratorDataSourceAttribute.cs +++ b/Repositories.Tests/DataSources/CollaboratorDataSourceAttribute.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using NUnit.Framework.Interfaces; using Repositories.Tests.DataGenerators; diff --git a/Repositories.Tests/DataSources/EmbeddedProjectDataSourceAttribute.cs b/Repositories.Tests/DataSources/EmbeddedProjectDataSourceAttribute.cs index 2cc95201..572a538d 100644 --- a/Repositories.Tests/DataSources/EmbeddedProjectDataSourceAttribute.cs +++ b/Repositories.Tests/DataSources/EmbeddedProjectDataSourceAttribute.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using NUnit.Framework.Interfaces; using Repositories.Tests.DataGenerators; diff --git a/Repositories.Tests/DataSources/HighlightDataSourceAttribute.cs b/Repositories.Tests/DataSources/HighlightDataSourceAttribute.cs index 24c14c78..bcbba3f0 100644 --- a/Repositories.Tests/DataSources/HighlightDataSourceAttribute.cs +++ b/Repositories.Tests/DataSources/HighlightDataSourceAttribute.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using NUnit.Framework.Interfaces; using Repositories.Tests.DataGenerators; @@ -6,7 +23,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Text; namespace Repositories.Tests.DataSources { diff --git a/Repositories.Tests/DataSources/ProjectDataSourceAttribute.cs b/Repositories.Tests/DataSources/ProjectDataSourceAttribute.cs index 9928ba8d..83e9a045 100644 --- a/Repositories.Tests/DataSources/ProjectDataSourceAttribute.cs +++ b/Repositories.Tests/DataSources/ProjectDataSourceAttribute.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using NUnit.Framework.Interfaces; using Repositories.Tests.DataGenerators; diff --git a/Repositories.Tests/DataSources/RoleDataSourceAttribute.cs b/Repositories.Tests/DataSources/RoleDataSourceAttribute.cs index bc8a6031..8e855f31 100644 --- a/Repositories.Tests/DataSources/RoleDataSourceAttribute.cs +++ b/Repositories.Tests/DataSources/RoleDataSourceAttribute.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using NUnit.Framework.Interfaces; using Repositories.Tests.DataGenerators; @@ -6,7 +23,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Text; namespace Repositories.Tests.DataSources { diff --git a/Repositories.Tests/DataSources/UserDataSourceAttribute.cs b/Repositories.Tests/DataSources/UserDataSourceAttribute.cs index df60e089..2d736e8f 100644 --- a/Repositories.Tests/DataSources/UserDataSourceAttribute.cs +++ b/Repositories.Tests/DataSources/UserDataSourceAttribute.cs @@ -1,3 +1,20 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + using Models; using NUnit.Framework.Interfaces; using Repositories.Tests.DataGenerators; From 84f1779ae545cc6998bc2578f7254a1080a70346 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 18:44:30 +0100 Subject: [PATCH 107/157] Created Institution Service test class --- Services.Tests/InstitutionServiceTest.cs | 95 ++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Services.Tests/InstitutionServiceTest.cs diff --git a/Services.Tests/InstitutionServiceTest.cs b/Services.Tests/InstitutionServiceTest.cs new file mode 100644 index 00000000..d012047e --- /dev/null +++ b/Services.Tests/InstitutionServiceTest.cs @@ -0,0 +1,95 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using FluentAssertions; +using Models; +using Moq; +using NUnit.Framework; +using Repositories; +using Repositories.Tests.DataSources; +using Services.Services; +using Services.Tests.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Services.Tests +{ + /// + /// InstitutionServiceTest + /// + /// + [TestFixture] + public class InstitutionServiceTest : ServiceTest + { + + /// + /// Gets the service. + /// + /// + /// The service. + /// + protected new IInstitutionService Service => (IInstitutionService) base.Service; + + /// + /// Tests the GetInstitutionsAsync method in a good flow. + /// + /// The institutions stored generated to mock the institutions from the repository. + /// This method will return a passing result for the test. + [Test] + public async Task GetInstitutionsAsync_GoodFlow([InstitutionDataSource(30)]IEnumerable institutions) + { + // Arrange + RepositoryMock + .Setup(repository => repository.GetInstitutionsAsync()) + .ReturnsAsync(institutions); + + // Act + IEnumerable actualInstitutions = await Service.GetInstitutionsAsync(); + Action act = () => RepositoryMock.Verify(repository => repository.GetInstitutionsAsync(), Times.Once); + + // Assert + act.Should().NotThrow(); + actualInstitutions.Should().Contain(institutions); + actualInstitutions.Count().Should().Be(30); + } + + /// + /// Tests the GetInstitutionsAsync method whenever there are no institutions stored. + /// + /// This method will return a passing result for the test. + [Test] + public async Task GetInstitutionAsync_NoInstitutions() + { + // Arrange + RepositoryMock + .Setup(repository => repository.GetInstitutionsAsync()) + .ReturnsAsync(Enumerable.Empty()); + + // Act + IEnumerable actualInstitutions = await Service.GetInstitutionsAsync(); + Action act = () => RepositoryMock.Verify(repository => repository.GetInstitutionsAsync(), Times.Once); + + // Assert + actualInstitutions.Should().BeEmpty(); + act.Should().NotThrow(); + } + + } + +} From daa9854a604615b0328409cd6eaf244fe5c1b66a Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 19:13:57 +0100 Subject: [PATCH 108/157] Created unit tests for the institution repository --- .../InstitutionRepositoryTest.cs | 67 +++++++++++++++++++ Services.Tests/InstitutionServiceTest.cs | 4 +- 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 Repositories.Tests/InstitutionRepositoryTest.cs diff --git a/Repositories.Tests/InstitutionRepositoryTest.cs b/Repositories.Tests/InstitutionRepositoryTest.cs new file mode 100644 index 00000000..3a639ff1 --- /dev/null +++ b/Repositories.Tests/InstitutionRepositoryTest.cs @@ -0,0 +1,67 @@ +using FluentAssertions; +using Models; +using NUnit.Framework; +using Repositories.Tests.Base; +using Repositories.Tests.DataSources; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Repositories.Tests +{ + /// + /// InstitutionRepositoryTest + /// + /// + [TestFixture] + public class InstitutionRepositoryTest : RepositoryTest + { + + /// + /// Gets the repository + /// + /// + /// The repository + /// + protected new IInstitutionRepository Repository => (IInstitutionRepository) base.Repository; + + /// + /// This method tests the GetInstitutionsAsync method in a good flow scenario. + /// + /// The institutions stored, generated to mock the institutions from the database. + /// This method will return a passing result for the test. + [Test] + public async Task GetInstitutionsAsync_Goodflow([InstitutionDataSource(100)]IEnumerable institutions) + { + // Arrange + DbContext.AddRange(institutions); + await DbContext.SaveChangesAsync(); + + // Act + IEnumerable retrievedInstitutions = await Repository.GetInstitutionsAsync(); + + // Assert + retrievedInstitutions.Count().Should().Be(100); + retrievedInstitutions.Should().BeEquivalentTo(institutions); + } + + /// + /// This method tests the GetInstitutionsAsync method whenever there are no institutions stored. + /// + /// This method will return a passing result for the test. + [Test] + public async Task GetInstitutionsAsync_NoInstitutions() + { + // Arrange + + // Act + IEnumerable retrievedInstitutions = await Repository.GetInstitutionsAsync(); + + // Assert + retrievedInstitutions.Should().NotBeNull(); + retrievedInstitutions.Should().BeEmpty(); + } + + } + +} diff --git a/Services.Tests/InstitutionServiceTest.cs b/Services.Tests/InstitutionServiceTest.cs index d012047e..a6a81efa 100644 --- a/Services.Tests/InstitutionServiceTest.cs +++ b/Services.Tests/InstitutionServiceTest.cs @@ -47,7 +47,7 @@ public class InstitutionServiceTest : ServiceTest (IInstitutionService) base.Service; /// - /// Tests the GetInstitutionsAsync method in a good flow. + /// This method tests the GetInstitutionsAsync method in a good flow. /// /// The institutions stored generated to mock the institutions from the repository. /// This method will return a passing result for the test. @@ -70,7 +70,7 @@ public async Task GetInstitutionsAsync_GoodFlow([InstitutionDataSource(30)]IEnum } /// - /// Tests the GetInstitutionsAsync method whenever there are no institutions stored. + /// This method tests the GetInstitutionsAsync method whenever there are no institutions stored. /// /// This method will return a passing result for the test. [Test] From f5a6448b7437a217114eeab153ce470adcfb6ca4 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 19:21:33 +0100 Subject: [PATCH 109/157] Updated scope names for data officer --- Models/Defaults/Defaults.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index 45eb1eb1..a15562dc 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -95,16 +95,16 @@ public static class Scopes public const string EmbedRead = "embed:read"; [Description("This scope gives read access to user roles for other users within their institution to the User namespace.")] - public const string RequestUserRead = "user:request-read"; + public const string InstitutionUserRead = "user:institution-read"; [Description("This scope gives write access to user roles for other users within their institution to the User namespace.")] - public const string RequestUserWrite = "user:request-write"; + public const string InstitutionUserWrite = "user:institution-write"; [Description("This scope gives write access to user roles for other users within their institution to the Project namespace.")] - public const string RequestProjectWrite = "user:request-write"; + public const string InstitutionProjectWrite = "user:institution-write"; [Description("This scope gives write access to user roles for other users within their institution to the Embed namespace.")] - public const string RequestEmbedWrite = "embed:request-write"; + public const string InstitutionEmbedWrite = "embed:institution-write"; [Description("This scope gives read access to the Insitution namespace.")] public const string InstitutionRead = "institution:read"; From d4b47cbbc971dceb30b9ccc0791a8802e17de764 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 29 Oct 2020 19:22:50 +0100 Subject: [PATCH 110/157] Updated aministrator role scopes (added institution scopes) --- Data/Helpers/Seed.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 9ac67d93..30b559ff 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -81,10 +81,10 @@ public static List SeedRoles() Name = nameof(Defaults.Roles.DataOfficer), Scopes = new List { - new RoleScope(nameof(Defaults.Scopes.RequestUserRead)), - new RoleScope(nameof(Defaults.Scopes.RequestUserWrite)), - new RoleScope(nameof(Defaults.Scopes.RequestEmbedWrite)), - new RoleScope(nameof(Defaults.Scopes.RequestProjectWrite)), + new RoleScope(nameof(Defaults.Scopes.InstitutionUserRead)), + new RoleScope(nameof(Defaults.Scopes.InstitutionUserWrite)), + new RoleScope(nameof(Defaults.Scopes.InstitutionEmbedWrite)), + new RoleScope(nameof(Defaults.Scopes.InstitutionProjectWrite)), } }; roles.Add(dataOfficerRole); @@ -92,7 +92,7 @@ public static List SeedRoles() Role administratorRole = new Role() { Name = nameof(Defaults.Roles.Administrator), - Scopes = new List() + Scopes = new List { new RoleScope(nameof(Defaults.Scopes.ProjectWrite)), new RoleScope(nameof(Defaults.Scopes.UserWrite)), @@ -103,6 +103,8 @@ public static List SeedRoles() new RoleScope(nameof(Defaults.Scopes.HighlightWrite)), new RoleScope(nameof(Defaults.Scopes.EmbedRead)), new RoleScope(nameof(Defaults.Scopes.EmbedWrite)), + new RoleScope(nameof(Defaults.Scopes.InstitutionRead)), + new RoleScope(nameof(Defaults.Scopes.InstitutionWrite)) } }; roles.Add(administratorRole); From 19214847751079cf032cdc3d3af9115a867168ad Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 30 Oct 2020 08:57:12 +0100 Subject: [PATCH 111/157] Implemented new scope names in the controllers --- API/Controllers/EmbedController.cs | 4 ++-- API/Controllers/ProjectController.cs | 2 +- API/Controllers/UserController.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/API/Controllers/EmbedController.cs b/API/Controllers/EmbedController.cs index 5a42e343..1770841e 100644 --- a/API/Controllers/EmbedController.cs +++ b/API/Controllers/EmbedController.cs @@ -188,7 +188,7 @@ public async Task CreateEmbeddedProject(EmbeddedProjectResource e User user = await userService.GetUserByIdentityIdAsync(identity); bool isAllowed = await authorizationHelper.UserIsAllowed(user, nameof(Defaults.Scopes.EmbedWrite), - nameof(Defaults.Scopes.RequestEmbedWrite), + nameof(Defaults.Scopes.InstitutionEmbedWrite), project.UserId); if(!(project.UserId == user.Id || isAllowed)) @@ -265,7 +265,7 @@ public async Task DeleteEmbeddedProject(string guid) User user = await userService.GetUserByIdentityIdAsync(identity); bool isAllowed = await authorizationHelper.UserIsAllowed(user, nameof(Defaults.Scopes.EmbedWrite), - nameof(Defaults.Scopes.RequestEmbedWrite), + nameof(Defaults.Scopes.InstitutionEmbedWrite), embeddedProject.UserId); if(!(embeddedProject.User.IdentityId == identity || isAllowed)) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index f853cefe..b94a9cde 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -285,7 +285,7 @@ public async Task DeleteProject(int projectId) User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); bool isAllowed = await authorizationHelper.UserIsAllowed(user, nameof(Defaults.Scopes.ProjectWrite), - nameof(Defaults.Scopes.RequestProjectWrite), + nameof(Defaults.Scopes.InstitutionProjectWrite), project.UserId); if(!(project.UserId == user.Id || isAllowed)) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index d0930417..1a809b97 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -108,7 +108,7 @@ public async Task GetUser(int userId) User currentUser = await HttpContext.GetContextUser(userService).ConfigureAwait(false); bool isAllowed = await authorizationHelper.UserIsAllowed(currentUser, nameof(Defaults.Scopes.UserRead), - nameof(Defaults.Scopes.RequestUserRead), + nameof(Defaults.Scopes.InstitutionUserRead), userId); if(!isAllowed) @@ -273,7 +273,7 @@ public async Task DeleteAccount(int userId) User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); bool isAllowed = await authorizationHelper.UserIsAllowed(user, nameof(Defaults.Scopes.UserWrite), - nameof(Defaults.Scopes.RequestUserWrite), + nameof(Defaults.Scopes.InstitutionUserWrite), userId); if(user.Id != userId && !isAllowed) From 214668de8c49e1e4f081dd49c6452eb41ae9b421 Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 30 Oct 2020 08:57:32 +0100 Subject: [PATCH 112/157] Added institution service and repository in di-setup --- API/Extensions/DependencyInjectionExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index c11b181c..8a55067c 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -15,6 +15,7 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.Common; using Data; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; @@ -64,6 +65,11 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + + services.AddTransient(); + return services; } } From 1c055d5318f7f84269043ab7248b23403eb808e0 Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 30 Oct 2020 08:57:53 +0100 Subject: [PATCH 113/157] Added policies in the startup config --- API/Startup.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/API/Startup.cs b/API/Startup.cs index ed3c9c35..e7e457fa 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -15,7 +15,6 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ -using API.Common; using API.Configuration; using API.Extensions; using API.Filters; @@ -135,6 +134,20 @@ public void ConfigureServices(IServiceCollection services) o.AddPolicy(nameof(Defaults.Scopes.EmbedWrite), policy => policy.Requirements.Add( new ScopeRequirement(nameof(Defaults.Scopes.EmbedWrite)))); + + o.AddPolicy(nameof(Defaults.Scopes.InstitutionEmbedWrite), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionEmbedWrite)))); + o.AddPolicy(nameof(Defaults.Scopes.InstitutionProjectWrite), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionProjectWrite)))); + o.AddPolicy(nameof(Defaults.Scopes.InstitutionUserRead), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionUserRead)))); + o.AddPolicy(nameof(Defaults.Scopes.InstitutionUserWrite), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionUserWrite)))); + + o.AddPolicy(nameof(Defaults.Scopes.InstitutionWrite), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionWrite)))); + o.AddPolicy(nameof(Defaults.Scopes.InstitutionRead), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionRead)))); }); services.AddCors(); @@ -198,7 +211,6 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(Config); services.AddServicesAndRepositories(); services.AddProblemDetails(); - services.AddTransient(); } /// From 9d2cecc5909ca03d7219b06f5ea41d8fb90b120e Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 30 Oct 2020 08:58:17 +0100 Subject: [PATCH 114/157] Fixed DI bug for retrieving IInstitutionRepository in the service --- Services/Services/InstitutionService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Services/Services/InstitutionService.cs b/Services/Services/InstitutionService.cs index 401e7739..d553d06a 100644 --- a/Services/Services/InstitutionService.cs +++ b/Services/Services/InstitutionService.cs @@ -39,7 +39,7 @@ public interface IInstitutionService : IService public class InstitutionService : Service, IInstitutionService { - public InstitutionService(IRepository repository) : base(repository) { } + public InstitutionService(IInstitutionRepository repository) : base(repository) { } protected new IInstitutionRepository Repository => (IInstitutionRepository) base.Repository; From 9dd1370f57eb95a4ee285f3516a882d3948a7678 Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 30 Oct 2020 09:06:24 +0100 Subject: [PATCH 115/157] Added mapping profile for institution models --- API/Configuration/MappingProfile.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index 867ba54f..cf722397 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -59,6 +59,9 @@ public MappingProfile() CreateMap(); CreateMap(); + + CreateMap(); + CreateMap(); } } } From 806ef9c23c97dc1456f888bc4951daf8ceefd81c Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 30 Oct 2020 14:15:29 +0100 Subject: [PATCH 116/157] finished postman testing --- Postman/dex.postman_collection.json | 3130 ++++++++++++------------ Postman/local.postman_environment.json | 54 +- 2 files changed, 1585 insertions(+), 1599 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 079da398..e46eb9ee 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "ff29eab8-de3b-4e93-88ef-f6ab66404d8b", + "_postman_id": "ff5c49cd-ec16-4a94-86d3-ca649a0d190c", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "b827a93b-2a6d-47e5-9c88-408c119101f8", + "id": "3959ca25-5454-4789-a68e-eb9f48fc2dbe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "17613765-0415-4e11-8ebc-373f96e7b631", + "id": "342b4180-2f6c-4c49-89f8-9eba436e912a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -128,146 +128,13 @@ { "name": "User", "item": [ - { - "name": "Follow", - "item": [ - { - "name": "User-FollowUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "id": "dab19e4b-17d8-4c2e-8029-762be0ef2f7e", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userId = 25", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userId, function () {", - " pm.expect(jsonData.id).to.eql(userId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "id": "e214fd50-1593-430d-854f-6ff42d4b2c25", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, { "name": "User-CreateUser-Administrator", "event": [ { "listen": "test", "script": { - "id": "3472dd38-3639-4000-85bf-327d76ff8bff", + "id": "7cacb551-f975-4ceb-881d-4f9d49f1fc18", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -336,7 +203,7 @@ { "listen": "test", "script": { - "id": "52aa0280-14a9-4195-a7f6-d232e199dbc6", + "id": "d971f1ae-1aef-463c-b92a-b4a81a1f3a96", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -404,7 +271,7 @@ { "listen": "test", "script": { - "id": "f23ab553-b3c9-4412-95f4-10036357bcd1", + "id": "a1745bf9-14cd-44ed-89e0-c26db7e3d387", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -472,7 +339,7 @@ { "listen": "test", "script": { - "id": "fb897acc-7440-4cd3-9719-44fec1b5dc96", + "id": "805af601-042b-41f8-a210-33999a98ee38", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -547,7 +414,7 @@ { "listen": "test", "script": { - "id": "7a39f69f-9301-4e3a-8244-58ccaf92456b", + "id": "072eeb3b-87f6-4c42-844d-2be95810d1b6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -578,7 +445,7 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -604,148 +471,235 @@ "_postman_isSubFolder": true }, { - "name": "Project", + "name": "FollowUser", "item": [ { - "name": "Follow", - "item": [ + "name": "User-CreateUserToFollow-Administrator", + "event": [ { - "name": "Project-FollowProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "id": "9fd04b7b-60e7-44ae-be53-f202ce1cfd89", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = 3", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + projectName, function () {", - " pm.expect(jsonData.id).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } + "listen": "test", + "script": { + "id": "e778d98a-4719-467e-9283-93505626c66a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"userIdToFollow\", jsonData.id)", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"999\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-FollowUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "065d35c4-da01-4a1a-86cb-56972bfeda41", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "var userIdToFollow = pm.environment.get(\"userIdToFollow\");", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userIdToFollow, function () {", + " pm.expect(jsonData.id).to.eql(userIdToFollow);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Administrator", + "event": [ { - "name": "Project-UnFollowProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "id": "3f426063-1c8b-4d32-9777-bea283d13747", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } + "listen": "test", + "script": { + "id": "46bf26be-b56e-401b-90c7-3364eaa48bbe", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c7889f31-4c31-46b7-8b0a-c14b45c157da", + "type": "text/javascript", + "exec": [ + "" + ] + } }, + { + "listen": "test", + "script": { + "id": "5a9c8687-8786-4dcf-b185-96dc97a02c0a", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Project", + "item": [ { "name": "Project-CreateProject-Administrator", "event": [ { "listen": "test", "script": { - "id": "db4582ed-ccd9-4fad-9bc5-9eb796ab82b2", + "id": "74d7a485-a039-4f5a-962b-ca11ef0ece3b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -823,7 +777,7 @@ { "listen": "test", "script": { - "id": "b7dc3c89-e99d-481a-9349-5a99cb721acb", + "id": "5a3fced7-64d3-40b8-aa39-01d65e3027d2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -896,7 +850,7 @@ { "listen": "test", "script": { - "id": "580ea907-b7bb-404c-be99-db89133abc92", + "id": "f5eeb059-b513-48ee-be05-887b880e7d26", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -965,7 +919,7 @@ { "listen": "test", "script": { - "id": "4429b1cd-f857-4557-b003-6fce43fb2944", + "id": "7de7cccf-3170-45c4-9ab0-7da05e1a8d64", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -1033,7 +987,7 @@ { "listen": "test", "script": { - "id": "4e1093dc-1ba7-434b-b60f-71399f9fdb5f", + "id": "34b9c063-ef9c-456e-8a95-8093cd556523", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -1101,7 +1055,7 @@ { "listen": "test", "script": { - "id": "9ca4b874-8ae5-4ba8-b2d7-1e6f8670d9fa", + "id": "d8cee4d6-58df-4396-835f-43cc2561759e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1153,22 +1107,24 @@ "_postman_isSubFolder": true }, { - "name": "Highlight", + "name": "FollowProject", "item": [ { - "name": "Highlight-CreateHighlight-Administrator", + "name": "Project-CreateProjectToFollow-Administrator", "event": [ { "listen": "test", "script": { - "id": "35a3168e-d144-43f4-8f06-4e213df479d0", + "id": "118b72c4-3865-46ce-93ca-cd5054dd9ace", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"highlightId\", jsonData.id);", + "pm.environment.set(\"projectIdToFollow\", jsonData.id);", "", "pm.test(\"Status code is 201\", function () {", " pm.response.to.have.status(201);", @@ -1182,25 +1138,22 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", "});" ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "id": "05bcfb21-723e-4269-bec5-ea28fa381201", - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } } ], "request": { @@ -1214,7 +1167,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -1222,13 +1175,222 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-FollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "42ba633b-c28c-41b8-bcdd-31b845308db7", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "var projectId = pm.environment.get(\"projectIdToFollow\");", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "4558acd9-5c79-4149-bb5b-b91cd1634a47", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "66f1eb1a-f7a7-4ec2-be15-6d0321994838", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "365a0fcf-1749-42b1-b7ef-b8d1d8e0b253", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" ] } }, @@ -1240,7 +1402,7 @@ { "listen": "test", "script": { - "id": "313c98ec-33aa-4e88-97ad-591ae71a7f2e", + "id": "c791cf1f-5ca9-4a94-8bd9-0609df615dbb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1309,7 +1471,7 @@ { "listen": "test", "script": { - "id": "eed3be18-11d8-4f23-8ced-71ebad388e53", + "id": "62eb20fb-cdc9-4c4f-9a3a-4e5d882f90dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1371,7 +1533,7 @@ { "listen": "test", "script": { - "id": "5fefd285-9c8e-4fa0-acc9-5cba93154363", + "id": "609b188c-54bc-4928-8b58-f0ebbad36c86", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1458,7 +1620,7 @@ { "listen": "test", "script": { - "id": "33330cd9-7f81-4523-a8ae-8d450611fc95", + "id": "97d0a335-1e34-4227-b0ed-2ea058dc779f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1490,7 +1652,7 @@ { "listen": "prerequest", "script": { - "id": "b42fd126-77fe-4567-aa47-2189736defed", + "id": "3b461ee3-0b1a-4e4e-a157-f1da4cb02ed5", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1537,7 +1699,7 @@ { "listen": "test", "script": { - "id": "15a4479c-2351-4837-8951-b7d3bb9b8436", + "id": "e8752b93-f3a0-4add-a2b6-97996b1a1ddb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1596,7 +1758,7 @@ { "listen": "test", "script": { - "id": "b82ef281-95dc-4291-ad9b-fbb0e0d96197", + "id": "7140cc49-6ba3-43ef-a97a-42ee619995a5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1657,7 +1819,7 @@ { "listen": "test", "script": { - "id": "bcc14b8e-3fa0-402f-9549-4a068c822f24", + "id": "6c64ba60-3ad6-4a88-aa87-b85e79b74d6e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1721,7 +1883,7 @@ { "listen": "test", "script": { - "id": "f56c0169-0f3b-433e-b208-7140288f7bea", + "id": "1a2d9162-fb27-457c-8990-349a5e86ccf3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1790,7 +1952,7 @@ { "listen": "test", "script": { - "id": "537d6005-f6f6-4b6c-aad0-5d2ef6fa8fcf", + "id": "dcbb6572-5b6d-4aee-ba93-b3be3b3371d5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1848,7 +2010,7 @@ { "listen": "test", "script": { - "id": "dcd0fc71-f927-4d22-87f4-56cd768ddbb7", + "id": "e5555f9c-1047-4582-a35d-73b58eb820fd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1902,7 +2064,7 @@ { "listen": "test", "script": { - "id": "c834c84a-7e0e-4bd6-976e-f212271af58d", + "id": "b911a209-d97f-4a6f-8ea3-eb67c2469825", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1963,7 +2125,7 @@ { "listen": "test", "script": { - "id": "8dd40497-eab0-4e6d-b814-d24fe9a60768", + "id": "f57f81b9-4c7a-4fd6-b3ae-ceb11ea9cc77", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -2036,7 +2198,7 @@ { "listen": "test", "script": { - "id": "e629d9dc-4815-4b72-b8dc-d3ce6099c6e8", + "id": "4b3b497f-6330-4458-b2cd-284aa8cf217d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -2109,7 +2271,7 @@ { "listen": "test", "script": { - "id": "c70013ba-7ba6-4b9a-8f66-5404ba2db7a2", + "id": "69097da4-06b5-4e33-b1e5-558d2908b6fc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2175,7 +2337,7 @@ { "listen": "test", "script": { - "id": "2072f24b-8dfa-42ca-85f8-e1ba9b8130c8", + "id": "58d4ef31-3447-443b-a512-0fb1d9a3d895", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2234,7 +2396,7 @@ { "listen": "test", "script": { - "id": "18bfab81-d57b-420d-8ba9-d6f9d3e1d5ee", + "id": "ffed08e6-da64-43d9-9c03-1ed8dd68b33d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2301,7 +2463,7 @@ { "listen": "test", "script": { - "id": "38f386d2-8004-4f82-83bb-97396404817a", + "id": "36dab30c-47a9-486e-b076-2e84dce7ab24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2359,13 +2521,15 @@ { "listen": "test", "script": { - "id": "e8523c11-db8c-413b-9baa-cfc6726efddb", + "id": "5f31bdcd-f3c0-4c17-a267-cfb2d49a9b7e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", "", "var jsonData = pm.response.json();", "", + "console.info(pm.environment.get(\"createdUserId\") + \" \" + pm.environment.get(\"roleId\") + \" \" + pm.environment.get(\"projectNameUpdated\") )", + "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -2438,7 +2602,7 @@ { "listen": "test", "script": { - "id": "c8ff9189-d69d-4ee8-ac71-6c4dd90f1b7d", + "id": "063fbd43-8a4c-481b-add3-8ce39928077e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2496,7 +2660,7 @@ { "listen": "test", "script": { - "id": "6525c4c0-7e5a-4abf-ba98-e8838f7bc9b7", + "id": "eab16568-2d97-45d2-aed0-2c09be304b29", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2557,7 +2721,7 @@ { "listen": "test", "script": { - "id": "12c1b164-3095-4c82-b334-d95a5b34dd22", + "id": "1626d531-386b-40ca-9eef-cf53ffdfebb0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2623,7 +2787,7 @@ { "listen": "test", "script": { - "id": "b1389398-ceaa-4fe9-8492-111582f0ea11", + "id": "1599761e-8d44-49c4-b817-f94c5c9f8f3e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2689,7 +2853,7 @@ { "listen": "test", "script": { - "id": "af8a646b-d41e-4bea-902d-441605339831", + "id": "3113e8b3-7291-4bc6-965c-a902820f20eb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2734,7 +2898,7 @@ { "listen": "test", "script": { - "id": "92b2144a-64b5-47aa-8de0-9e6b63b70fcb", + "id": "26808b2e-841f-4893-9388-eaf6ef22a86d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2779,7 +2943,7 @@ { "listen": "test", "script": { - "id": "6b8fa039-601b-4c4f-b82a-d123073ee70e", + "id": "c05a97c9-6efa-45b9-bbc6-7f810047750f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2824,7 +2988,7 @@ { "listen": "test", "script": { - "id": "c20a5d1e-0882-4ff0-89b2-0fa4916c75da", + "id": "52909033-6a79-4035-8f76-71e3fc10d4cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2869,7 +3033,7 @@ { "listen": "test", "script": { - "id": "395595a7-30a2-47d4-b6b3-f7d22bbcbec3", + "id": "7de5f4bd-5a10-45a9-a12a-dd27866c2b00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2914,7 +3078,7 @@ { "listen": "test", "script": { - "id": "a561d994-fadb-486d-b4e7-3d21bed8af8e", + "id": "6a8629e4-25c6-44f8-80c9-c23c75ab1054", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2966,7 +3130,7 @@ { "listen": "test", "script": { - "id": "bd260b5c-5ae2-4f1a-8da3-2bfb2bbbce67", + "id": "86b45db5-d4d6-474c-af2e-8f846673b309", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3017,7 +3181,7 @@ { "listen": "test", "script": { - "id": "af9ecf6f-b733-4359-92d9-9326448a2a84", + "id": "debe2ab8-776a-4bac-8ca9-1492a29f8e42", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3068,7 +3232,7 @@ { "listen": "test", "script": { - "id": "2eeebc99-fcea-4719-9aa4-4a6ecf90d442", + "id": "ee615379-27dc-4654-b135-0c85ce68ace5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3119,7 +3283,7 @@ { "listen": "test", "script": { - "id": "a2ad9aa4-38ac-4ab6-8558-63365272be84", + "id": "8a0f9611-a75d-42f4-91f0-ad66bf1ddf84", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3170,7 +3334,7 @@ { "listen": "test", "script": { - "id": "52ee3c8d-d39e-45a2-9a4d-bba0d652cd30", + "id": "a8bb2394-c923-4063-a400-e21a49da52fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3235,7 +3399,7 @@ { "listen": "test", "script": { - "id": "5865a8d0-29bf-48fd-b922-8f6e47379e6e", + "id": "90d0cf29-65d9-46c2-b4f3-5b5b248347c4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3313,7 +3477,7 @@ { "listen": "test", "script": { - "id": "803becd8-ac1b-4258-a45b-1e57b10ce9ec", + "id": "afbd00bd-2a58-4ff3-95a1-3e6690c83edf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3342,7 +3506,7 @@ { "listen": "prerequest", "script": { - "id": "09739f37-dc6b-4725-83e1-c744e1c2d241", + "id": "4956a3a6-f0e0-4d87-b9a4-e08eee04bcb3", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3392,7 +3556,7 @@ { "listen": "test", "script": { - "id": "687b3ec9-992e-4f87-a3d7-c5e0a15a2078", + "id": "8630b5a2-f8c1-4967-98ca-d98d61eebce3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3456,7 +3620,7 @@ { "listen": "prerequest", "script": { - "id": "590a39b4-f6f8-4ad7-9b7d-6a80b54d560b", + "id": "856e690e-92be-4b6c-8f47-4fdaea094f63", "type": "text/javascript", "exec": [ "" @@ -3466,7 +3630,7 @@ { "listen": "test", "script": { - "id": "6a5ee161-8976-4900-92b5-4cf1399f1fe2", + "id": "db9e5e46-34ae-4f6c-bd26-845ff883128d", "type": "text/javascript", "exec": [ "" @@ -3480,136 +3644,13 @@ { "name": "User", "item": [ - { - "name": "Follow", - "item": [ - { - "name": "User-FollowUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "id": "742d4fdb-4d8f-4f3d-b247-16fa9d27f05d", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "id": "59aadf05-d21e-4582-aad7-5a117d726be2", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, { "name": "User-CreateUser-Guest", "event": [ { "listen": "test", "script": { - "id": "3373f452-fc4a-4111-be3a-91e60f8ad5f3", + "id": "09207dfd-36c6-4b7e-bf50-d191eb6de97d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3662,12 +3703,12 @@ "response": [] }, { - "name": "User-FollowUser-Guest", + "name": "User-GetUser-Guest", "event": [ { "listen": "test", "script": { - "id": "eb90ea5e-7646-4cf0-9ac7-2fc1e9e9d438", + "id": "6f8f2253-da52-45ce-b904-9db4c0d883f6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3677,14 +3718,14 @@ " pm.response.to.have.status(401);", "});", "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", "pm.test(\"Response must be valid and have a json body\", function () {", " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -3695,37 +3736,29 @@ "auth": { "type": "noauth" }, - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "User", + "1" ] } }, "response": [] }, { - "name": "User-FollowProject-Guest", + "name": "User-UpdateUser-Guest", "event": [ { "listen": "test", "script": { - "id": "169cdff7-a82c-45fc-b83a-d953588f1119", + "id": "cb2c5ce0-6f86-42c4-88d7-62f8e2a8890c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3735,14 +3768,14 @@ " pm.response.to.have.status(401);", "});", "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", "pm.test(\"Response must be valid and have a json body\", function () {", " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -3753,11 +3786,11 @@ "auth": { "type": "noauth" }, - "method": "POST", + "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", "options": { "raw": { "language": "json" @@ -3765,25 +3798,26 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "User", + "1" ] } }, "response": [] }, { - "name": "User-GetUser-Guest", + "name": "User-DeleteUser-Guest", "event": [ { "listen": "test", "script": { - "id": "b36559aa-f7c2-4ea1-af84-e34e0c57f244", + "id": "d0364b6b-4067-406b-befd-96e05aa61ad5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3808,10 +3842,7 @@ } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", + "method": "DELETE", "header": [], "url": { "raw": "{{apiUrl}}/api/User/1", @@ -3826,14 +3857,46 @@ } }, "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "57414607-817a-43a5-a6bd-54a952152a37", + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "User-UpdateUser-Guest", + "listen": "test", + "script": { + "id": "920efd77-1ce3-44ff-8f6d-f49c6c0dbf28", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-Guest", "event": [ { "listen": "test", "script": { - "id": "2aaa4a0e-4979-4f8b-a3ba-fb0c953ff8be", + "id": "510c9066-7980-4994-bfd3-8698fd7b22aa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3846,12 +3909,7 @@ "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" + "" ], "type": "text/javascript" } @@ -3861,11 +3919,18 @@ "auth": { "type": "noauth" }, - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -3873,43 +3938,36 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "1" + "follow", + "{{userIdToFollow}}" ] } }, "response": [] }, { - "name": "User-DeleteUser-Guest", + "name": "User-UnFollowUser-Guest", "event": [ { "listen": "test", "script": { - "id": "dff749b2-8de7-40ad-af4c-e7c85e8a03bb", + "id": "50eedab9-e8d3-44e3-a010-b2c7d2132cc8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3917,185 +3975,56 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "DELETE", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "1" + "follow", + "{{userIdToFollow}}" ] } }, "response": [] } ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "7f52857e-7070-4799-92fe-4367a0e8ee89", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "da51ae44-57da-4198-bbe2-dd8a0e779e78", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Project", "item": [ - { - "name": "Follow", - "item": [ - { - "name": "Project-FollowProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "id": "ce1cbb6b-5415-4e3a-8777-aba4c977aa96", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = \"Generic Metal Ball\"", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UnFollowProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "id": "0aef8ac3-b0d1-49bf-a244-e5574e5849a1", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, { "name": "Project-CreateProject-Guest", "event": [ { "listen": "test", "script": { - "id": "38028375-2c71-4851-848b-2996514dc408", + "id": "951be4a5-fbeb-475a-b991-c1cbc1dede6e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4155,7 +4084,7 @@ { "listen": "test", "script": { - "id": "02432018-39c4-44a4-bde5-1bf559af3927", + "id": "0cf0b488-2303-4274-af33-460618ae463c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4225,7 +4154,7 @@ { "listen": "test", "script": { - "id": "7e1dc145-9d14-4e43-979d-b55dc9f716ad", + "id": "a4229563-7e8f-4961-af05-dd214c69cd07", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4280,7 +4209,7 @@ { "listen": "test", "script": { - "id": "482a9f22-10c9-4cce-9c1d-49c0dbaeee4b", + "id": "870762f7-579b-4abd-a6ed-b79bdf383a09", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4337,7 +4266,7 @@ { "listen": "test", "script": { - "id": "47b2e7fe-4550-4e08-8825-075cd03191f4", + "id": "5a934f50-4e08-48de-bc5f-dc5a7c4cfe21", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4386,7 +4315,7 @@ { "listen": "prerequest", "script": { - "id": "7a8992b6-9cc8-4704-b573-a54f54c6a77a", + "id": "773d24e8-3018-44fa-8d83-48f5c0cf879f", "type": "text/javascript", "exec": [ "" @@ -4396,7 +4325,7 @@ { "listen": "test", "script": { - "id": "e840a81d-f500-4fa4-b995-396f25f9eb58", + "id": "63e4aa40-f44a-4bb5-b382-da57096ab706", "type": "text/javascript", "exec": [ "" @@ -4407,6 +4336,134 @@ "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, + { + "name": "FollowProject", + "item": [ + { + "name": "Project-FollowProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "5cc895c0-f7e1-4457-bca6-b7ab5da63567", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "e78f5c03-75b0-4a9f-ac4f-568b37003cd3", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "Highlight", "item": [ @@ -4416,7 +4473,7 @@ { "listen": "test", "script": { - "id": "429d06f0-dbbf-4ceb-bf2e-b62c2271677c", + "id": "10a28a0f-4832-4880-87d4-fdb6283f3be0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4443,7 +4500,7 @@ { "listen": "prerequest", "script": { - "id": "8f885ecd-9e60-4378-8e97-66994d852372", + "id": "0cd4eb53-60ed-43d4-ab71-aa716b58581a", "exec": [ "" ], @@ -4482,7 +4539,7 @@ { "listen": "test", "script": { - "id": "edd3e007-31fb-42e9-a8be-d0ccba9a0f37", + "id": "32dbd963-a7a8-442e-a8ae-fce481363a0e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4527,7 +4584,7 @@ { "listen": "test", "script": { - "id": "14771859-2a73-4509-9d31-cfc031b63c6f", + "id": "46b4252b-d05a-4406-8e29-6f3f9131b1a1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4582,7 +4639,7 @@ { "listen": "test", "script": { - "id": "c8985640-31cd-4e43-a258-fe3737f0ebf0", + "id": "6c7e11ec-988b-4cce-bde0-4d6f65bd87d4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4631,7 +4688,7 @@ { "listen": "test", "script": { - "id": "ca58145d-4c4c-485b-9cba-4dda9a9473cc", + "id": "275208d6-55cb-4fa6-aef0-acf699f44cbd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4658,7 +4715,7 @@ { "listen": "prerequest", "script": { - "id": "429d96de-1074-424c-bafd-b92f920ef008", + "id": "a33e4758-716e-4fb8-9cd9-a5ea66a85421", "exec": [ "" ], @@ -4698,7 +4755,7 @@ { "listen": "test", "script": { - "id": "83eb198d-e1b3-498a-9d94-a67dc53ff2a6", + "id": "ac7c46e9-0367-4c19-8969-349f5d6cb822", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4747,7 +4804,7 @@ { "listen": "prerequest", "script": { - "id": "5c28bc07-b68d-4a8e-966a-97b9cc00b925", + "id": "a0db9188-0cf6-4761-81ce-335222566114", "type": "text/javascript", "exec": [ "" @@ -4757,7 +4814,7 @@ { "listen": "test", "script": { - "id": "a415c3f3-897c-4b44-a0db-d449582cabd0", + "id": "938a8168-eac8-4f3f-8303-bef273fa9dc8", "type": "text/javascript", "exec": [ "" @@ -4777,7 +4834,7 @@ { "listen": "test", "script": { - "id": "00b89cb8-4655-4cfe-bfef-99c71075384c", + "id": "dce43e5e-bc20-438f-8f6a-13d4b794bea1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4832,7 +4889,7 @@ { "listen": "test", "script": { - "id": "72161f42-8fda-481a-818d-202b0dfca488", + "id": "ef59dae2-be04-41e3-861e-d6c0de1b4df7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4878,7 +4935,7 @@ { "listen": "test", "script": { - "id": "e7181385-3925-4b3f-9ed4-9c3e7bd79378", + "id": "6a89a408-4b17-40e8-a99e-e9c7b5020051", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4925,7 +4982,7 @@ { "listen": "test", "script": { - "id": "b2d72f1f-0908-4a03-8784-a64093c34d5b", + "id": "aea2d332-3aa8-4332-8626-119585650fa1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4974,7 +5031,7 @@ { "listen": "prerequest", "script": { - "id": "53dbee05-b741-4d8b-bcef-e600802e2410", + "id": "d8cd3cc2-e687-4c82-9d32-b0ba288e1342", "type": "text/javascript", "exec": [ "" @@ -4984,7 +5041,7 @@ { "listen": "test", "script": { - "id": "9ad98cb4-7b19-49fe-84b7-18ff4951f402", + "id": "24962589-cd19-460f-b735-a4ef5d10c02e", "type": "text/javascript", "exec": [ "" @@ -5004,7 +5061,7 @@ { "listen": "test", "script": { - "id": "52a8e434-7893-4773-b2e8-d08f09009880", + "id": "0e57dd13-7312-4492-b258-dd28b79cc7dc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5060,7 +5117,7 @@ { "listen": "test", "script": { - "id": "197c334a-1027-40bf-9d6c-d87aba60c897", + "id": "73036bf2-8aef-4c37-9b81-b1e0d29c14cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5107,7 +5164,7 @@ { "listen": "test", "script": { - "id": "f58cadd9-e1d4-4688-bf4c-1edc1ad5cc14", + "id": "7a231724-c7b8-430b-a8d5-af6c537e85d0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5155,7 +5212,7 @@ { "listen": "test", "script": { - "id": "5cde50b7-c620-4711-ad89-17483c974f5e", + "id": "5f367f44-4423-4377-b979-488a2e4decac", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5203,7 +5260,7 @@ { "listen": "test", "script": { - "id": "e9cfb930-370c-41a2-ade6-06a8744ce2ca", + "id": "ad043126-77de-4c1e-a216-fa5334605a43", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5260,7 +5317,7 @@ { "listen": "test", "script": { - "id": "a8c725b1-ec1e-4ab6-ad7c-95e43d0bf816", + "id": "63dfa67f-445b-41ef-baca-f055197fdb4f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5331,7 +5388,7 @@ { "listen": "prerequest", "script": { - "id": "d4dc0f6a-9e81-473b-a6d2-4d182236fda2", + "id": "45c9c6ca-e7bd-4057-8b6c-92f50be232c0", "type": "text/javascript", "exec": [ "" @@ -5341,7 +5398,7 @@ { "listen": "test", "script": { - "id": "3b5d73cb-3c05-49e9-a8eb-a807af0cfbd1", + "id": "f62d613b-7bd0-4b40-930d-b4b6febca54c", "type": "text/javascript", "exec": [ "" @@ -5361,7 +5418,7 @@ { "listen": "test", "script": { - "id": "70bffee9-98ac-4bfc-be9b-77e7644ff635", + "id": "01e6f9b3-a6b7-4587-b099-18bbc5becfda", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5412,7 +5469,7 @@ { "listen": "prerequest", "script": { - "id": "d0d4b573-2d72-4a2d-9380-d3a5d3d9734c", + "id": "096c8a0a-35c7-4abb-9f45-dc2c853cef10", "type": "text/javascript", "exec": [ "" @@ -5422,7 +5479,7 @@ { "listen": "test", "script": { - "id": "d1ca2211-e512-4890-900d-4e0a620ef322", + "id": "c060a22e-dae1-495a-bd6e-91dc0b3393d0", "type": "text/javascript", "exec": [ "" @@ -5442,7 +5499,7 @@ { "listen": "test", "script": { - "id": "2b50fd0a-2b1f-49f8-a466-14a866f9be33", + "id": "78effdf9-a66c-4439-96ce-09540b6c1187", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5498,7 +5555,7 @@ { "listen": "prerequest", "script": { - "id": "199676e9-7ea5-4644-af7a-6399476a51c2", + "id": "048601b5-68c6-408c-bc0e-67a03e1e0be3", "type": "text/javascript", "exec": [ "" @@ -5508,7 +5565,7 @@ { "listen": "test", "script": { - "id": "7037d025-d6b0-4b54-af59-e789dae637eb", + "id": "577a1710-eebb-49fc-8fe4-d38944b7a50d", "type": "text/javascript", "exec": [ "" @@ -5524,7 +5581,7 @@ { "listen": "prerequest", "script": { - "id": "ba686cb3-fc8e-4b07-b65f-397ee8d6cae3", + "id": "3c5906bc-b907-4870-84f0-3a7b3f1852a9", "type": "text/javascript", "exec": [ "" @@ -5534,7 +5591,7 @@ { "listen": "test", "script": { - "id": "d2be4adb-c820-4ce9-a0ef-8e0c3c9b6fd8", + "id": "07217920-cb4e-4889-9905-12f406160ce3", "type": "text/javascript", "exec": [ "" @@ -5557,7 +5614,7 @@ { "listen": "test", "script": { - "id": "db8920d2-e557-4ee8-a709-a8b3eb886618", + "id": "dd15797f-2330-4934-bfd7-54fdc6d043b5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5626,7 +5683,7 @@ { "listen": "test", "script": { - "id": "d1cc5ca3-b0d1-4e10-b934-831d60fcc422", + "id": "727b0ae4-e04c-4739-babe-c58e461660df", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5705,7 +5762,7 @@ { "listen": "test", "script": { - "id": "64ecbf57-2189-4ff9-92a1-2abeb6c252d9", + "id": "b689b19d-2a06-4b6e-ab90-f3f7690697f7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5734,7 +5791,7 @@ { "listen": "prerequest", "script": { - "id": "f03e3714-6b31-4dbe-8be4-68b7770dfe7a", + "id": "50d8da57-5f00-4c88-81b2-b0b215b8fb6a", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5784,7 +5841,7 @@ { "listen": "test", "script": { - "id": "e931ecd1-7d4d-4fe2-b8d2-9f3fc9e5f4b3", + "id": "edf5bb9f-c695-4b76-adca-d6f1f68c4acb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5849,7 +5906,7 @@ { "listen": "test", "script": { - "id": "2a454f15-069f-46aa-9e24-0046f3aa8842", + "id": "4e8a2885-9bbb-4941-bda1-28bf66d4b6ba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5922,7 +5979,7 @@ { "listen": "prerequest", "script": { - "id": "d5a985fd-8009-4ced-a2e1-9f37a6c87c39", + "id": "8d6ef504-b083-4ddc-9008-a0513b500a93", "type": "text/javascript", "exec": [ "" @@ -5932,7 +5989,7 @@ { "listen": "test", "script": { - "id": "d0d24d95-5d68-4270-be27-657eddadd685", + "id": "5c184acc-c077-4abb-9b44-8d79723a756f", "type": "text/javascript", "exec": [ "" @@ -5947,145 +6004,12 @@ "name": "User", "item": [ { - "name": "Follow", - "item": [ - { - "name": "User-FollowUser-Registered", - "event": [ - { - "listen": "test", - "script": { - "id": "ab0be218-be02-40fe-8845-ed0d3a932de7", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userId = 25", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userId, function () {", - " pm.expect(jsonData.id).to.eql(userId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-Registered", - "event": [ - { - "listen": "test", - "script": { - "id": "15ed1ba0-acbf-4048-b358-06ad38987428", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "User-CreateUser-Registered", - "event": [ + "name": "User-CreateUser-Registered", + "event": [ { "listen": "test", "script": { - "id": "01024392-f907-4c82-9735-846dbbde0579", + "id": "7e32e9f6-8321-4feb-9006-a428168f65b3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6140,18 +6064,19 @@ "response": [] }, { - "name": "User-FollowUser-Registered", + "name": "User-GetUser-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "406c789b-d0ed-4830-b3c5-46078bf1be33", + "id": "6b57b1b4-a737-4087-a895-8059b848f8fb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", @@ -6169,7 +6094,7 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -6177,54 +6102,50 @@ "value": "{{registeredUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User/follow/user/1", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "follow", - "user", - "1" + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "User-UnFollowUser-Registered", + "name": "User-GetUser-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "7574a3ab-ce99-4450-b403-eb56351a3068", + "id": "ea4d537b-26ec-453e-8458-c4a2dd456bc8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", + "", "var jsonData = pm.response.json();", + "pm.environment.set(\"registeredUserId\", jsonData.id);", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", "});" ], "type": "text/javascript" @@ -6232,7 +6153,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [ { "key": "IdentityId", @@ -6240,40 +6161,30 @@ "value": "{{registeredUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User/follow/user/1", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "follow", - "user", - "1" + "User" ] } }, "response": [] }, { - "name": "User-FollowProject-Registered", + "name": "User-UpdateUser-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "e6ce4254-72ec-4fff-8eac-88c467be2bfc", + "id": "bceec06e-4a44-4ad3-9815-8105a6e0ab62", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "", "var jsonData = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", @@ -6282,6 +6193,16 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", "});" ], "type": "text/javascript" @@ -6289,7 +6210,7 @@ } ], "request": { - "method": "POST", + "method": "PUT", "header": [ { "key": "IdentityId", @@ -6299,7 +6220,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", "options": { "raw": { "language": "json" @@ -6307,45 +6228,43 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/follow/project/1", + "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "follow", - "project", - "1" + "{{registeredUserId}}" ] } }, "response": [] }, { - "name": "User-GetUser-Other-Registered", + "name": "User-UpdateUser-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "4f457db6-b4d4-456b-8145-b1a1230e35bf", + "id": "e2c03a2b-a43d-4712-9cbf-e93bac36e2be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -6353,7 +6272,7 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [ { "key": "IdentityId", @@ -6361,6 +6280,15 @@ "value": "{{registeredUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ @@ -6374,27 +6302,56 @@ } }, "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "72a0a0df-4917-46bd-a4bb-42af148256a2", + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "User-GetUser-Self-Registered", + "listen": "test", + "script": { + "id": "4d9a3da8-0a66-4f0b-af84-bffcbe37f175", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-Registered", "event": [ { "listen": "test", "script": { - "id": "d18ed922-1c29-4a9e-8416-f83bc22a974c", + "id": "673152d7-df9f-4483-8ff8-518caf3bb160", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", "", "var jsonData = pm.response.json();", - "pm.environment.set(\"registeredUserId\", jsonData.id);", + "var userId = pm.environment.get(\"userIdToFollow\");", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", + " pm.response.to.be.success;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", @@ -6403,65 +6360,8 @@ " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "id": "5e8c5cec-4806-4c2e-9525-da46af199d07", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", "});" ], "type": "text/javascript" @@ -6469,7 +6369,7 @@ } ], "request": { - "method": "PUT", + "method": "POST", "header": [ { "key": "IdentityId", @@ -6479,7 +6379,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -6487,43 +6387,36 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "{{registeredUserId}}" + "follow", + "{{userIdToFollow}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Other-Registered", + "name": "User-UnFollowUser-Registered", "event": [ { "listen": "test", "script": { - "id": "99dbabe3-4d8f-41cb-8bce-1c944ad96a29", + "id": "50cd2fb3-7580-4c45-8133-8ea300bef295", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6531,7 +6424,7 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -6541,7 +6434,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -6549,26 +6442,26 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "{{createdUserId}}" + "follow", + "{{userIdToFollow}}" ] } }, "response": [] } ], - "description": "Requests executed as the Alice user with the registered role.", "event": [ { "listen": "prerequest", "script": { - "id": "582ea3c3-5a17-451b-b5be-b1e734fef8eb", + "id": "5b97f0a8-863e-4286-a67d-aacfbd152449", "type": "text/javascript", "exec": [ "" @@ -6578,7 +6471,7 @@ { "listen": "test", "script": { - "id": "278af5fc-7c82-4bcf-a361-cf9d6745f6bd", + "id": "b17e2239-db09-48ba-b1a6-e5b6ecd6bfe3", "type": "text/javascript", "exec": [ "" @@ -6592,146 +6485,13 @@ { "name": "Project", "item": [ - { - "name": "Follow", - "item": [ - { - "name": "Project-FollowProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "id": "22970b7f-2de6-41a2-8f26-3848803bae89", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectId = 3", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + projectId, function () {", - " pm.expect(jsonData.id).to.eql(projectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UnFollowProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "id": "67efdc2b-2f9a-48a1-95d7-e593637c202c", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, { "name": "Project-CreateProject-Registered", "event": [ { "listen": "test", "script": { - "id": "3b9fc86d-9853-4594-a1ec-137bacc84275", + "id": "e88a64ec-13f1-4674-83b7-8e4be490ef12", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6797,7 +6557,7 @@ { "listen": "test", "script": { - "id": "59515132-4a17-4233-9ac3-758bdecfceae", + "id": "f0bb89ae-e8c0-4719-9ad7-924d561bb576", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6870,7 +6630,7 @@ { "listen": "test", "script": { - "id": "8216b6be-a07b-4496-9a9d-2dd8873245f0", + "id": "02fc3765-e2a5-47a8-9d2c-3a4309a550b0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6928,7 +6688,7 @@ { "listen": "test", "script": { - "id": "f481301c-4f17-4ecc-8136-be43fd0607ec", + "id": "85addaf8-323e-48b9-ab17-01e7ce6ac06b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6957,7 +6717,134 @@ "type": "text", "value": "{{registeredUserIdentityId}}" } - ], + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "40349407-e8ef-4492-9bfd-e9fcbccb5155", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "af35e368-f1c9-43b3-a99e-b1af5700a51a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", "host": [ @@ -6971,17 +6858,24 @@ } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "FollowProject", + "item": [ { - "name": "Project-UpdateProject-Self-Registered", + "name": "Project-FollowProject-Registered", "event": [ { "listen": "test", "script": { - "id": "547c4a5c-6a3f-4117-ad34-8a368531d556", + "id": "b3e31ee0-54fc-434f-95d7-9f0fb2d6cfc0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectNameUpdated\");", + "var projectId = pm.environment.get(\"projectIdToFollow\");", "", "var jsonData = pm.response.json();", "", @@ -6989,18 +6883,18 @@ " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", + " pm.response.to.be.success;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", "});" ], "type": "text/javascript" @@ -7008,17 +6902,17 @@ } ], "request": { - "method": "PUT", + "method": "POST", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{administratorUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -7026,41 +6920,36 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "project", + "follow", + "{{projectIdToFollow}}" ] } }, "response": [] }, { - "name": "Project-UpdateProject-Other-Registered", + "name": "Project-UnFollowProject-Registered", "event": [ { "listen": "test", "script": { - "id": "e3f6d06e-c777-4b0a-8d49-85640c2d3202", + "id": "59159987-9feb-4117-97fc-a56880c7d6e2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -7068,17 +6957,17 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{administratorUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -7086,20 +6975,43 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{adminProjectId}}" + "project", + "follow", + "{{projectIdToFollow}}" ] } }, "response": [] } ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "5643d783-c75a-4760-b909-f2657780f2dc", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "ad9466f3-3a63-4785-a446-73bb34c48718", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, @@ -7112,7 +7024,7 @@ { "listen": "test", "script": { - "id": "43f20175-6465-4796-9774-a7d8c46b13f7", + "id": "5ce8c755-666f-49d3-a898-81e6bde11c2b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7176,7 +7088,7 @@ { "listen": "test", "script": { - "id": "6db9b959-e218-47b1-b2a3-317faef4797e", + "id": "fbbbbb00-310d-4ff9-88a0-e3e8f3f2d65e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7237,7 +7149,7 @@ { "listen": "test", "script": { - "id": "08292766-5d01-4f64-9046-315a3b711974", + "id": "33678519-5ea9-4f8c-afba-8f182114d5c1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7289,7 +7201,7 @@ { "listen": "test", "script": { - "id": "e6d9018c-b68b-4a02-8322-91622ed92517", + "id": "9bc03102-af12-4557-adf7-817a6a5b7003", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -7354,7 +7266,7 @@ { "listen": "test", "script": { - "id": "15860a63-ec78-44f4-84b6-99a5d7ac493a", + "id": "df430e96-892a-4254-a331-9e062333d574", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7380,7 +7292,7 @@ { "listen": "prerequest", "script": { - "id": "7af04590-c7d8-4f65-a24c-97162b36b7f8", + "id": "384f0d0f-1ba6-4c13-b62d-957aca4e94fa", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -7430,7 +7342,7 @@ { "listen": "test", "script": { - "id": "156df0e0-bd6c-4011-8ead-e8dc22791271", + "id": "adc61dc4-8f24-4ea3-b3fb-05489bf507fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -7499,7 +7411,7 @@ { "listen": "test", "script": { - "id": "79c3e397-d4c3-4aec-a1e5-8bd0213b1053", + "id": "83f38279-52f5-470d-ba46-46a54092c6d4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -7561,7 +7473,7 @@ { "listen": "test", "script": { - "id": "99faab17-d5f8-4891-80fb-269141c7143d", + "id": "7bf26e55-6cd2-4f01-8a04-8cb722ceaa4f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7616,7 +7528,7 @@ { "listen": "test", "script": { - "id": "a6f6d147-1f70-470a-9e2e-89ba6de5e81a", + "id": "9927ea3e-941f-423c-896a-de89743d2d36", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7685,7 +7597,7 @@ { "listen": "test", "script": { - "id": "36180131-3f19-4be3-9263-392399ad025c", + "id": "288043e3-d53e-4fdc-ac44-bdaaa4c6dd49", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7746,7 +7658,7 @@ { "listen": "test", "script": { - "id": "43c11a89-656b-469c-8cb0-bacdf6575798", + "id": "6bb006ec-9ce5-4fcd-a077-e7817c1f4356", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7798,7 +7710,7 @@ { "listen": "test", "script": { - "id": "ae43fd3d-cfd8-4bdf-9729-075d257daca2", + "id": "dae306dc-feb5-49ce-8723-ee77279921c9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7851,7 +7763,7 @@ { "listen": "test", "script": { - "id": "803b1054-777f-4b36-b8ae-fd15bca56bf4", + "id": "2f0ad802-6fad-4f49-a64c-b23ec49bbcff", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7904,7 +7816,7 @@ { "listen": "test", "script": { - "id": "f833467b-9316-4252-98fd-b0266a7ddd96", + "id": "df71e55a-bb2b-455c-a00f-a6d2dd8ebaea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7966,7 +7878,7 @@ { "listen": "test", "script": { - "id": "b28a0f11-948b-4e1a-ab5d-43e5505f72e1", + "id": "cb960fa3-1b29-4a0a-950a-8151dfa8e1cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8047,7 +7959,7 @@ { "listen": "test", "script": { - "id": "4e238c07-790f-4932-97f6-a5c250d59547", + "id": "ac74296d-5be3-43eb-871e-0d390181236b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8106,7 +8018,7 @@ { "listen": "test", "script": { - "id": "56e9b270-b3d3-4055-9c2d-a182042df9a5", + "id": "f82a2402-e7c0-432e-af4c-64e48fabe5aa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -8172,7 +8084,7 @@ { "listen": "test", "script": { - "id": "06a7f923-cf89-4029-9640-a391dbc40465", + "id": "05cb1235-fe28-40f8-92d5-dd5098c0bd56", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8221,7 +8133,7 @@ { "listen": "test", "script": { - "id": "b582a147-3c96-4ae0-aba0-3242856c7d61", + "id": "39fa2a82-41ce-4f17-88a4-ceb5f6c5f775", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8272,7 +8184,7 @@ { "listen": "test", "script": { - "id": "cc83fc60-a31a-4242-bcf1-e6d8a074bf38", + "id": "3b13799c-0c2a-4534-9363-96b12ee2c2db", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8323,7 +8235,7 @@ { "listen": "test", "script": { - "id": "0202e0ad-2287-4f53-bfa8-9d47c51ae0db", + "id": "dd95cd3d-d533-42b7-877b-b11ef09b6576", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8368,7 +8280,7 @@ { "listen": "test", "script": { - "id": "eef0f020-d6cf-4914-a9c0-35bea8e04245", + "id": "3a0901f6-e333-48fe-872d-c6ed2335bbc3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8419,7 +8331,7 @@ { "listen": "test", "script": { - "id": "3a80339f-2305-4ecb-99ad-144499de5711", + "id": "4564e06f-55c1-425c-a5fa-6ae571205af2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8470,7 +8382,7 @@ { "listen": "test", "script": { - "id": "047b16e2-fda2-4592-a6fe-a7a41018ac96", + "id": "82bf4972-998a-4846-b142-6e83b85e5a0f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8535,7 +8447,7 @@ { "listen": "test", "script": { - "id": "96444922-e42d-4a75-845e-34c3a884255e", + "id": "27373880-24bb-49fb-8816-ff0b6dae359a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8604,7 +8516,7 @@ { "listen": "test", "script": { - "id": "9ba6e788-0364-4f5e-a316-ddfe997c5948", + "id": "bbf0e491-91c1-4352-99e4-1525ff579b56", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8683,7 +8595,7 @@ { "listen": "test", "script": { - "id": "02c1ba2d-2d5a-4402-b403-818f901129c4", + "id": "6ccdc966-58bd-4c5f-aabb-136d02178d47", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8712,7 +8624,7 @@ { "listen": "prerequest", "script": { - "id": "4f9fd25d-b62b-4c34-91b7-d6be61424072", + "id": "b7af45e3-6179-47b8-beb4-4e90c9614d64", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8762,7 +8674,7 @@ { "listen": "test", "script": { - "id": "ac2b6251-c664-4f34-a5e8-3926ca6fc757", + "id": "b16e33f6-67ad-4082-9c3d-8802eeac67f3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8826,7 +8738,7 @@ { "listen": "test", "script": { - "id": "e9688d3f-a405-4144-9e1f-8cd9daf1684f", + "id": "3dfa4eab-ded7-4599-8b35-254c4ed2eb01", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8899,7 +8811,7 @@ { "listen": "prerequest", "script": { - "id": "c7d754cb-9f76-46b3-8ca0-a5bb7bba6d8c", + "id": "3ee798d5-14b8-4b26-aa22-b0807512e59e", "type": "text/javascript", "exec": [ "" @@ -8909,7 +8821,7 @@ { "listen": "test", "script": { - "id": "585a1f57-bf11-42eb-87e8-3903f4289b42", + "id": "dd91bec7-2d40-46bd-8199-934eb260b9c6", "type": "text/javascript", "exec": [ "" @@ -8923,146 +8835,13 @@ { "name": "User", "item": [ - { - "name": "Follow", - "item": [ - { - "name": "User-FollowUser-PR", - "event": [ - { - "listen": "test", - "script": { - "id": "e033e234-2d1a-449f-8149-025fb6900cfe", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userId = 25", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userId, function () {", - " pm.expect(jsonData.id).to.eql(userId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-PR", - "event": [ - { - "listen": "test", - "script": { - "id": "e9d15f60-51ee-45d5-84cb-0ffae4eefc8e", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, { "name": "User-CreateUser-PR", "event": [ { "listen": "test", "script": { - "id": "91e39857-10ee-41ba-ace1-5dc1b770c096", + "id": "2d9ed119-05d4-4d6a-a15a-6195cada35ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9117,14 +8896,15 @@ "response": [] }, { - "name": "User-FollowUser-PR", + "name": "User-GetUser-Other-PR", "event": [ { "listen": "test", "script": { - "id": "c216c5da-e108-4581-a7b5-45483c8f2201", + "id": "cfb1847a-3db4-4258-8421-e161c98ea0f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", "var jsonData = pm.response.json();", "", "pm.test(\"Status code is 403\", function () {", @@ -9146,7 +8926,7 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -9154,52 +8934,50 @@ "value": "{{prUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "User-GetUser-Other-PR", + "name": "User-GetUser-Self-PR", "event": [ { "listen": "test", "script": { - "id": "6ad4f08f-a3b2-4586-b646-6d9e32923c83", + "id": "d81a0107-669a-4376-a671-e5049c779df7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", "", "var jsonData = pm.response.json();", + "pm.environment.set(\"PrUserId\", jsonData.id);", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + prUserIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(prUserIdentityId);", "});" ], "type": "text/javascript" @@ -9216,49 +8994,109 @@ } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "User" ] } }, "response": [] }, { - "name": "User-GetUser-Self-PR", + "name": "User-UpdateUser-Self-PR", "event": [ { "listen": "test", "script": { - "id": "44220256-3a66-459f-9ac2-cb9f34c4dd83", + "id": "1787afa4-393b-47d3-b609-0e8762c18351", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", + "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", "", "var jsonData = pm.response.json();", - "pm.environment.set(\"PrUserId\", jsonData.id);", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", "pm.test(\"Response must be valid and have a json body\", function () {", " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", + "pm.test(\"Check if email update matches: \" + updatedPrUserEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedPrUserEmail);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"Pr jerry\",\r\n \"email\": \"{{updatedPrUserEmail}}\",\r\n \"identityId\": \"{{prUserIdentityId}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{PrUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{PrUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "982c814e-565d-441f-86d0-398d6d69d2b6", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Identity ID is correct and matching: \" + prUserIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(prUserIdentityId);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -9266,7 +9104,7 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [ { "key": "IdentityId", @@ -9274,48 +9112,88 @@ "value": "{{prUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "User", + "{{createdUserId}}" ] } }, "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "a029ff15-234d-4d0f-8127-8b90864109b7", + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "User-UpdateUser-Self-PR", + "listen": "test", + "script": { + "id": "70cd6988-51b3-4d6f-a1ed-f90734e07f25", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-PR", "event": [ { "listen": "test", "script": { - "id": "fd9c0740-02b3-4e4b-805f-d931a3c00d2f", + "id": "49aeef34-b26b-497f-b1d7-0686d07bcdc5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", "", "var jsonData = pm.response.json();", + "var userId = pm.environment.get(\"userIdToFollow\");", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", + " pm.response.to.be.success;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", - "pm.test(\"Check if email update matches: \" + updatedPrUserEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedPrUserEmail);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", "});" ], "type": "text/javascript" @@ -9323,17 +9201,17 @@ } ], "request": { - "method": "PUT", + "method": "POST", "header": [ { "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" + "type": "text", + "value": "{{prUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"Pr jerry\",\r\n \"email\": \"{{updatedPrUserEmail}}\",\r\n \"identityId\": \"{{prUserIdentityId}}\"\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -9341,43 +9219,36 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{PrUserId}}", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "{{PrUserId}}" + "follow", + "{{userIdToFollow}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Other-PR", + "name": "User-UnFollowUser-PR", "event": [ { "listen": "test", "script": { - "id": "fecaf8bf-320e-437b-a403-b0190734c79e", + "id": "3406766d-f94d-414f-9ba0-126061520169", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -9385,7 +9256,7 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -9395,7 +9266,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -9403,26 +9274,26 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "{{createdUserId}}" + "follow", + "{{userIdToFollow}}" ] } }, "response": [] } ], - "description": "Requests executed as the Alice user with the registered role.", "event": [ { "listen": "prerequest", "script": { - "id": "b0d4d151-ee9d-49e6-b1d5-7ddbfa5ace61", + "id": "8c21096d-b838-418e-bcc7-a7467be6840d", "type": "text/javascript", "exec": [ "" @@ -9432,7 +9303,7 @@ { "listen": "test", "script": { - "id": "2efd592c-826e-4d55-8a4c-4d630fa1f9b6", + "id": "3b9c2a42-c83d-4e58-91bc-4fadac673df7", "type": "text/javascript", "exec": [ "" @@ -9446,146 +9317,13 @@ { "name": "Project", "item": [ - { - "name": "Follow", - "item": [ - { - "name": "Project-FollowProject-PR", - "event": [ - { - "listen": "test", - "script": { - "id": "1d856d10-c630-4b60-840f-8039fa0f71c3", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = 3", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + projectName, function () {", - " pm.expect(jsonData.id).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UnFollowProject-PR", - "event": [ - { - "listen": "test", - "script": { - "id": "7656fde1-7848-4cb5-87b8-2f68ffe90481", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, { "name": "Project-CreateProject-PR", "event": [ { "listen": "test", "script": { - "id": "9ca0c0d2-9408-4f4b-a1f3-1e60711dacdb", + "id": "e4c91aed-6ef6-4b00-aad1-c7dca50c4462", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -9651,7 +9389,7 @@ { "listen": "test", "script": { - "id": "27d3ab62-f7c3-4854-a6e7-141364f6eea5", + "id": "d21b4453-3530-4ba7-a134-ec8fd361114e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9724,7 +9462,7 @@ { "listen": "test", "script": { - "id": "8f6f2297-a515-4c7f-9f44-700017fc3e45", + "id": "e79f9b5d-b5b2-42f0-92f4-f4d9464de27f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9782,7 +9520,7 @@ { "listen": "test", "script": { - "id": "2c44ff08-5189-4ce2-b0c7-1ac71f72bb51", + "id": "6b1fb601-1095-4beb-947d-181fd5532bf3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -9832,7 +9570,7 @@ { "listen": "test", "script": { - "id": "5d8846b2-6d2d-4fab-94cd-1765ff572f07", + "id": "a344705d-a8fc-4e63-b800-79913f332572", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -9899,7 +9637,7 @@ { "listen": "test", "script": { - "id": "aeb54c50-08b5-43cb-859b-4cc219378efa", + "id": "08d2965a-4788-40dc-a89b-c912861e25ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9957,6 +9695,158 @@ "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, + { + "name": "FollowProject", + "item": [ + { + "name": "Project-FollowProject-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "6325a124-1349-488b-b311-2877755413f0", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "var projectId = pm.environment.get(\"projectIdToFollow\");", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created project id matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "a63fb9a1-6bb0-443a-b493-0102771d1221", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "a7236e59-4edc-4971-8ba9-6ef1fbf4efb0", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "859900a6-1848-4050-ac11-832cd2121f7e", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "Embed", "item": [ @@ -9966,7 +9856,7 @@ { "listen": "test", "script": { - "id": "5de0dbce-1c85-4fcc-956d-1f95113d08c7", + "id": "af3ca3d9-a581-4a4c-b9f8-72b4649c12f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10030,7 +9920,7 @@ { "listen": "test", "script": { - "id": "4dac6757-e25c-40a8-a5b7-ced1d3f54c28", + "id": "a15c6bd7-92dd-45dc-ab36-5a486e5dda3d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10094,7 +9984,7 @@ { "listen": "test", "script": { - "id": "9ae6ab51-6f8a-4125-bf07-87d62ba791dc", + "id": "f5ce86b9-b2ad-4ac1-901c-1530228368cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10146,7 +10036,7 @@ { "listen": "test", "script": { - "id": "fbfab176-2361-445b-8210-cbef4aca5ccf", + "id": "908772af-ad49-4b8a-8f8d-fc86bf7d955c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -10204,7 +10094,7 @@ { "listen": "test", "script": { - "id": "a215f69e-965f-4dd5-80c7-27c1eae7ca79", + "id": "c649e329-4782-4fca-ab91-3c685b097794", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -10269,7 +10159,7 @@ { "listen": "test", "script": { - "id": "3a92482a-eced-4ee9-a04b-b0a3a7401b82", + "id": "d13954a7-b32e-4ed0-aee6-b08da85a5223", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10297,7 +10187,7 @@ { "listen": "prerequest", "script": { - "id": "6d2d6eea-f0f5-45af-9ae1-d4582b12a776", + "id": "2ebe216f-b0a4-4163-a6b4-9f2732d8af30", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10347,7 +10237,7 @@ { "listen": "test", "script": { - "id": "874b00a5-205d-4e72-a7b4-160f4d1f8791", + "id": "0aa214d5-8400-4197-aead-a72621464993", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10409,7 +10299,7 @@ { "listen": "test", "script": { - "id": "97535220-1176-494d-b4f4-a4a7e709e7b4", + "id": "23298988-0413-4fe9-a621-6090d8936ae6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10496,7 +10386,7 @@ { "listen": "test", "script": { - "id": "8248083b-87a6-495d-b1bd-c4f5b16a53bb", + "id": "f5e98ca8-095f-4fdd-ab82-307931b6d777", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10522,7 +10412,7 @@ { "listen": "prerequest", "script": { - "id": "27cedae2-47bb-4a16-81d3-44028c354993", + "id": "0cfada2c-d574-4e4b-aaa7-613855748b1b", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10569,7 +10459,7 @@ { "listen": "test", "script": { - "id": "bb670b70-a39f-4cd4-adc9-d9c3481c6ead", + "id": "ddb8910d-7ea7-4f07-bbee-58d4343e5f8b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10596,7 +10486,7 @@ { "listen": "prerequest", "script": { - "id": "54a6efb9-2b62-41c8-b2f5-54e89c86c7ea", + "id": "35489972-0a0a-4502-9af9-0065f5988d36", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10646,7 +10536,7 @@ { "listen": "test", "script": { - "id": "58b30145-c908-441b-9e33-ccc204a28f3c", + "id": "636d5863-ecd5-456c-a663-58ba1abb2332", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10708,7 +10598,7 @@ { "listen": "test", "script": { - "id": "57306014-34c8-40d6-9e17-df77e745535a", + "id": "07338c85-d955-4431-9214-06fc9ea07b0f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10795,7 +10685,7 @@ { "listen": "test", "script": { - "id": "e40405c2-ca3b-4361-a553-71fccc659884", + "id": "9f4f7486-02fc-47aa-a948-1fbc084dda0f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10821,7 +10711,7 @@ { "listen": "prerequest", "script": { - "id": "a2218cd0-ea9a-42c8-8b95-3bdfac11f956", + "id": "d4ea9afb-1fd2-4896-946c-330260e07b36", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10868,7 +10758,7 @@ { "listen": "test", "script": { - "id": "5ad8ee5c-5eac-4716-8a75-bc7750515f30", + "id": "11552ad9-308d-47a0-a05d-f65dff70e0f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10944,7 +10834,7 @@ { "listen": "test", "script": { - "id": "6118d144-de52-4ff4-879a-2b7d8a12d19b", + "id": "238a11a2-111c-40d1-975e-ffdfebca7f9e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11005,7 +10895,7 @@ { "listen": "test", "script": { - "id": "96498358-ff50-4f99-8353-55b7f9deec68", + "id": "bca9202d-ed5f-41e7-b842-6b5dea3c59ee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11057,7 +10947,7 @@ { "listen": "test", "script": { - "id": "25fd2cb2-01e7-4ce1-ba9b-07d4258669de", + "id": "59686009-aad0-4fb5-9a70-66ae0b25ebfe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11110,7 +11000,7 @@ { "listen": "test", "script": { - "id": "c90137c5-1598-4b83-bddb-89f014d104a6", + "id": "93300883-47d3-4d1a-8506-374f0bf6e196", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11163,7 +11053,7 @@ { "listen": "test", "script": { - "id": "9b61635b-c683-4c8a-bc15-6b6c6fd7b865", + "id": "f7bd5846-e127-4274-a87f-ca033482bc5f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11225,7 +11115,7 @@ { "listen": "test", "script": { - "id": "4c7d50f7-edca-44fb-bead-c4e84f2bc81a", + "id": "25a28073-1f67-4f96-bb70-e0a82bed6063", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11306,7 +11196,7 @@ { "listen": "test", "script": { - "id": "7e670af1-8086-4b65-b96e-df0175e7135d", + "id": "229d7cc1-041e-43e8-b626-d624f98980cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11365,7 +11255,7 @@ { "listen": "test", "script": { - "id": "1cd71ba7-bbca-4b13-80d5-5bbfe10c0662", + "id": "b042e4e0-aaae-4fde-bd15-7cd358c14f7b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -11431,7 +11321,7 @@ { "listen": "test", "script": { - "id": "aed618d6-29e4-4bd7-928c-8170d41faa74", + "id": "82a1b043-02fa-443f-9f74-7720e195c5b5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11480,7 +11370,7 @@ { "listen": "test", "script": { - "id": "38fb700d-778d-4077-91b7-5b57baa850ae", + "id": "009e543f-b3c8-4cfc-ba6a-5892fd162e3f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11529,7 +11419,7 @@ { "listen": "test", "script": { - "id": "9cd807f1-fb83-48d3-bbde-e00c8d96ebf5", + "id": "11068050-84f6-4310-b52a-c3e041009c4e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11574,7 +11464,7 @@ { "listen": "test", "script": { - "id": "4a2a41aa-621d-424c-8f2d-5c8ea241b8ec", + "id": "6b443f79-8f5c-4bce-aad0-db2ba133e667", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11619,7 +11509,7 @@ { "listen": "test", "script": { - "id": "f0d625fc-937b-4004-96e1-9f4704283ea8", + "id": "f5e2a604-f0ea-4eb6-9582-eceeb1be6313", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11664,7 +11554,7 @@ { "listen": "test", "script": { - "id": "7b8663b4-b140-4187-972f-3d2205896d5d", + "id": "40c75c41-8aab-4578-99fb-e0974f80163b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11717,7 +11607,7 @@ { "listen": "test", "script": { - "id": "8bfa8b54-767b-4617-82d6-31920b9e440c", + "id": "41cc8151-025e-494b-b11f-5461bc6d27eb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11770,7 +11660,7 @@ { "listen": "test", "script": { - "id": "14206cca-c9ce-4abc-bc62-a773ccf14747", + "id": "4656e996-95ea-48ee-a82e-1ce83ce751aa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11827,6 +11717,102 @@ } ], "protocolProfileBehavior": {} + }, + { + "name": "Cleanup", + "item": [ + { + "name": "Delete-ProjectForFollowing", + "event": [ + { + "listen": "test", + "script": { + "id": "ee5ba265-fb38-489c-be9b-a967db1b5b42", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete-UserForFollowing", + "event": [ + { + "listen": "test", + "script": { + "id": "e6b60a71-3c90-4069-9284-7de0be6a83b4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} } ], "auth": { @@ -11853,7 +11839,7 @@ { "listen": "prerequest", "script": { - "id": "27cd2b77-ecf3-44cd-b4ab-eb40f0fcdbf1", + "id": "cc75fbc6-d531-49ca-9e28-f694cfce821f", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11897,7 +11883,7 @@ { "listen": "test", "script": { - "id": "0a2e5a58-b3d9-4f1a-9d62-d3a31efa8d00", + "id": "a9317531-005e-48bf-81bb-172dcf97abe8", "type": "text/javascript", "exec": [ "" diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 73edc07e..a0cd96b1 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "536afbc3-3e38-4fdb-9b5a-df4194d8181b", + "id": "59f25c69-2a80-458b-b7f6-c0c1ecef3705", "name": "Local", "values": [ { @@ -34,12 +34,12 @@ }, { "key": "projectId", - "value": "24", + "value": 146, "enabled": true }, { "key": "userName", - "value": "Developer", + "value": "postmantest_username_updated", "enabled": true }, { @@ -49,7 +49,7 @@ }, { "key": "projectName", - "value": "postmantest_projectname", + "value": "postmantest_projectname_updated", "enabled": true }, { @@ -59,7 +59,7 @@ }, { "key": "accessToken", - "value": "", + "value": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImU4VW1OX2NmZlBoamVPQ3hCSkZpb2ciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MDQwNjM2NTQsImV4cCI6MTYwNDA2NzI1NCwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwNSIsImF1ZCI6ImRleC1hcGkiLCJjbGllbnRfaWQiOiJkZXgtYXBpLWNsaWVudCIsImNsaWVudF9yb2xlIjoiQmFja2VuZEFwcGxpY2F0aW9uIiwic2NvcGUiOlsiRW1iZWRSZWFkIiwiRW1iZWRXcml0ZSIsIkhpZ2hsaWdodFJlYWQiLCJIaWdobGlnaHRXcml0ZSIsIlByb2plY3RSZWFkIiwiUHJvamVjdFdyaXRlIiwiVXNlclJlYWQiLCJVc2VyV3JpdGUiXX0.07XTY6GQHG-7MTh3cTTl5UTztizp2dkA2QegM74sUTLI6W7BCP5imB15mozBELd4HMGMYSrQYCR4zASG2_Z4T466j6BAfg1zhPTTk41ISoCF1VvMCX62NM3c5ZvvjHN2BXFt_tLDvQimI3Agi5LZqueO31BcZI5ik3t6g7e9TB4sHJRXiy0FmdNkPoWAhyii3ry8ZKWOOzXFasOx-ey3WOi5qM9nCPoLoN2ZFhUeyzItHoagblOuS3BxygurReadXETtl8jq91uye1qGYndMMSwaqNvR4C8UthXvEGKvKDzZID7f6qH2UGfbk0claPlB9WyroMl_b-wRoM11hmUM0w", "enabled": true }, { @@ -79,32 +79,32 @@ }, { "key": "roleId", - "value": "1", + "value": 61, "enabled": true }, { "key": "highlightId", - "value": "1", + "value": 114, "enabled": true }, { "key": "embedGuid", - "value": "", + "value": "2caa2937-6092-4cf7-b534-8ebeb412f5c2", "enabled": true }, { "key": "embeddedProjectId", - "value": "", + "value": 146, "enabled": true }, { "key": "highlightStartDate", - "value": "", + "value": null, "enabled": true }, { "key": "highlightEndDate", - "value": "", + "value": null, "enabled": true }, { @@ -119,7 +119,7 @@ }, { "key": "current_timestamp", - "value": "", + "value": "2020-10-30T13:14:11.098Z", "enabled": true }, { @@ -134,7 +134,7 @@ }, { "key": "future_timestamp", - "value": "", + "value": "2020-11-01T13:14:10.678Z", "enabled": true }, { @@ -149,22 +149,22 @@ }, { "key": "adminProjectId", - "value": "", + "value": 145, "enabled": true }, { "key": "adminEmbedGuid", - "value": "", + "value": "cf70bef3-fb2a-4967-b467-b0add8d22d35", "enabled": true }, { "key": "adminHighlightId", - "value": "", + "value": 115, "enabled": true }, { "key": "PrUserId", - "value": "", + "value": 17, "enabled": true }, { @@ -174,51 +174,51 @@ }, { "key": "otherEmbedGuid", - "value": "", + "value": "cbc8a9e2-d64c-4694-a7f0-39cbbf298f78", "enabled": true }, { "key": "otherEmbeddedProjectId", - "value": "", + "value": 145, "enabled": true }, { "key": "createdUserId", - "value": "", + "value": 133, "enabled": true }, { "key": "administratorUserId", - "value": "", + "value": 1, "enabled": true }, { "key": "registeredUserId", - "value": "", + "value": 36, "enabled": true }, { "key": "createdUserIdentityId", - "value": "", + "value": "999", "enabled": true }, { "key": "identityId", - "value": "", + "value": 133, "enabled": true }, { "key": "userIdToFollow", - "value": "25", + "value": 131, "enabled": true }, { "key": "projectIdToFollow", - "value": "3", + "value": 141, "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-10-26T16:12:46.005Z", + "_postman_exported_at": "2020-10-30T13:14:55.031Z", "_postman_exported_using": "Postman/7.34.0" } \ No newline at end of file From 827728f36f05fa67e42acd0fbab44fb067391e2d Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 30 Oct 2020 14:25:32 +0100 Subject: [PATCH 117/157] refactored requested summary changes --- API/Controllers/FileController.cs | 8 ++++---- API/Extensions/AllowedExtensionsAttribute.cs | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 672571cd..837a5477 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -52,7 +52,7 @@ public class FileController : ControllerBase /// The file service. /// The mapper. /// The User service - /// /// The file uploader extension + /// The file uploader extension public FileController(IFileService fileService, IMapper mapper, IFileUploader fileUploader, IUserService userService) { this.fileService = fileService; @@ -62,7 +62,7 @@ public FileController(IFileService fileService, IMapper mapper, IFileUploader fi } /// - /// Get all files + /// This method is responsible for retrieving all files /// /// A response and list of files. /// This endpoint returns all projects. @@ -77,9 +77,9 @@ public async Task GetFilesAsync() } /// - /// Uploads a single file + /// This method is responsible for uploading a file /// - /// HTTP Response + /// This methods return status code 200 /// This endpoint returns all files. /// The 400 bad request is returned when a file is null. [HttpPost] diff --git a/API/Extensions/AllowedExtensionsAttribute.cs b/API/Extensions/AllowedExtensionsAttribute.cs index 31e35604..15a4e75b 100644 --- a/API/Extensions/AllowedExtensionsAttribute.cs +++ b/API/Extensions/AllowedExtensionsAttribute.cs @@ -67,7 +67,5 @@ public string FileIsNullError() { return "File is null"; } - - } } From b5b91e250432596e5a498e4a94a322379cc16878 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 11:09:34 +0100 Subject: [PATCH 118/157] Improved seeding of data --- API/Startup.cs | 8 ++++---- Data/Helpers/Seed.cs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/API/Startup.cs b/API/Startup.cs index e7e457fa..42c82392 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -354,6 +354,10 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment if(!env.IsProduction()) { + // Seed institutions + context.Institution.Add(Seed.SeedInstitution()); + context.SaveChanges(); + //Seed random users context.User.Add(Seed.SeedPrUser(roles)); context.User.AddRange(Seed.SeedUsers(roles)); @@ -364,10 +368,6 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment if(!env.IsProduction()) { - // Seed institutions - context.Institution.Add(Seed.SeedInstitution()); - context.SaveChanges(); - if(!context.Project.Any()) { //Seed projects diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 30b559ff..98fd9a69 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -170,7 +170,8 @@ public static User SeedDataOfficerUser(List roles) IdentityId = "954654861", Email = "dataofficer@dex.software", Name = "data officer Sam", - Role = dataOfficerRole + Role = dataOfficerRole, + InstitutionId = 1 }; return user; From f0f2d0731dc8f56da06efab6f690765ea964e5da Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 11:10:07 +0100 Subject: [PATCH 119/157] Updated data officer permissions --- API/Controllers/EmbedController.cs | 5 +---- API/Controllers/UserController.cs | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/API/Controllers/EmbedController.cs b/API/Controllers/EmbedController.cs index 1770841e..4159b013 100644 --- a/API/Controllers/EmbedController.cs +++ b/API/Controllers/EmbedController.cs @@ -186,10 +186,7 @@ public async Task CreateEmbeddedProject(EmbeddedProjectResource e string identity = HttpContext.User.GetIdentityId(HttpContext); User user = await userService.GetUserByIdentityIdAsync(identity); - bool isAllowed = await authorizationHelper.UserIsAllowed(user, - nameof(Defaults.Scopes.EmbedWrite), - nameof(Defaults.Scopes.InstitutionEmbedWrite), - project.UserId); + bool isAllowed = userService.UserHasScope(identity, nameof(Defaults.Scopes.EmbedWrite)); if(!(project.UserId == user.Id || isAllowed)) { diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 1a809b97..18a4b1a1 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -154,14 +154,17 @@ public async Task GetUser(int userId) public async Task CreateAccountAsync([FromBody] UserResource accountResource) { User user = mapper.Map(accountResource); - Role registeredUserRole = (await roleService.GetAll()).FirstOrDefault(i => i.Name == nameof(Defaults.Roles.RegisteredUser)); + Role registeredUserRole = + (await roleService.GetAll()).FirstOrDefault(i => i.Name == nameof(Defaults.Roles.RegisteredUser)); user.Role = registeredUserRole; try { userService.Add(user); userService.Save(); - return Created(nameof(CreateAccountAsync), await GetUser(user.Id)); + UserResourceResult model = + mapper.Map(await userService.GetUserAsync(user.Id)); + return Created(nameof(CreateAccountAsync), model); } catch(DbUpdateException e) { Log.Logger.Error(e, "Database exception"); From 50bda2f670f71072c70ca950bb5f9b8db914d114 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 13:04:23 +0100 Subject: [PATCH 120/157] Added institution id to developer seed account --- API/Startup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/API/Startup.cs b/API/Startup.cs index 42c82392..dedf69dc 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -295,7 +295,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) Name = "Developer", Email = "Developer@DEX.com", IdentityId = identityId, - Role = registeredUserRole + Role = registeredUserRole, + InstitutionId = 1 }; userService.Add(newUser); } else From c9bfe845f264f6cbaf79fad8b35fbdb3c006817a Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 13:04:47 +0100 Subject: [PATCH 121/157] Updated postman environment --- Postman/local.postman_environment.json | 51 ++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 1cef8dfa..a2d06269 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "b231668b-0723-406d-bba1-f394034ad801", + "id": "ee2df9ab-bda5-45e1-950b-bbb671ade844", "name": "Local", "values": [ { @@ -206,9 +206,54 @@ "key": "identityId", "value": "", "enabled": true + }, + { + "key": "dataOfficerUserIdentityId", + "value": "", + "enabled": true + }, + { + "key": "dataOfficerUserId", + "value": "", + "enabled": true + }, + { + "key": "institutionName", + "value": "TestInstitution", + "enabled": true + }, + { + "key": "institutionIdFromUser", + "value": "", + "enabled": true + }, + { + "key": "updatedInstitutionName", + "value": "UpdatedTestInstitution", + "enabled": true + }, + { + "key": "createdUserWithInstitutionId", + "value": "", + "enabled": true + }, + { + "key": "createdInstitutionId", + "value": "", + "enabled": true + }, + { + "key": "projectIdWithInstitution", + "value": "", + "enabled": true + }, + { + "key": "embedGuidWithInstitution", + "value": "", + "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-06-10T15:45:45.966Z", - "_postman_exported_using": "Postman/7.26.0" + "_postman_exported_at": "2020-10-31T12:03:28.870Z", + "_postman_exported_using": "Postman/7.35.0" } \ No newline at end of file From a12c18a0b8a1c3bf14c3eb3e18309c7f96b1775b Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 13:14:14 +0100 Subject: [PATCH 122/157] Added check for institution id when creating user --- API/Controllers/UserController.cs | 37 +++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 18a4b1a1..1ecbbb68 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -44,6 +44,7 @@ public class UserController : ControllerBase private readonly IUserService userService; private readonly IRoleService roleService; private readonly IAuthorizationHelper authorizationHelper; + private readonly IInstitutionService institutionService; /// /// Initializes a new instance of the class @@ -55,12 +56,14 @@ public class UserController : ControllerBase public UserController(IUserService userService, IMapper mapper, IRoleService roleService, - IAuthorizationHelper authorizationHelper) + IAuthorizationHelper authorizationHelper, + IInstitutionService institutionService) { this.userService = userService; this.mapper = mapper; this.roleService = roleService; this.authorizationHelper = authorizationHelper; + this.institutionService = institutionService; } /// @@ -146,13 +149,43 @@ public async Task GetUser(int userId) /// The account resource which is used for creating the account. /// This method returns the created user as user resource result. /// This endpoint returns the created user. - /// The 400 Bad Request status code is return when saving the user to the database failed. + /// The 400 Bad Request status code is return when the institution id is invalid + /// or when saving the user to the database failed. + /// The institution with the specified institution id could not be found. [HttpPost] [Authorize(Policy = nameof(Defaults.Scopes.UserWrite))] [ProducesResponseType(typeof(UserResourceResult), (int) HttpStatusCode.Created)] [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task CreateAccountAsync([FromBody] UserResource accountResource) { + if(accountResource.InstitutionId != null) + { + int institutionId = accountResource.InstitutionId.Value; + if(institutionId < 1) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting institution.", + Detail = "The id of an institution can't be smaller than 1", + Instance = "7C50A0D7-459D-473B-9ADE-7FC5B7EEE39E" + }; + return BadRequest(problem); + } + + Institution foundInstitution = await institutionService.FindAsync(institutionId); + if(foundInstitution == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting institution.", + Detail = "The institution could not be found in the database.", + Instance = "6DECDE32-BE44-43B1-9DDD-4D14AE9CE731" + }; + return NotFound(problem); + } + } + User user = mapper.Map(accountResource); Role registeredUserRole = (await roleService.GetAll()).FirstOrDefault(i => i.Name == nameof(Defaults.Roles.RegisteredUser)); From 8a6ab894e012d040de8bf2898fc9f18fdbe8553c Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 13:14:57 +0100 Subject: [PATCH 123/157] Added documentation for the institution service in the constructor --- API/Controllers/UserController.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 1ecbbb68..6205a4bd 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -52,6 +52,7 @@ public class UserController : ControllerBase /// The user service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. /// The role service which is used to communicate with the logic layer. + /// The institution service which is used to communicate with the logic layer. /// The authorization helper which is used to communicate with the authorization helper class. public UserController(IUserService userService, IMapper mapper, From 06a6bce7b55b6bc861aadc30f0a6d0d8b5a49848 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 15:22:39 +0100 Subject: [PATCH 124/157] Added institution id check for httpput --- API/Controllers/UserController.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 6205a4bd..ead9d82f 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -229,6 +229,33 @@ public async Task CreateAccountAsync([FromBody] UserResource acco [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task UpdateAccount(int userId, [FromBody] UserResource userResource) { + if(userResource.InstitutionId != null) + { + int institutionId = userResource.InstitutionId.Value; + if(institutionId < 1) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting institution.", + Detail = "The id of an institution can't be smaller than 1", + Instance = "7C50A0D7-459D-473B-9ADE-7FC5B7EEE39E" + }; + return BadRequest(problem); + } + + Institution foundInstitution = await institutionService.FindAsync(institutionId); + if(foundInstitution == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting institution.", + Detail = "The institution could not be found in the database.", + Instance = "6DECDE32-BE44-43B1-9DDD-4D14AE9CE731" + }; + return NotFound(problem); + } + } + User currentUser = await HttpContext.GetContextUser(userService).ConfigureAwait(false); bool isAllowed = userService.UserHasScope(currentUser.IdentityId, nameof(Defaults.Scopes.UserWrite)); From 3ecc604cc8405c9b956df9ab6a9e5e8c71e46c7c Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 15:22:52 +0100 Subject: [PATCH 125/157] Updated Seed.cs documentation --- Data/Helpers/Seed.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 98fd9a69..2362db92 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -137,10 +137,10 @@ public static User SeedAdminUser(List roles) public static Institution SeedInstitution() { Institution institution = new Institution - { - Name = "Fontys", - Description = "Description for Fontys" - }; + { + Name = "Fontys", + Description = "Description for Fontys" + }; return institution; } /// @@ -161,7 +161,11 @@ public static User SeedPrUser(List roles) return user; } - + /// + /// This method seeds the data officer user. + /// + /// This variable contains the roles that exist. + /// This method returns the data officer role that will be seeded. public static User SeedDataOfficerUser(List roles) { Role dataOfficerRole = roles.Find(role => role.Name == nameof(Defaults.Roles.DataOfficer)); From 7f68078c6ef10c69ed9eebab60fa2f4716b26c9d Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 15:55:16 +0100 Subject: [PATCH 126/157] Created postman tests --- API/Controllers/UserController.cs | 20 +- Postman/dex.postman_collection.json | 7928 +++++++++++++++++++++------ 2 files changed, 6148 insertions(+), 1800 deletions(-) diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index ead9d82f..c4f7ea20 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -235,11 +235,11 @@ public async Task UpdateAccount(int userId, [FromBody] UserResour if(institutionId < 1) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting institution.", - Detail = "The id of an institution can't be smaller than 1", - Instance = "7C50A0D7-459D-473B-9ADE-7FC5B7EEE39E" - }; + { + Title = "Failed getting institution.", + Detail = "The id of an institution can't be smaller than 1", + Instance = "7C50A0D7-459D-473B-9ADE-7FC5B7EEE39E" + }; return BadRequest(problem); } @@ -247,11 +247,11 @@ public async Task UpdateAccount(int userId, [FromBody] UserResour if(foundInstitution == null) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed getting institution.", - Detail = "The institution could not be found in the database.", - Instance = "6DECDE32-BE44-43B1-9DDD-4D14AE9CE731" - }; + { + Title = "Failed getting institution.", + Detail = "The institution could not be found in the database.", + Instance = "6DECDE32-BE44-43B1-9DDD-4D14AE9CE731" + }; return NotFound(problem); } } diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index f7962458..9281e4b6 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "d966821e-c2c1-4141-95f8-c68bed18d147", + "_postman_id": "b3512cae-ecd6-4f18-9da9-20007d67e145", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "8a281130-f542-40c2-ac95-830764b35a9a", + "id": "568853cf-d095-4e3b-bce6-72b90efb8d7f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "4cfeb7f7-1bcb-45be-80a2-3be07f7f749b", + "id": "a74ba107-101e-4611-8999-551342ce3262", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -134,7 +134,7 @@ { "listen": "test", "script": { - "id": "f7246186-09d4-4f5e-aa6b-562e0e1a2114", + "id": "d3679468-0b5a-4345-b7c7-211dbde99c64", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -203,7 +203,7 @@ { "listen": "test", "script": { - "id": "4c091125-b033-48fa-8f82-0899f43886f1", + "id": "d3a0ba96-eaa4-41f4-a725-76d56ac959ad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -271,7 +271,7 @@ { "listen": "test", "script": { - "id": "5ca9a7f8-2ffc-4dcb-b757-6fa7891f695a", + "id": "d16a4918-c6a2-4e5f-a6b4-31cf93cdf800", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -339,7 +339,7 @@ { "listen": "test", "script": { - "id": "c043a329-9250-475c-8ef2-ee4dcb173ab3", + "id": "39437434-f1e4-4ea3-8d6d-f46c086588fc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -414,7 +414,7 @@ { "listen": "test", "script": { - "id": "e43af50b-ca0e-49bc-9ea0-0267175fb6a5", + "id": "498207f3-e29a-4de0-b17e-93e3e1c9a834", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -479,7 +479,7 @@ { "listen": "test", "script": { - "id": "6d6bf1a0-546a-4493-9923-de5b3a3d4c88", + "id": "7c525034-1ea2-4c1b-9c9d-ddd6ebae5808", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -557,7 +557,7 @@ { "listen": "test", "script": { - "id": "bf64aa0a-243e-4280-aa48-bda08e315e99", + "id": "db03d8c3-1d72-421b-957e-0101a0486f60", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -630,7 +630,7 @@ { "listen": "test", "script": { - "id": "99db0a70-a1e1-4c62-a25e-3ae95e3b4f44", + "id": "be9bf4cf-3f51-4c4d-aba1-08ce2a6c0ee4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -699,7 +699,7 @@ { "listen": "test", "script": { - "id": "f4f8c3c6-914b-4b60-8de0-9f8c7df4e2f0", + "id": "b1c189e9-2ddd-411a-aec3-2de2e49aafb2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -767,7 +767,7 @@ { "listen": "test", "script": { - "id": "89d52f12-b9d9-42c8-8488-7d89ace91d85", + "id": "29b03f03-90c0-4219-aee3-c06fd94abdaa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -835,7 +835,7 @@ { "listen": "test", "script": { - "id": "f01996d4-163c-49a2-b798-f8c632cb7cff", + "id": "fe12c976-14c4-4950-ab77-7a8ed8dfb8c0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -895,7 +895,7 @@ { "listen": "test", "script": { - "id": "89033d6f-92af-49e9-82f5-acd8300cd9c6", + "id": "32248fcd-b305-4b8d-9ebb-e239e685705b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -924,7 +924,7 @@ { "listen": "prerequest", "script": { - "id": "54b7bc62-ce4f-4bae-8f63-1801794ea741", + "id": "b83bc5e6-e276-4714-8a11-2a49b53f47c2", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -974,7 +974,7 @@ { "listen": "test", "script": { - "id": "354ed286-3511-4461-9235-bbe948c93d87", + "id": "e4fe8480-a165-4abe-a820-ca4ddeedf53c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1043,7 +1043,7 @@ { "listen": "test", "script": { - "id": "f0c8df4a-36c8-4365-ab03-1764fc945c86", + "id": "22f8a2c4-ec7b-4814-b41a-964a26b3314b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1105,7 +1105,7 @@ { "listen": "test", "script": { - "id": "5281a651-58a4-4936-acb8-55e8e1a7275e", + "id": "6cf43faf-159b-4011-bf77-10cb48f82010", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1192,7 +1192,7 @@ { "listen": "test", "script": { - "id": "b68a3468-6f1c-4a53-81cf-6bb4f8d10cab", + "id": "40d96fc0-6f5d-435d-9592-480a0c16c328", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1224,7 +1224,7 @@ { "listen": "prerequest", "script": { - "id": "6ff05167-fb71-4ebb-baf1-afc72597c209", + "id": "c70d1815-5c77-44fa-a097-b1db232e77cc", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1271,7 +1271,7 @@ { "listen": "test", "script": { - "id": "1563eb01-9b96-4f70-add5-9a934bc4c6d7", + "id": "84027fd3-342a-462d-922d-bd5dd289c6ca", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1330,7 +1330,7 @@ { "listen": "test", "script": { - "id": "67312526-2ee6-4c29-b522-2599a86e63a4", + "id": "23339c58-61b0-4222-b563-c09e3f4a4d9b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1391,7 +1391,7 @@ { "listen": "test", "script": { - "id": "4e63a512-8252-430f-8c7a-61d7584ecf90", + "id": "d41caa39-845e-4a55-bd72-b81e67a4dbda", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1455,7 +1455,7 @@ { "listen": "test", "script": { - "id": "4cc6baec-c21e-4e6b-8c62-46c4896ae6f6", + "id": "cfef8aba-4a7d-4c42-90a5-05351fda33e4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1524,7 +1524,7 @@ { "listen": "test", "script": { - "id": "10695bd8-4094-4904-9d2e-bbf11c4d43b2", + "id": "a4373a0d-2e9b-4611-876c-59a22338dc64", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1582,7 +1582,7 @@ { "listen": "test", "script": { - "id": "5ca4c5b0-0eb4-41a3-8e2a-1169d8692ba4", + "id": "7b47898e-b22f-4dce-983b-3c344342d2d7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1636,7 +1636,7 @@ { "listen": "test", "script": { - "id": "59718376-225e-47ea-880b-0481e4fbe306", + "id": "5fbf8c98-fb9a-41df-8ef5-4bae0faab079", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1697,7 +1697,7 @@ { "listen": "test", "script": { - "id": "7f6bc89c-4e09-4f04-90bd-0d33328d20c1", + "id": "84cc7913-5f49-4698-b5ad-63b5ff08fbe8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -1770,7 +1770,7 @@ { "listen": "test", "script": { - "id": "83d352bb-535f-44e5-b226-964478eb792b", + "id": "e8322644-7e18-41a2-8626-490688ef59ff", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -1843,7 +1843,7 @@ { "listen": "test", "script": { - "id": "782d4c40-595b-4d1e-a7ff-5438d64df3e3", + "id": "11677dc5-2c53-49a0-9dc9-7f2c26e47029", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1909,7 +1909,7 @@ { "listen": "test", "script": { - "id": "5f7cb285-cb57-4527-8ddf-583573dfff94", + "id": "a31f483b-471b-49cb-acd7-3b0a011db464", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -1968,7 +1968,7 @@ { "listen": "test", "script": { - "id": "b50cc0f5-0124-4335-b3de-c17f30b418cb", + "id": "bfd77a49-5900-42da-890f-25d6db2d90f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2035,7 +2035,7 @@ { "listen": "test", "script": { - "id": "e54c842f-950f-4b32-83e1-143f3ffe394a", + "id": "a8aab8c4-8442-4c84-9f13-8e7ce80c4404", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2093,7 +2093,7 @@ { "listen": "test", "script": { - "id": "da0ab18f-4756-4e33-b9a0-568f861ddc87", + "id": "1de15b3f-6c1b-41cd-b784-b86ad7f8b9c3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2172,7 +2172,7 @@ { "listen": "test", "script": { - "id": "2552d2f6-dde7-4771-84c8-56cb4f465e28", + "id": "f82c7f67-7335-449e-a617-186e32417ce3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2230,7 +2230,7 @@ { "listen": "test", "script": { - "id": "b31254fc-00ca-4329-a51e-c75de54c03bf", + "id": "73037dd6-71f3-4379-8b07-b9bc1e129e54", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2291,7 +2291,7 @@ { "listen": "test", "script": { - "id": "567c1995-a7c9-4dd8-b8c7-be0b34032e6b", + "id": "ad5c91ae-d6c8-4eca-9265-7f8f76621383", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2357,7 +2357,7 @@ { "listen": "test", "script": { - "id": "dab8fa0d-f42d-467a-ac2b-cfb4a553ebf0", + "id": "bb76435f-c28b-4291-b0b1-b6215c21774e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2415,24 +2415,39 @@ "_postman_isSubFolder": true }, { - "name": "Cleanup", + "name": "Institution", "item": [ { - "name": "Embed-DeleteEmbed-Administrator", + "name": "Institution-CreateInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "6e7a7edf-2be7-4f34-b416-51d4d9be2277", + "id": "ec449042-6ddf-49b1-8ce3-09d352bf9e7e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var institutionName = pm.environment.get(\"institutionName\");", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdInstitutionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -2440,7 +2455,7 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [ { "key": "IdentityId", @@ -2448,29 +2463,41 @@ "value": "{{administratorUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Institution", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "Institution" ] } }, "response": [] }, { - "name": "Highlight-DeleteHighlight-Administrator", + "name": "Institution-GetInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "89704a60-90a6-4c23-a39b-0d6b61e1ca29", + "id": "e9d649e8-c9e3-4d4b-9317-6fac21ccedb4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", + "var institutionName = pm.environment.get(\"institutionName\");", + "", + "var jsonData = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", @@ -2478,6 +2505,20 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Id matches: \" + createdInstitutionId, function () {", + " pm.expect(jsonData.id).to.eql(createdInstitutionId);", + "});", + "", + "pm.test(\"Check previously created UserName with id \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -2485,7 +2526,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [ { "key": "IdentityId", @@ -2494,28 +2535,32 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] }, { - "name": "Project-DeleteProject-Administrator", + "name": "Institution-UpdateInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "81e5958d-9651-4b01-8238-8e9c39340e1b", + "id": "43216e86-a81f-48ee-a766-9530f7c35507", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var institutionName = pm.environment.get(\"updatedInstitutionName\");", + "pm.environment.set(\"institutionName\", institutionName);", + "", + "var jsonData = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", @@ -2523,6 +2568,16 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Institution Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -2530,7 +2585,7 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [ { "key": "IdentityId", @@ -2538,36 +2593,63 @@ "value": "{{administratorUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedInstitutionName}}\",\r\n \"description\": \"postmantest_updated_description\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] }, { - "name": "Role-DeleteRole-WithUsers-Administrator", + "name": "Institution-GetUpdatedInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "6e78d055-61ef-4126-87f1-1cc254c0829c", + "id": "a2076029-2e34-4163-b6b8-f73711ec837c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", + "var institutionName = pm.environment.get(\"institutionName\")", "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Institution Id matches: \" + createdInstitutionId, function () {", + " pm.expect(jsonData.id).to.eql(createdInstitutionId);", + "});", + "", + "pm.test(\"Check if updated institution matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -2575,7 +2657,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [ { "key": "IdentityId", @@ -2584,26 +2666,40 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "Institution", + "{{createdInstitutionId}}" + ], + "query": [ + { + "key": "", + "value": "", + "disabled": true + } ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Cleanup", + "item": [ { - "name": "User-DeleteUser-Administrator", + "name": "Embed-DeleteEmbed-Administrator", "event": [ { "listen": "test", "script": { - "id": "323fdd07-91c3-4c27-a3b5-04c4f321cf52", + "id": "5cf1d90a-7368-4132-862a-00c811b2b508", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2629,26 +2725,26 @@ } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Embed", + "{{embedGuid}}" ] } }, "response": [] }, { - "name": "Role-DeleteRole-Administrator", + "name": "Highlight-DeleteHighlight-Administrator", "event": [ { "listen": "test", "script": { - "id": "39dd3502-e238-4765-8900-569d14248854", + "id": "42f54bc9-ec9e-4eaf-80f2-f0f44d982df8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2674,44 +2770,31 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "Highlight", + "{{highlightId}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Checkup-on-Cleanup", - "item": [ + }, { - "name": "Project-Get-Deleted-Project-Administrator", + "name": "Project-DeleteProject-Administrator", "event": [ { "listen": "test", "script": { - "id": "dd682a0b-5ac4-4fe6-befb-2e9d51df3d13", + "id": "dbd0c2a3-2e3e-44e4-a17f-01c8cd01bf45", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -2723,7 +2806,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -2746,23 +2829,17 @@ "response": [] }, { - "name": "User-Get-Deleted-User-Administrator", + "name": "Institution-DeleteInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "d38e6e15-5154-40e6-bada-091e0162394f", + "id": "3a5b32f1-8ee3-4671-8f29-4c11e5866442", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -2774,7 +2851,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -2783,37 +2860,31 @@ } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] }, { - "name": "Role-Get-Deleted-Role-Administrator", + "name": "Role-DeleteRole-WithUsers-Administrator", "event": [ { "listen": "test", "script": { - "id": "95770773-0671-4bd2-9551-a2c70627ab61", + "id": "fef623fa-7285-49f7-8e07-643d910e2cf2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -2825,7 +2896,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -2848,23 +2919,17 @@ "response": [] }, { - "name": "Embed-Get-Deleted-Embed-Administrator", + "name": "User-DeleteUser-Administrator", "event": [ { "listen": "test", "script": { - "id": "72e1ef55-3abb-4f58-84c7-453d372c3462", + "id": "2ab1d274-475c-484f-b79f-4e589c9c7b8a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -2876,7 +2941,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -2885,37 +2950,31 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "Highlight-Get-Deleted-Highlight-Administrator", + "name": "Role-DeleteRole-Administrator", "event": [ { "listen": "test", "script": { - "id": "b313b920-02a8-4fa7-9e0c-a8cab12021c2", + "id": "0d96120a-3df6-44fe-8c58-1c1f4151f7de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -2927,7 +2986,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -2936,14 +2995,14 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Role", + "{{roleId}}" ] } }, @@ -2952,58 +3011,32 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Guest", - "item": [ + }, { - "name": "Preparation", + "name": "Checkup-on-Cleanup", "item": [ { - "name": "Project-CreateProject", + "name": "Project-Get-Deleted-Project-Administrator", "event": [ { "listen": "test", "script": { - "id": "3f2a6427-a4e5-46f7-8f79-8987b214301e", + "id": "d0743633-0349-4cde-94e3-af7fdecfec08", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectId\", jsonData.id);", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", "});" ], "type": "text/javascript" @@ -3011,7 +3044,7 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -3019,51 +3052,38 @@ "value": "{{administratorUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "Highlight-CreateHighlight", + "name": "User-Get-Deleted-User-Administrator", "event": [ { "listen": "test", "script": { - "id": "dc6ad832-e44d-4d97-9bde-4b1d9265fa5c", + "id": "99c5e7d5-981d-4ccc-964f-7827267402cf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3072,25 +3092,10 @@ ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "id": "4e9fe140-499d-4959-b230-ac52ff832f96", - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -3098,51 +3103,38 @@ "value": "{{administratorUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "Embed-CreateEmbed", + "name": "Role-Get-Deleted-Role-Administrator", "event": [ { "listen": "test", "script": { - "id": "3e33e84f-79d9-434e-a397-f2dae15bf62c", + "id": "568de2a1-82a9-47b8-b006-09e36f4a8bdd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3154,7 +3146,7 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -3162,78 +3154,38 @@ "value": "{{administratorUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Role", + "{{roleId}}" ] } }, "response": [] - } - ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0cc7c10a-ff87-40da-be27-e305d4e959cb", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "40674f04-86c3-4602-bb31-2558c8d99934", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-Guest", + "name": "Embed-Get-Deleted-Embed-Administrator", "event": [ { "listen": "test", "script": { - "id": "002fb974-0a55-4e2d-a259-e0c0dc2c8c42", + "id": "1321254d-c67d-409d-8b15-d35e754279d8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3245,57 +3197,50 @@ } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" } - }, + ], "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "Embed", + "{{embedGuid}}" ] } }, "response": [] }, { - "name": "User-GetUser-Guest", + "name": "Highlight-Get-Deleted-Highlight-Administrator", "event": [ { "listen": "test", "script": { - "id": "4b34a76b-addf-4b93-9aad-c22e36a47644", + "id": "158001e1-cba7-4f2c-8476-73774d13231a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3303,49 +3248,50 @@ } ], "request": { - "auth": { - "type": "noauth" - }, "method": "GET", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "1" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Guest", + "name": "Institution-Get-Deleted-Institution-Administrator", "event": [ { "listen": "test", "script": { - "id": "86081a47-5eb5-464b-9b85-de9fb03c20cc", + "id": "af0f614e-fb8f-45bc-b4e4-e209a6813314", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3353,90 +3299,270 @@ } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" } - }, + ], "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "1" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] - }, - { - "name": "User-DeleteUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "id": "953fc639-fc06-4e5c-bd7f-52626ea157d8", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Guest", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "Project-CreateProject", + "event": [ + { + "listen": "test", + "script": { + "id": "0c0c6596-b713-4570-8bc4-44f5b731447c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "id": "97c40e04-aac0-4dfc-ae46-fb71622409de", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.success;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "id": "0a7a4b5e-079e-4624-b79e-9f3878ce1ce2", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } } ], "request": { - "method": "DELETE", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "1" + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed", + "event": [ + { + "listen": "test", + "script": { + "id": "66976c67-07a1-4148-9a01-111e65aadef6", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" ] } }, "response": [] } ], - "auth": { - "type": "noauth" - }, + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", "event": [ { "listen": "prerequest", "script": { - "id": "626b1ed8-d329-4685-82fa-d2ac48cd3292", + "id": "8d93ee50-ff46-4c72-b214-dc139e6f3ea1", "type": "text/javascript", "exec": [ "" @@ -3446,7 +3572,7 @@ { "listen": "test", "script": { - "id": "024365b5-302d-4145-b645-20f872931b86", + "id": "a2c49225-a7d9-4821-90a0-34e2f7c58ddb", "type": "text/javascript", "exec": [ "" @@ -3458,15 +3584,15 @@ "_postman_isSubFolder": true }, { - "name": "Project", + "name": "User", "item": [ { - "name": "Project-CreateProject-Guest", + "name": "User-CreateUser-Guest", "event": [ { "listen": "test", "script": { - "id": "422f0505-9c83-4cbe-81d5-af3a95ed70d2", + "id": "763389a0-5666-497e-8ce9-997a415e63d6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3476,17 +3602,15 @@ " pm.response.to.have.status(401);", "});", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "" + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" ], "type": "text/javascript" } @@ -3500,71 +3624,4112 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", "options": { "raw": { "language": "json" } } - }, + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "affe213e-50f6-48bf-b695-63f1bd343a05", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "30da528a-89b4-4cb1-8b31-cb17c543ca0f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "91d4357b-a0f7-433d-ab6a-3dd8058c74b8", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "7e81fa6d-9ffb-4d38-9727-ebb2ed80f60f", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "4bca4c06-e14d-400c-b104-6007cf228bad", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "efe0804b-a9dd-40dd-aa92-643045e6235a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "d9ae44d6-9a24-44ce-a575-31883f0eaa9f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "b9b2cb24-c591-48fe-b82f-25712b1355e5", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "08b37e12-1335-4d8c-93e3-9716268ac01c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "eff4dc08-f719-4591-84df-ef5e9b6ed2d5", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Project/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "904358ef-5d56-4b02-8197-7706242c53d0", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "4d623819-5c86-4a13-bb39-35a6bc4f6d96", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "1acbfe0d-8bdd-473c-ba19-fdc0e1462d65", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "c46d438e-99f0-436d-b116-5fa37a48683d", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "1f5a87ce-8431-48c4-860e-a55df4fea262", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "4359c796-1d7c-4a3c-9572-4e38047014a5", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "b83a01a5-f205-4850-9568-c29a5b0cd699", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "f2b1ce0c-58c5-4523-b1e0-58f3e192ec23", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "d4264917-3672-48fd-bcb7-ebd1ac0408da", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "b4073b4e-7bf3-49a2-beb0-59e32189133a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "65c4d09a-c093-4cfb-b456-12f592e4948c", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "b5a807a1-e49d-4ce7-9926-e273add34764", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "181d6378-1dd7-4ada-aab7-f26dc2e117c2", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "54cbbdc6-b309-455a-9fde-1925594aae91", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "00ab5074-5846-4aa8-bc07-010b735fe110", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "97acdaa7-13b7-4902-9e4f-955baa14b97c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "a91b7dfc-cbb5-43c1-b7a8-327ca5bf48bd", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "8676df00-9361-483f-b1c0-3bc807667740", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "cdf78829-afba-4fec-8756-7cd46d4a784d", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "5aedaaa6-1900-4ff5-b1ab-8b6607298e92", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "a96dbcae-ad6c-4d26-bbd4-ff18586deaa3", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "37a4b06f-9734-48bb-b792-2c6933406e21", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "cbc9aa2e-bd1a-4407-b225-235463237f15", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "3a93e128-2f5e-48a3-b0cc-052c91232551", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId=1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "1", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "9d25dba5-2dcd-4a11-8287-c653d09f1661", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "93fd5588-3bf3-4275-b5fa-1453203a8aa1", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "a610852b-fbef-4a0f-8f7f-68f8ad25a5a8", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "077df9c1-3744-48c2-87d8-18bf785452ed", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "a5394ee3-96d8-4f42-be9e-2aead5ff385c", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Wizard", + "item": [ + { + "name": "Wizard-GetWizard-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "566d6355-d487-40f9-a4cf-e79d073d48b4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Wizard" + ], + "query": [ + { + "key": "sourceURI", + "value": "{{wizardSourceUri}}", + "description": "This is the URI that the wizard will use to fetch the source." + } + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "329139f5-30f2-45de-8bc5-b60b749479ff", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "10279a00-8a5c-4379-97f6-5f5eef8c3889", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "91e060e8-ddaa-4c7e-aaf1-add0482f3d86", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "489e3de4-5045-4876-9232-a0c5464826de", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "79bd41e1-d47e-4432-a839-6f7ea8698a83", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{institutionName}}\",\r\n \"description\": \"postmantest_initial_description\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "374ece63-fbb5-4d58-b282-a89e17fd8958", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "37272cf8-6e7e-46ec-9d29-5a1805232398", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "83084b33-5da2-4e73-aaea-ad34e0d53856", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "caf35d96-6c2e-4846-b9e6-2baf340f3cef", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "5ab2e293-da9f-4f12-ba80-069e05790dcf", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Registered", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "User-CreateUser", + "event": [ + { + "listen": "test", + "script": { + "id": "d01622a4-6f97-4471-959a-7bf015814685", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"identityId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject", + "event": [ + { + "listen": "test", + "script": { + "id": "cddce38e-5f62-457b-9507-e599884f478c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "id": "311ba597-b48c-4c34-8518-5107ea4cca25", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9569e97d-822a-4855-8211-263649e6b0a3", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed", + "event": [ + { + "listen": "test", + "script": { + "id": "ed5bc65b-9c4e-4b24-a6dd-7a7e5b1d365a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Role-CreateRole", + "event": [ + { + "listen": "test", + "script": { + "id": "f917c6aa-9bbe-4b66-82d4-1cb94ec39c8e", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var scopeName = pm.environment.get(\"scopeName\");", + "var roleName = pm.environment.get(\"roleName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"roleId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", + " pm.expect(jsonData.name).to.eql(roleName);", + "});", + "", + "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", + " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + } + ], + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "3058e1f6-8eac-42ab-a31c-f239fff796a5", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "476b0244-8385-4a05-872f-896b32e61142", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "f3624c3d-6163-4379-913e-5992562cb7b5", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "946710bf-d82a-493f-899c-c445c226ef57", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "9288fcfd-8ebf-41f3-9b4f-07d7ebafad51", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"registeredUserId\", jsonData.id);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "6a21ad86-40cc-47a9-bdab-9c7bc598f255", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{registeredUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "0e38744d-5e92-4a92-be7a-c6fca4b2d455", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "03a3ecb6-3c5f-48de-a77a-bfe2970666e5", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "cc4e4f50-a7f6-41f1-a5b2-cb5a7a6b3267", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "c3023a01-8f19-41d5-af68-c60d974d3735", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var registeredUserId = pm.environment.get(\"registeredUserId\");", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", + " pm.expect(jsonData.user.id).to.eql(registeredUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "676d2c2f-ae2c-4d15-a1d3-02593e62f0eb", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "f96c90b5-8c4d-4682-9941-bdc3af14067a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "789e2fec-ae9d-4a09-a962-bc92311b6139", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "8298c381-928e-499c-93b7-2f14b0dbdc3a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "121f9d73-4a84-41e0-ba5f-124f79e83427", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "5fa8df5a-7643-4dad-8983-eddd67122405", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "8ef5073a-9cb0-478f-b2f9-0d1baf34ece9", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "59010dc5-c53c-45d6-be38-25a5293433ee", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "8065f986-71a3-46af-85d5-769ac77a38ad", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "379dcce8-1326-4caa-a929-f55be3670530", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "77b78bbc-05c7-45fe-9b75-c8e0aaf702e8", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "060f5504-02cd-4630-bc14-f35b7cc08b65", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectId = pm.environment.get(\"adminProjectId\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "02dd708d-c226-4a9a-b1aa-5f726a1d0614", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "f247250e-25f0-4fa8-91fe-8724d0520f9a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "f49bce60-7be5-4a41-875b-db62228cfd78", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "a0e15975-2cd2-4b09-9e2c-23c9068a8de2", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "e20fdfa9-7e06-4664-8d3c-bcf61d770fb3", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "7f41ee44-8ffa-4238-9025-117f45d1e17a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "5a3a2127-0857-40ba-9468-f6f77816f4bb", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "8f74c061-052d-4e43-b27a-a739dd91329e", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "51d1e695-da09-4f81-974d-0bf5c7e915b4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "9786dc0c-883b-4e8d-99f7-94bf46ad751c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "{{projectName}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Wizard", + "item": [ + { + "name": "Wizard-GetWizard-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "4224789a-9618-4d21-9f47-1a2fad0fa288", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "Wizard" + ], + "query": [ + { + "key": "sourceURI", + "value": "{{wizardSourceUri}}", + "description": "This is the URI that the wizard will use to fetch the source." + } ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Institution", + "item": [ { - "name": "Project-GetAllProjects-Guest", + "name": "Institution-CreateInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "2649fae7-e0f3-42af-a7e6-9608515cd2f2", + "id": "6e60604b-2daa-41d5-9d5c-bdc1539a6770", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "pm.test(\"Project name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -3575,36 +7740,44 @@ "auth": { "type": "noauth" }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "User" ] } }, "response": [] }, { - "name": "Project-GetProject-Guest", + "name": "Institution-GetInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "00b9b746-d003-425c-88d1-44035a1e144f", + "id": "189b7378-8446-4b26-a0d0-1eba394821b9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3612,13 +7785,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3632,29 +7801,31 @@ "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "User", + "1" ] } }, "response": [] }, { - "name": "Project-UpdateProject-Guest", + "name": "Institution-UpdateInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "c4e79893-0e60-4037-8eb9-d4161b61a869", + "id": "d77e4fb9-b783-4834-b6bd-290328a07b5b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", @@ -3664,9 +7835,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3681,7 +7852,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", "options": { "raw": { "language": "json" @@ -3689,13 +7860,13 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Project/1", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", + "User", "1" ] } @@ -3703,12 +7874,12 @@ "response": [] }, { - "name": "Project-DeleteProject-Guest", + "name": "Instituiton-DeleteInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "119fb878-8833-4705-97f6-3a4da51bf242", + "id": "0c85da4b-4a83-400f-9a40-324da601a43d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3736,13 +7907,13 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{apiUrl}}/api/Project/1", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", + "User", "1" ] } @@ -3757,7 +7928,7 @@ { "listen": "prerequest", "script": { - "id": "bf33f782-a70a-4f47-b7ed-5b00ba98f175", + "id": "f4ace369-5153-4bff-8cda-1a5a11192ca2", "type": "text/javascript", "exec": [ "" @@ -3767,7 +7938,7 @@ { "listen": "test", "script": { - "id": "b43bcd99-c141-40cf-8314-0d956b38973d", + "id": "3ca77cec-bd62-4709-a4d5-bc03a38cf71e", "type": "text/javascript", "exec": [ "" @@ -3779,22 +7950,20 @@ "_postman_isSubFolder": true }, { - "name": "Highlight", + "name": "Cleanup", "item": [ { - "name": "Highlight-CreateHighlight-Guest", + "name": "Embed-DeleteEmbed-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "b133b7ec-483c-4bc8-9e01-d2ff8e649a5a", + "id": "19b8fab2-0dff-4187-9f90-3ba88cf5496c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3802,64 +7971,99 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" + " pm.response.to.be.ok;", + "});" ], "type": "text/javascript" } - }, + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Other-Registered", + "event": [ { - "listen": "prerequest", + "listen": "test", "script": { - "id": "89ea5b9e-1e64-41f1-be89-9ebda635e605", + "id": "675c0ee4-0c30-49b0-9b90-c940e98ddb51", "exec": [ - "" + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" } - }, + ], "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Embed", + "{{adminEmbedGuid}}" ] } }, "response": [] }, { - "name": "Highlight-GetAllActiveHighlights-Guest", + "name": "Highlight-DeleteHighlight-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "b6418947-6ae2-4f27-8fce-1e0e3b53cb9e", + "id": "2c05eecc-745c-405c-81b0-90a5fabd2d8a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3867,9 +8071,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3877,36 +8081,37 @@ } ], "request": { - "method": "GET", - "header": [], + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "Highlight-GetHighlight-Guest", + "name": "Project-DeleteProject-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "2ee65eca-fca8-4e7c-827b-a81df4d8a779", + "id": "c63a85e7-a0ad-44ab-bc63-ab9fe5acbf09", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", @@ -3914,16 +8119,6 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", "});" ], "type": "text/javascript" @@ -3931,34 +8126,38 @@ } ], "request": { - "method": "GET", - "header": [], + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "Highlight-GetHighlight-ByProject-Guest", + "name": "Project-DeleteProject-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "ce410989-6b77-4827-8ba1-bcbec0bc01d4", + "id": "67682990-48fd-459a-a9ec-e1ffda82789a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", @@ -3968,48 +8167,50 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "GET", - "header": [], + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Project/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", "Project", - "{{projectId}}" + "1" ] } }, "response": [] }, { - "name": "Highlight-UpdateHighlight-Guest", + "name": "Role-DeleteRole-Registered", "event": [ { "listen": "test", "script": { - "id": "13f276ab-3e8b-42d6-aa86-2d1de077ca34", + "id": "a6bbdce6-5cae-4dd1-921b-d33c07278f6e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -4017,64 +8218,48 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "69b2c39d-573f-4903-99b4-c293189e6554", - "exec": [ - "" + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" } - }, + ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Role", + "{{roleId}}" ] } }, "response": [] }, { - "name": "Highlight-DeleteHighlight-Guest", + "name": "User-DeleteUser-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "3c24e5df-0283-45e7-9012-411d04df0b60", + "id": "304e1dd2-2091-4615-a04a-c920f6069163", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", @@ -4095,77 +8280,72 @@ ], "request": { "method": "DELETE", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "User", + "{{createdUserId}}" ] } }, "response": [] } ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "20cc69ad-7d8b-4f64-a396-31043223f85a", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "9e8a766b-b316-4c3e-9c65-a9d253bc5569", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Data Officer", + "item": [ { - "name": "Embed", + "name": "Preparation", "item": [ { - "name": "Embed-CreateEmbed-Guest", + "name": "Institution-CreateInstitution", "event": [ { "listen": "test", "script": { - "id": "d3a68985-04a7-42f7-a3cc-72ce1f22ef3c", + "id": "5ace4f8d-a8b2-4269-88ff-99afe0b1d8c9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var institutionName = pm.environment.get(\"institutionName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", + "pm.environment.set(\"createdInstitutionId\", jsonData.id);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.success;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -4174,10 +8354,16 @@ ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", "options": { "raw": { "language": "json" @@ -4185,88 +8371,50 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Institution", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Institution" ] } }, "response": [] }, { - "name": "Embed-GetAllEmbeds-Guest", + "name": "User-CreateUserWithoutInstitution", "event": [ { "listen": "test", "script": { - "id": "c5b0bdc2-5825-4852-b059-55d11ad97b5b", + "id": "f532d300-ffaa-4ff9-989c-4c94c1ad59aa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"identityId\", jsonData.id);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.success;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-Guest", - "event": [ - { - "listen": "test", - "script": { - "id": "7f733662-86d4-4cfa-b376-27c15544e8d2", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", "});" ], "type": "text/javascript" @@ -4274,46 +8422,67 @@ } ], "request": { - "method": "GET", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "User" ] } }, "response": [] }, { - "name": "Embed-DeleteEmbed-Guest", + "name": "User-CreateUserWithInstitution", "event": [ { "listen": "test", "script": { - "id": "8633b9d4-efec-4644-8f0b-dfb4548d411f", + "id": "d59127b0-671b-4c5a-b753-88d4a040a8ee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", + "pm.environment.set(\"createdUserWithInstitutionId\", jsonData.id);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.success;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", "});" ], "type": "text/javascript" @@ -4321,80 +8490,79 @@ } ], "request": { - "method": "DELETE", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\",\n \"institutionId\": {{institutionIdFromUser}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "User" ] } }, "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "ba82bb96-e99c-4ee3-8348-de7058d02371", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "33ef0201-832a-4124-a334-cdfc2c157e51", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Role", - "item": [ - { - "name": "Role-CreateRole-Guest", + "name": "Project-CreateProject-DifferentInstitution", "event": [ { "listen": "test", "script": { - "id": "0aa21627-4b55-41ab-9fb3-2a284827ace4", + "id": "523feaa5-ba43-4009-bea4-c7f3505a34d6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", "});", - "" + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" ], "type": "text/javascript" } @@ -4402,10 +8570,16 @@ ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -4413,42 +8587,44 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "Project" ] } }, "response": [] }, { - "name": "Role-GetAllRoles-Guest", + "name": "Project-CreateProject-SameInstitution", "event": [ { "listen": "test", "script": { - "id": "d358a3dc-8ea7-4603-982f-d54fb88b539f", + "id": "4756bf87-03fa-480b-88ad-6bf10725db5c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", + "pm.environment.set(\"projectIdWithInstitution\", jsonData.id);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "" ], @@ -4457,46 +8633,78 @@ } ], "request": { - "method": "GET", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "\"9996\"" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "Project" ] } }, "response": [] }, { - "name": "Scope-GetAllScopes-Guest", + "name": "Highlight-CreateHighlight", "event": [ { "listen": "test", "script": { - "id": "0683b630-c94b-403e-a052-96a536a4d21d", + "id": "ad07f846-87f9-47fb-b8d3-052838821085", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", + "pm.environment.set(\"highlightId\", jsonData.id);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "95438c0a-a0cf-4543-a9ed-072234344299", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", "" ], "type": "text/javascript" @@ -4504,107 +8712,145 @@ } ], "request": { - "method": "GET", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "Scopes" + "Highlight" ] } }, "response": [] }, { - "name": "Role-GetRole-Guest", + "name": "Embed-CreateEmbed-DifferentInstitution", "event": [ { "listen": "test", "script": { - "id": "d13c5554-cc45-46f5-a750-ede71aee8978", + "id": "942bc196-9a33-4339-9dbd-1e0934b5346f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", - "" + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "GET", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Role/1", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "1" + "Embed" ] } }, "response": [] }, { - "name": "Role-UpdateRole-Guest", + "name": "Embed-CreateEmbed-SameInstitution", "event": [ { "listen": "test", "script": { - "id": "e06f7409-e348-495f-a925-c43a2a313f34", + "id": "ed48935f-45de-4417-b2f3-f9913804e714", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", + "pm.environment.set(\"embedGuidWithInstitution\", jsonData.guid);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", - "" + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "\"9996\"" + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"projectId\": {{projectIdWithInstitution}}\r\n}", "options": { "raw": { "language": "json" @@ -4612,56 +8858,72 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role/1", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "1" + "Embed" ] } }, "response": [] }, { - "name": "Role-SetRole-Guest", + "name": "Role-CreateRole", "event": [ { "listen": "test", "script": { - "id": "5e3a139e-6313-4695-97a0-99423bc66c9d", + "id": "c627a6d0-a81f-4430-8ae0-814fba493f48", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var scopeName = pm.environment.get(\"scopeName\");", + "var roleName = pm.environment.get(\"roleName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.environment.set(\"roleId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", + " pm.expect(jsonData.name).to.eql(roleName);", "});", - "" + "", + "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", + " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "PUT", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", "options": { "raw": { "language": "json" @@ -4669,40 +8931,25 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId=1", + "raw": "{{apiUrl}}/api/Role", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "1", - "description": "Id of the role that you want to update the user with" - } + "Role" ] } }, "response": [] } ], - "auth": { - "type": "noauth" - }, + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", "event": [ { "listen": "prerequest", "script": { - "id": "787399d2-ec3d-4ff5-a87a-97597349c594", + "id": "c052d69c-d00a-4033-8651-f13e33c3a9a7", "type": "text/javascript", "exec": [ "" @@ -4712,7 +8959,7 @@ { "listen": "test", "script": { - "id": "ada84df6-eb9b-4cbc-aa2d-0cf0ac61c727", + "id": "738b21a5-b547-48e0-9e14-39aaf16af39c", "type": "text/javascript", "exec": [ "" @@ -4724,30 +8971,31 @@ "_postman_isSubFolder": true }, { - "name": "Search", + "name": "User", "item": [ { - "name": "Search-SearchInternal-Guest", + "name": "User-CreateUser-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "2b96eace-3e78-49b6-86a5-196ecf67c142", + "id": "1e8d604c-0ddb-411c-8a11-894a477a95f6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -4755,84 +9003,61 @@ } ], "request": { - "auth": { - "type": "noauth" + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\",\n \"institutionId\": {{createdInstitutionId}}\n}", + "options": { + "raw": { + "language": "json" + } + } }, - "method": "GET", - "header": [], "url": { - "raw": "{{apiUrl}}/api/Search/internal/1", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Search", - "internal", - "1" + "User" ] } }, "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "b0986a56-393c-4e3f-b694-d68515e14e43", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "cd8a1c39-d131-4e24-ab88-2609614b7f45", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Wizard", - "item": [ - { - "name": "Wizard-GetWizard-Guest", + "name": "User-GetUser-Other-DifferentInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "36c470fd-c53a-4c02-97ca-397a591d1197", + "id": "e2c5e1da-0018-48e6-b4b9-d062b6966cb7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", - "" + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" ], "type": "text/javascript" } @@ -4840,120 +9065,51 @@ ], "request": { "method": "GET", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Wizard" - ], - "query": [ - { - "key": "sourceURI", - "value": "{{wizardSourceUri}}", - "description": "This is the URI that the wizard will use to fetch the source." - } + "User", + "{{createdUserId}}" ] } }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "ebb3e940-676f-4d27-a6e2-6074573761e3", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "337607c0-866c-4e24-a734-e88cd41fd4a1", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "f8b8c7fb-bc15-4222-ae2a-2f9a75e5ed71", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "1bfaf80b-458d-4e09-9c88-936acf966015", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Registered", - "item": [ - { - "name": "Preparation", - "item": [ + "response": [] + }, { - "name": "User-CreateUser", + "name": "User-GetUser-Other-SameInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "42979c09-2565-47a6-9ae9-3fc9085e3378", + "id": "e868377b-d4dd-42d7-99ac-990da54c1b9e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = pm.environment.get(\"userName\");", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"identityId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", "});" ], "type": "text/javascript" @@ -4961,60 +9117,48 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "User", + "{{createdUserWithInstitutionId}}" ] } }, "response": [] }, { - "name": "Project-CreateProject", + "name": "User-GetUser-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "d48204c7-c375-4f7c-830c-b66b4002373d", + "id": "8041d88a-a1d9-4b4c-b9b8-a38dc0be7544", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", + "var aliceIdentityId = parseInt(pm.environment.get(\"dataOfficerUserIdentityId\"));", "", "var jsonData = pm.response.json();", + "pm.environment.set(\"dataOfficerUserId\", jsonData.id);", "", - "pm.environment.set(\"projectId\", jsonData.id);", - "pm.environment.set(\"adminProjectId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", @@ -5023,16 +9167,8 @@ " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", "});" ], "type": "text/javascript" @@ -5040,96 +9176,74 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "User" ] } }, "response": [] }, { - "name": "Highlight-CreateHighlight", + "name": "User-UpdateUser-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "b23b101d-0071-4d80-a29f-8f68c171fe7c", + "id": "44f7b3a1-361f-4b7c-b6c7-45bc83ee5b75", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"highlightId\", jsonData.id);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", "});" ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "id": "05bff219-3c76-4f07-8863-0673974f1715", - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } } ], "request": { - "method": "POST", + "method": "PUT", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"institutionId\": 1\r\n}", "options": { "raw": { "language": "json" @@ -5137,46 +9251,43 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "User", + "{{dataOfficerUserId}}" ] } }, "response": [] }, { - "name": "Embed-CreateEmbed", + "name": "User-UpdateUser-Other-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "0f71c2ca-159f-4bd1-bb31-a99d16fd0c44", + "id": "e29370b9-4c13-4714-9c75-1be77202790f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -5184,17 +9295,17 @@ } ], "request": { - "method": "POST", + "method": "PUT", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", "options": { "raw": { "language": "json" @@ -5202,54 +9313,78 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "User", + "{{createdUserId}}" ] } }, "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "7310225e-c51b-4036-8b2c-87564480363f", + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "Role-CreateRole", + "listen": "test", + "script": { + "id": "ec085291-9390-40c5-bb54-e98f9e00ddc7", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "500e8c03-0600-4a12-bec3-cce26e877810", + "id": "507d2f62-4398-4f68-ab35-3be0d44dd982", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var scopeName = pm.environment.get(\"scopeName\");", - "var roleName = pm.environment.get(\"roleName\");", + "var registeredUserId = pm.environment.get(\"dataOfficerUserId\");", + "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"roleId\", jsonData.id);", + "pm.environment.set(\"projectId\", jsonData.id);", "", "pm.test(\"Status code is 201\", function () {", " pm.response.to.have.status(201);", "});", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", - " pm.expect(jsonData.name).to.eql(roleName);", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", "});", "", - "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", - " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", + "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", + " pm.expect(jsonData.user.id).to.eql(registeredUserId);", "});" ], "type": "text/javascript" @@ -5262,12 +9397,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -5275,71 +9410,63 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "Project" ] } }, "response": [] - } - ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "d204680d-24ca-4ccc-80c8-44287863adc9", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "f05a5340-ae6a-4c6e-8fe3-6d081a9f0a4e", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-Registered", + "name": "Project-GetAllProjects-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "07d41c2f-406d-4a16-a52f-5cd257ad4c20", + "id": "0047e1a9-117b-432b-9bf4-6527941f93be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", + "var foundAt;", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -5347,60 +9474,56 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "Project" ] } }, "response": [] }, { - "name": "User-GetUser-Other-Registered", + "name": "Project-GetProject-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "1d1664ea-6d3d-4789-96fa-0a2e48cf7638", + "id": "89174912-af79-428f-823e-e00a69256bcf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -5413,53 +9536,44 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "User-GetUser-Self-Registered", + "name": "Project-GetProject-Other-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "bcb090ca-0a1a-4ac4-872f-bf350dcaff07", + "id": "99e800cd-1d1f-4a19-93c0-73f2e12ada0a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"registeredUserId\", jsonData.id);", - "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -5472,32 +9586,33 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "Project", + "{{adminProjectId}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Self-Registered", + "name": "Project-UpdateProject-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "480b7544-00b9-4afe-9e56-5b9052b5c279", + "id": "287ba2fa-b2a0-4ebd-9341-71304265e35d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "var projectName = pm.environment.get(\"projectNameUpdated\");", "", "var jsonData = pm.response.json();", "", @@ -5515,8 +9630,8 @@ " pm.response.to.be.json;", "});", "", - "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -5529,12 +9644,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -5542,31 +9657,29 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{registeredUserId}}" + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Other-Registered", + "name": "Project-UpdateProject-Other-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "20c06c56-a77a-4509-bfd1-61252ecb9e7b", + "id": "48243c48-696f-4190-a1a8-d5554b860c1b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", @@ -5576,9 +9689,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -5591,12 +9704,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -5604,78 +9717,53 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Project", + "{{adminProjectId}}" ] } }, "response": [] } ], - "description": "Requests executed as the Alice user with the registered role.", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "409f614f-6c29-4113-96c2-378f5fe94f12", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "47b20909-1389-4c27-9f79-38afc9981817", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { - "name": "Project", + "name": "Embed", "item": [ { - "name": "Project-CreateProject-Registered", + "name": "Embed-CreateEmbed-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "d9bac33a-416e-48a5-871a-d7ebdf0c4ec8", + "id": "dfa88d1d-937f-448a-830b-bb07647bc38b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var registeredUserId = pm.environment.get(\"registeredUserId\");", - "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", - "pm.environment.set(\"projectId\", jsonData.id);", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", "", "pm.test(\"Status code is 201\", function () {", " pm.response.to.have.status(201);", "});", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", - " pm.expect(jsonData.user.id).to.eql(registeredUserId);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -5688,12 +9776,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", "options": { "raw": { "language": "json" @@ -5701,44 +9789,32 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "Embed" ] } }, "response": [] }, { - "name": "Project-GetAllProjects-Registered", + "name": "Embed-CreateEmbed-Other-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "3bf05a6a-f97f-4718-9e53-f3a8a6e29be8", + "id": "ba015027-1090-4a07-9ce9-c6d643018c0a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -5746,18 +9822,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -5765,42 +9832,50 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "Embed" ] } }, "response": [] }, { - "name": "Project-GetProject-Self-Registered", + "name": "Embed-GetAllEmbeds-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "899c352b-cbab-47d0-be8c-1c8d4a1398a0", + "id": "9a2904f7-e20f-4493-b850-fd23c16956df", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -5808,13 +9883,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -5827,32 +9898,35 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "Embed" ] } }, "response": [] }, { - "name": "Project-GetProject-Other-Registered", + "name": "Embed-GetEmbed-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "4b07adc7-25e2-41b7-8c3f-1fe46ca3ddec", + "id": "27e505d7-3a2c-4929-940b-ae1e890ad4a5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -5865,6 +9939,10 @@ " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", "});" ], "type": "text/javascript" @@ -5877,38 +9955,44 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{adminProjectId}}" + "Embed", + "{{embedGuid}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Highlight", + "item": [ { - "name": "Project-UpdateProject-Self-Registered", + "name": "Highlight-CreateHighlight-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "21e917e7-2860-45a4-8ced-ccd3a12df693", + "id": "2c65891d-fd02-4436-ab77-bdd38974134f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectNameUpdated\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -5916,31 +10000,42 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", "});" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "id": "80ef5ac0-1d53-4ac3-8415-f65685d1a498", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } } ], "request": { - "method": "PUT", + "method": "POST", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", "options": { "raw": { "language": "json" @@ -5948,31 +10043,44 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "Highlight" ] } }, "response": [] }, { - "name": "Project-UpdateProject-Other-Registered", + "name": "Highlight-GetAllActiveHighlights-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "60b353be-74a7-492f-8011-8b91958957fa", + "id": "e14f5140-20e7-486f-82f6-e4ad94da993f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectId = pm.environment.get(\"adminProjectId\");", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -5980,9 +10088,14 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", "});" ], "type": "text/javascript" @@ -5990,71 +10103,60 @@ } ], "request": { - "method": "PUT", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{adminProjectId}}" + "Highlight" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Embed", - "item": [ + }, { - "name": "Embed-CreateEmbed-Self-Registered", + "name": "Highlight-GetHighlight-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "fb139041-c849-4cac-9b3f-a82c6b440281", + "id": "a0474f7c-7c7b-4757-9fa7-af9fdce60a50", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", "});" ], "type": "text/javascript" @@ -6062,50 +10164,42 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "Embed-CreateEmbed-Other-Registered", + "name": "Highlight-GetHighlight-ByProject-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "14cb65f4-a7f6-4524-9944-ca67b8ce0943", + "id": "3877ae50-f715-4d96-a49e-adefea3170fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6113,53 +10207,47 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" ], "type": "text/javascript" } } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Highlight", + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "Embed-GetAllEmbeds-Registered", + "name": "Highlight-UpdateHighlight-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "9eb80a3f-5a06-42a4-a587-1f0b7a47bf57", + "id": "37978479-2816-4b7f-b69b-a428f88e0c33", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6184,42 +10272,58 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [ { "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Highlight", + "{{highlightId}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Role", + "item": [ { - "name": "Embed-GetEmbed-Registered", + "name": "Role-CreateRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "ed0b5249-f894-4b05-835f-49263e371f3c", + "id": "a570ef07-5014-4731-90a5-0d5d839b5bdc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6227,13 +10331,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", - " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6241,42 +10341,43 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Role", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "Role" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Highlight", - "item": [ + }, { - "name": "Highlight-CreateHighlight-Registered", + "name": "Role-GetAllRoles-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "f1dd0400-b825-4731-a291-58ece7cf5fa2", + "id": "c531ce80-a484-45bd-b3d4-d51ce0b09f0a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6298,80 +10399,44 @@ ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "id": "5238a028-e44d-4436-95d6-ae1ab9d69777", - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Role", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Role" ] } }, "response": [] }, { - "name": "Highlight-GetAllActiveHighlights-Registered", + "name": "Scope-GetAllScopes-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "08c70a10-4420-478b-96bb-19bf4432ab71", + "id": "761686fd-4bfc-4d68-a609-591f4771d0e9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectId = pm.environment.get(\"adminProjectId\");", "", "var jsonData = pm.response.json();", "", - "var foundAt;", - "", - "function findItem(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6379,14 +10444,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", - " foundAt = findItem(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6399,41 +10459,37 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Role/Scopes", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Role", + "Scopes" ] } }, "response": [] }, { - "name": "Highlight-GetHighlight-Registered", + "name": "Role-GetRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "525a9920-26e4-4579-af60-4052d8d8d501", + "id": "7cd2f32c-dea5-4199-9d4e-a89aad4a68af", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6441,13 +10497,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6460,30 +10512,30 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Role", + "{{roleId}}" ] } }, "response": [] }, { - "name": "Highlight-GetHighlight-ByProject-Registered", + "name": "Role-UpdateRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "be80468e-c5a9-49f8-90f8-f4fc27c87315", + "id": "63f5d504-7963-4917-9b8c-9250d961db11", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6498,47 +10550,54 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "GET", + "method": "PUT", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "Project", - "{{projectId}}" + "Role", + "{{roleId}}" ] } }, "response": [] }, { - "name": "Highlight-UpdateHighlight-Registered", + "name": "Role-SetRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "08301b23-8a39-46ae-9b83-154409bb53b4", + "id": "f95182cb-ac02-4c48-90a7-983183162484", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6567,13 +10626,13 @@ "header": [ { "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -6581,14 +10640,26 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } ] } }, @@ -6599,22 +10670,20 @@ "_postman_isSubFolder": true }, { - "name": "Role", + "name": "Search", "item": [ { - "name": "Role-CreateRole-Registered", + "name": "Search-SearchInternal-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "a3f11f4a-d8f2-42cc-b5e7-254a8cb834ae", + "id": "cd28dbb7-9c57-4772-94df-26a3b40984e2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6622,7 +10691,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -6632,50 +10701,50 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "Search", + "internal", + "{{projectName}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Wizard", + "item": [ { - "name": "Role-GetAllRoles-Registered", + "name": "Wizard-GetWizard-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "9fc5c813-2027-43ad-b6f4-ea377147725d", + "id": "6767d56f-c830-4250-80b0-ef109d87397c", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6683,9 +10752,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6698,46 +10767,60 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "Wizard" + ], + "query": [ + { + "key": "sourceURI", + "value": "{{wizardSourceUri}}", + "description": "This is the URI that the wizard will use to fetch the source." + } ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Institution", + "item": [ { - "name": "Scope-GetAllScopes-Registered", + "name": "Institution-CreateInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "372f6cb2-7c7d-4f02-a7f4-2f80e0fd0601", + "id": "a0614038-2853-4e80-9182-f12381c4a45d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -6745,42 +10828,47 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } } - ], + }, "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "Scopes" + "User" ] } }, "response": [] }, { - "name": "Role-GetRole-Registered", + "name": "Institution-GetInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "11ea1f45-5e84-487e-85cf-63df948ff82d", + "id": "ffb53d2e-c164-4812-9bf1-19056172cf94", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6788,7 +10876,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -6798,42 +10886,39 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], + "header": [], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "User", + "1" ] } }, "response": [] }, { - "name": "Role-UpdateRole-Registered", + "name": "Institution-UpdateInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "6c7baf25-46f5-4138-ae5f-eb1e77a85ade", + "id": "ad62fe81-45b9-43d1-b396-38b73cc5902a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6841,7 +10926,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -6851,17 +10936,14 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], + "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", "options": { "raw": { "language": "json" @@ -6869,33 +10951,33 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "User", + "1" ] } }, "response": [] }, { - "name": "Role-SetRole-Registered", + "name": "Instituiton-DeleteInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "8fcebb4a-5920-49cc-88bd-389f67c532e0", + "id": "3b68f192-9b25-4e15-a715-2ba8cd4c2158", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6903,7 +10985,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -6913,63 +10995,61 @@ } ], "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, + "method": "DELETE", + "header": [], "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "{{roleId}}", - "description": "Id of the role that you want to update the user with" - } + "User", + "1" ] } }, "response": [] } ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "d8851461-68a7-4b89-be8d-00328fc8517e", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "7a0869f6-4a89-4280-a387-54eb36efbf31", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { - "name": "Search", + "name": "Cleanup", "item": [ { - "name": "Search-SearchInternal-Registered", + "name": "Embed-DeleteEmbed-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "8e2c5183-fb2e-4074-89d4-bcf1a0f9e54e", + "id": "9c873c78-a41a-418f-bd1c-ad85e3610a00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6983,8 +11063,6 @@ "", "pm.test(\"Response must be valid and have a json body\", function () {", " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6992,50 +11070,40 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Search", - "internal", - "{{projectName}}" + "Embed", + "{{embedGuid}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Wizard", - "item": [ + }, { - "name": "Wizard-GetWizard-Registered", + "name": "Embed-DeleteEmbed-Other-DifferentInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "6f5cece8-d9fd-4e97-b485-bb1e8fe90822", + "id": "f45e0cb5-7123-4589-8170-a10ce4957df9", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", - "", - "var jsonData = pm.response.json();", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7043,9 +11111,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -7053,48 +11121,35 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Wizard" - ], - "query": [ - { - "key": "sourceURI", - "value": "{{wizardSourceUri}}", - "description": "This is the URI that the wizard will use to fetch the source." - } + "Embed", + "{{adminEmbedGuid}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Cleanup", - "item": [ + }, { - "name": "Embed-DeleteEmbed-Self-Registered", + "name": "Embed-DeleteEmbed-Other-SameInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "bdc451d2-69b7-41a3-ae9a-26fdc4ba4931", + "id": "147ace2a-d385-47ff-813b-d1368280c9fe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7120,35 +11175,35 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Embed/{{embedGuidWithInstitution}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "Embed", - "{{embedGuid}}" + "{{embedGuidWithInstitution}}" ] } }, "response": [] }, { - "name": "Embed-DeleteEmbed-Other-Registered", + "name": "Highlight-DeleteHighlight-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "2c6043fb-592d-4a56-8cb4-32812e61b690", + "id": "d77ca8dc-fa58-461e-af81-a30445fe3747", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7156,7 +11211,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7171,35 +11226,80 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{adminEmbedGuid}}" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "Highlight-DeleteHighlight-Other-Registered", + "name": "Project-DeleteProject-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "55e0e164-6c3c-447f-9efc-e0a5c0da2dfc", + "id": "5780ab7a-5024-4191-9043-1ee05441f599", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Other-OtherInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "3fa88271-64ea-4693-8d14-8482abf1e9ad", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7207,7 +11307,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7222,30 +11322,30 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Project/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Project", + "1" ] } }, "response": [] }, { - "name": "Project-DeleteProject-Self-Registered", + "name": "Project-DeleteProject-Other-SameInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "e1d85a08-fde1-44df-94dc-550d53500f03", + "id": "352ee6ba-cea8-47f1-aa25-9e668076ff1e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7255,6 +11355,10 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", "});" ], "type": "text/javascript" @@ -7267,35 +11371,35 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Project/{{projectIdWithInstitution}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "Project", - "{{projectId}}" + "{{projectIdWithInstitution}}" ] } }, "response": [] }, { - "name": "Project-DeleteProject-Other-Registered", + "name": "Role-DeleteRole-Registered", "event": [ { "listen": "test", "script": { - "id": "e3187fa5-899b-4d4b-948e-954525aebe38", + "id": "6830807e-2950-40fa-b24b-ea132020ba71", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7303,7 +11407,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7318,35 +11422,35 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Project/1", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "1" + "Role", + "{{roleId}}" ] } }, "response": [] }, { - "name": "Role-DeleteRole-Registered", + "name": "User-DeleteUser-Other-DifferentInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "688d5e41-20aa-4201-9cbe-266f885d39f4", + "id": "4b0726cb-7d99-4641-9b12-821b5d864cb7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7354,7 +11458,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7369,35 +11473,35 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "User-DeleteUser-Other-Registered", + "name": "User-DeleteUser-Other-SameInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "b2691fa7-0d53-41f0-b78a-951ef80a1cd5", + "id": "a2e89731-b91b-4f4d-9667-bc03efb416a2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7405,9 +11509,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", "});" ], "type": "text/javascript" @@ -7420,18 +11522,18 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "User", - "{{createdUserId}}" + "{{createdUserWithInstitutionId}}" ] } }, @@ -7457,7 +11559,7 @@ { "listen": "test", "script": { - "id": "88329ee1-3bda-405b-a8b4-d8e8110349d2", + "id": "ab38aa83-fb6a-4824-a789-4e4a616b4943", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -7526,7 +11628,7 @@ { "listen": "test", "script": { - "id": "c2bad3ed-cf0b-45d5-ae83-d49a33818e03", + "id": "43a6252c-4931-4a9e-9978-6b831eb153d6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -7605,7 +11707,7 @@ { "listen": "test", "script": { - "id": "5373676f-f8da-4df3-b928-5213fdf62998", + "id": "f7055bb7-2fa6-43f0-a8b8-f8c8d3101517", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -7634,7 +11736,7 @@ { "listen": "prerequest", "script": { - "id": "d4723e59-af43-4663-b487-742a3d15ff02", + "id": "223c1d65-0f1e-4ed5-88a3-f04ccd4b2e47", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -7684,7 +11786,7 @@ { "listen": "test", "script": { - "id": "e082e6d4-b1e0-4715-9094-3776c73b0e51", + "id": "b64cb8a2-2cb7-4d5b-8eba-025149db58bd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7748,7 +11850,7 @@ { "listen": "test", "script": { - "id": "9b559792-e30a-4706-8224-b90c506176f0", + "id": "da6e4c66-c390-4bee-acea-2a9c08421b55", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -7821,7 +11923,7 @@ { "listen": "prerequest", "script": { - "id": "f3dc425f-7f0b-4ebb-a962-4f151ceab662", + "id": "f8d06515-bb25-4136-b4f7-60f572ed9e81", "type": "text/javascript", "exec": [ "" @@ -7831,7 +11933,7 @@ { "listen": "test", "script": { - "id": "2cb7fd4d-65ff-457f-a71a-3920e50e2115", + "id": "96b7c0ba-3566-4e25-a78e-bee6c4754bd1", "type": "text/javascript", "exec": [ "" @@ -7851,7 +11953,7 @@ { "listen": "test", "script": { - "id": "57f38916-d6ae-4412-8541-6d956446f3fd", + "id": "5bd092e5-1315-4201-a0d7-bea8a71ce3f9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -7911,7 +12013,7 @@ { "listen": "test", "script": { - "id": "b3b814df-04d7-4032-9a22-c15e8f70e2ec", + "id": "059c65ab-7a2a-454a-9f4a-d50a0a6bec61", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7964,7 +12066,7 @@ { "listen": "test", "script": { - "id": "c99257ca-be6a-49e2-8be0-772b84b56916", + "id": "04c0fa7f-e3d0-4647-9bf6-0e2598088aba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -8022,7 +12124,7 @@ { "listen": "test", "script": { - "id": "adfd4d07-dcd6-4a35-b3a7-09b1419ff035", + "id": "bbf4aebb-ff3d-47c9-8d0b-ba4651d21ace", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -8089,7 +12191,7 @@ { "listen": "test", "script": { - "id": "90d7c261-d05f-489c-a79e-967878726ead", + "id": "43c931a6-a0a8-41f3-a25b-50fa5bd16be7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8151,7 +12253,7 @@ { "listen": "prerequest", "script": { - "id": "d11ef806-b19e-45a2-8b86-3392fffbe319", + "id": "837c74f0-ce17-447f-bf54-573fef251278", "type": "text/javascript", "exec": [ "" @@ -8161,7 +12263,7 @@ { "listen": "test", "script": { - "id": "50b2b3c9-0579-42aa-8f72-a154142863a8", + "id": "1ad1cb11-9be8-46a0-8d25-a68aa29defbb", "type": "text/javascript", "exec": [ "" @@ -8181,7 +12283,7 @@ { "listen": "test", "script": { - "id": "117bf389-9324-4d38-8fa2-8fe1a9a2d7c1", + "id": "8328636a-d9b4-45c7-9af9-f725fbfe35a6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -8247,7 +12349,7 @@ { "listen": "test", "script": { - "id": "1cb628a0-c121-44a7-bad2-0c5fe9fbcea3", + "id": "8bd3d30f-1d53-4eed-8b1b-704388d9af24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8320,7 +12422,7 @@ { "listen": "test", "script": { - "id": "10f07923-0dc1-4964-af0d-445355546015", + "id": "db900427-0545-40c4-8002-6038b0524289", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -8378,7 +12480,7 @@ { "listen": "test", "script": { - "id": "acdf72cb-1335-4116-a07c-4da402cb3086", + "id": "60ce3afd-f037-4d19-9d65-3dfea80faf0b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -8428,7 +12530,7 @@ { "listen": "test", "script": { - "id": "fecc5ac5-5931-4ebb-9031-015f90494802", + "id": "9ad81d33-a6f3-4b83-a5ae-8a6f91db2ea7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -8495,7 +12597,7 @@ { "listen": "test", "script": { - "id": "375a1ba3-7e75-4551-8c14-09aaf1fd64ee", + "id": "01d9c105-5e6c-4fdd-b9c2-1c9b5b8aa445", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8562,7 +12664,7 @@ { "listen": "test", "script": { - "id": "bd56958c-79d5-419e-abdc-21008141db0c", + "id": "3c684171-758d-4c78-87cd-9377cd1f0630", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8626,7 +12728,7 @@ { "listen": "test", "script": { - "id": "d16adc86-09b7-476a-9521-02c1cd211531", + "id": "f6cdcb65-c48c-408d-87b8-754568c65bef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8690,7 +12792,7 @@ { "listen": "test", "script": { - "id": "4e24b34f-16ac-4fec-9c3a-7b499e853951", + "id": "7654bc87-5952-458f-a849-9d70ac220383", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8742,7 +12844,7 @@ { "listen": "test", "script": { - "id": "b0a175b6-9cc6-4e07-ac03-859e595a3478", + "id": "e61c8c40-d940-4c3b-80eb-0e474b59e0b0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -8800,7 +12902,7 @@ { "listen": "test", "script": { - "id": "c230b7e8-d399-4d97-98cf-c269e7f1c1d0", + "id": "df82731c-5ab7-44bb-8363-be611bf42f38", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -8865,7 +12967,7 @@ { "listen": "test", "script": { - "id": "cddbddca-7677-406a-8452-527cf2914d61", + "id": "a15fc494-aad4-4a6a-8a8a-dfd1ee60a01b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8893,7 +12995,7 @@ { "listen": "prerequest", "script": { - "id": "46343d05-f549-462e-bbb2-b4d1c3e88646", + "id": "30a26376-5874-43dd-9a7b-724b198c81f8", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8943,7 +13045,7 @@ { "listen": "test", "script": { - "id": "bdd54737-8eb5-4d99-a458-9f6580f6ae9e", + "id": "7fd9263a-a3b4-46b0-8771-5c3dd8c9ed80", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9005,7 +13107,7 @@ { "listen": "test", "script": { - "id": "0628e865-4c39-432c-a06b-9f54160ad27c", + "id": "d63d1d5b-e1e7-42bd-a3c2-ff5053807a78", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9092,7 +13194,7 @@ { "listen": "test", "script": { - "id": "f56239be-d44d-463f-9922-6d493041ee33", + "id": "55166ec9-70ce-4b51-b17f-ee02410b5487", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9118,7 +13220,7 @@ { "listen": "prerequest", "script": { - "id": "931d731c-d423-45e1-ab87-427672d20f42", + "id": "f7d804d4-fa0b-428e-b9bb-83d600ee3646", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9165,7 +13267,7 @@ { "listen": "test", "script": { - "id": "0973756f-594c-4815-a5c1-9127c372abd2", + "id": "93c1e48b-c540-4ce1-99d8-20dd59a904f7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9192,7 +13294,7 @@ { "listen": "prerequest", "script": { - "id": "9bbce74d-df9e-4be0-9a38-4b322b060cce", + "id": "377f003c-890a-42f8-ada5-6da94c56e346", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -9242,7 +13344,7 @@ { "listen": "test", "script": { - "id": "84e10823-7146-4450-8eab-349def318363", + "id": "fb71a1dc-1554-4f4c-8f00-def502c6f3d1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9304,7 +13406,7 @@ { "listen": "test", "script": { - "id": "d406c2ea-06a3-442a-bb34-456da659d744", + "id": "62c6efc4-41c9-4179-9c3e-371aa1de1124", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -9391,7 +13493,7 @@ { "listen": "test", "script": { - "id": "c5ce4cad-6e55-477c-9464-996a1e493b06", + "id": "c1324b05-8832-4afa-8412-c5ddf698e2f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9417,7 +13519,7 @@ { "listen": "prerequest", "script": { - "id": "c9811b6f-71bd-4183-ba56-d24da69d3d56", + "id": "5725d784-0934-42d3-bc44-eae7d0d79fec", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -9464,7 +13566,7 @@ { "listen": "test", "script": { - "id": "84c67c94-519d-427f-b679-63c213b4beb5", + "id": "f3d41599-f7fe-40f4-b48e-2a15ff62b7f5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -9540,7 +13642,7 @@ { "listen": "test", "script": { - "id": "df828d59-265e-4534-9a8e-311e890dbe5b", + "id": "46c616f4-caf2-4640-8c40-16ca2ffdc857", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9601,7 +13703,7 @@ { "listen": "test", "script": { - "id": "4b5b77c0-6acf-48ad-b536-359acf08380c", + "id": "7681027d-da07-4c57-9a10-70400e9002cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9653,7 +13755,7 @@ { "listen": "test", "script": { - "id": "0a8526b9-3ed7-4b31-a1cb-aec042bf8248", + "id": "a59cf22e-dd7a-4ce2-828f-c6335eb8edcb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9706,7 +13808,7 @@ { "listen": "test", "script": { - "id": "f233b55f-0f16-443d-adc6-f5aaca4abfc3", + "id": "4eef1d32-915f-451f-bcb5-513d9d319c53", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9759,7 +13861,7 @@ { "listen": "test", "script": { - "id": "f71fbafb-aeac-4ef5-9cda-ddde4a0ff447", + "id": "01986237-1b02-4b98-b3e3-8e1b7624c8a0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9821,7 +13923,7 @@ { "listen": "test", "script": { - "id": "635ff82f-b3f4-4753-9639-f99864b7ad40", + "id": "5d6606e4-5fd7-4f7f-83c9-e8c8dc03b16e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9902,7 +14004,7 @@ { "listen": "test", "script": { - "id": "df752326-18aa-4279-9087-49561cef2744", + "id": "f0ed38ed-61b9-44f6-b713-4b1b03470de5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9961,7 +14063,7 @@ { "listen": "test", "script": { - "id": "248e1243-a710-431b-98a6-b797b967af5e", + "id": "dd04eab3-726c-482d-9ed8-290948607f19", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -10018,6 +14120,252 @@ "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "5acacbbc-b1f2-412e-96bd-dbee3664f49d", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "b26af678-98a3-42ce-8c32-22f0d2d803e6", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "db509be6-5c8e-4834-a895-0af943fe62f9", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "ed30ce84-4052-4a9e-b6ad-7ee7df463cb2", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "70d72573-56aa-443c-ab37-1834b68a9a5f", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "7e45a4dd-53d3-4019-ab97-5e145fc063f0", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, { "name": "Cleanup", "item": [ @@ -10027,7 +14375,7 @@ { "listen": "test", "script": { - "id": "eef87048-b473-4a4d-9986-6877fd0b1096", + "id": "27b316fc-d4ea-4a47-8ab9-2b598c424344", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10076,7 +14424,7 @@ { "listen": "test", "script": { - "id": "b4290841-daab-4e7e-aeaa-5a8a41fdad2f", + "id": "fe30cae9-0108-453d-8a91-9039eaa10b4e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10125,7 +14473,7 @@ { "listen": "test", "script": { - "id": "2590cef8-ec54-4458-858e-462c2280b89b", + "id": "27aea67c-4ffc-42ee-ad29-3ca48207dc01", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10170,7 +14518,7 @@ { "listen": "test", "script": { - "id": "cac797bf-5454-4cd6-b070-38b4abb0b10d", + "id": "c65bb6bc-8c89-4754-b16c-059d26a8873d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10215,7 +14563,7 @@ { "listen": "test", "script": { - "id": "477bccc9-bded-4030-bc3b-10f278075f5c", + "id": "2c180652-8cac-4963-8aec-a8540f8717db", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10260,7 +14608,7 @@ { "listen": "test", "script": { - "id": "02c29ecf-4502-481b-9796-d0915a18f210", + "id": "566158db-f9ec-4f24-94b7-e9532836b3ce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10313,7 +14661,7 @@ { "listen": "test", "script": { - "id": "2511e381-16af-4e43-8aa0-804b4302375d", + "id": "a949e075-a60a-4af4-b91e-c223dc688947", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10366,7 +14714,7 @@ { "listen": "test", "script": { - "id": "966a6d6a-786d-40a8-a2da-d71f63ea1eaa", + "id": "faa6bf86-f2c3-49ed-84b5-db22eaa55993", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10449,7 +14797,7 @@ { "listen": "prerequest", "script": { - "id": "278c9647-58c3-4007-99ab-d2560712ecc8", + "id": "c583d74f-89d3-44de-a502-8ad3e19cc151", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -10493,7 +14841,7 @@ { "listen": "test", "script": { - "id": "471fa789-5e57-4704-a4ea-63260e703766", + "id": "47e1fe4d-c641-4ad6-adbd-d23055325dc9", "type": "text/javascript", "exec": [ "" From 64a22812c647f3d68ae5a6054c140d7fb7347bf7 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 18:22:40 +0100 Subject: [PATCH 127/157] Added identity user --- IdentityServer/Quickstart/TestUsers.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/IdentityServer/Quickstart/TestUsers.cs b/IdentityServer/Quickstart/TestUsers.cs index 85519783..177e57c2 100644 --- a/IdentityServer/Quickstart/TestUsers.cs +++ b/IdentityServer/Quickstart/TestUsers.cs @@ -82,8 +82,19 @@ public static List GetDefaultIdentityUsers(bool isProduction) Firstname = "berry", Lastname = "Smith", Email = "berrySmith@email.com" + }, + new IdentityUser + { + SubjectId = "954654861", + Username = "john", + Password = LoginHelper.GetHashPassword("john"), + Name = "John Smith", + Firstname = "John", + Lastname = "Smith", + Email = "johnSmith@email.com" } - }; + + }; if(isProduction) { Log.Logger.Information("The passwords for this instance:"); From 0b6e7a2927094095144290cbc2de76765721a887 Mon Sep 17 00:00:00 2001 From: Ruben Fricke <55654104+Ruby77@users.noreply.github.com> Date: Sat, 31 Oct 2020 18:24:48 +0100 Subject: [PATCH 128/157] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40967974..a27a381d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added data officer role and CRUD functionalities for institutions - [#265](https://github.com/DigitalExcellence/dex-backend/issues/265) + ### Changed ### Deprecated From 74b4dd063fac6903e332ad27d04a7122b2ea19ce Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 18:36:30 +0100 Subject: [PATCH 129/157] Improve spelling --- API/Controllers/InstitutionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/Controllers/InstitutionController.cs b/API/Controllers/InstitutionController.cs index 4205c7dc..2c771ae9 100644 --- a/API/Controllers/InstitutionController.cs +++ b/API/Controllers/InstitutionController.cs @@ -222,7 +222,7 @@ public async Task UpdateInstitution(int institutionId, [Authorize(Policy = nameof(Defaults.Scopes.InstitutionWrite))] [ProducesResponseType((int) HttpStatusCode.OK)] [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] - public async Task DeleteInsitution(int institutionId) + public async Task DeleteInstitution(int institutionId) { Institution institution = await institutionService.FindAsync(institutionId); if(institution == null) From 2e4362871def0770189bd20aefe2742772e5891a Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 19:01:14 +0100 Subject: [PATCH 130/157] Fixed merge conflict resolve error --- IdentityServer/Quickstart/TestUsers.cs | 28 +++++--------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/IdentityServer/Quickstart/TestUsers.cs b/IdentityServer/Quickstart/TestUsers.cs index b20ed70c..48a49fdf 100644 --- a/IdentityServer/Quickstart/TestUsers.cs +++ b/IdentityServer/Quickstart/TestUsers.cs @@ -37,8 +37,9 @@ public static class TestUsers /// /// Gets the default users. /// + /// if set to true [is production]. /// The list of default identity users. - public static List GetDefaultIdentityUsers() + public static List GetDefaultIdentityUsers(bool isProduction) { List users = new List() { @@ -84,7 +85,6 @@ public static List GetDefaultIdentityUsers() }, new IdentityUser { - SubjectId = "954654861", Username = "john", Password = LoginHelper.GetHashPassword("john"), @@ -93,7 +93,7 @@ public static List GetDefaultIdentityUsers() Lastname = "Smith", Email = "johnSmith@email.com" }, - new IdentityUser + new IdentityUser { SubjectId = "14785236923", Username = "dex", @@ -102,8 +102,7 @@ public static List GetDefaultIdentityUsers() Firstname = "DeX", Lastname = "User", Email = "dex@dex.software" - }, - + } }; if(isProduction) { @@ -118,24 +117,7 @@ public static List GetDefaultIdentityUsers() Log.Logger.Information("{0} has the new password: {1}", testUser.Username, generateSecurePassword); } } - return users; - } - - /// - /// Creates a password for a test user and logs it into the console. - /// - /// The hashed password/. - public static string CreateTestUserPassword(string userName) - { - // Generate a secure password - string securePassword = GenerateSecurePassword(); - - // Hash it - string password = LoginHelper.GetHashPassword(securePassword); - - // Notify the user - Log.Logger.Information("{0} has the new password: {1}", userName, securePassword); - return password; + return users; } /// From c72c9528ada5bcf16299cf3b09a7523f80f1c234 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 19:06:22 +0100 Subject: [PATCH 131/157] Resolve identity server startup bug --- IdentityServer/Startup.cs | 92 +++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 52 deletions(-) diff --git a/IdentityServer/Startup.cs b/IdentityServer/Startup.cs index 996d8c14..78fe170c 100644 --- a/IdentityServer/Startup.cs +++ b/IdentityServer/Startup.cs @@ -28,19 +28,13 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Tokens; -using Models; using Repositories; using Services.Services; using System; -using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; - - - - namespace IdentityServer { /// @@ -122,60 +116,59 @@ public void ConfigureServices(IServiceCollection services) // sets the authentication schema. services.AddAuthentication(options => - { - options.DefaultAuthenticateScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; - options.DefaultSignInScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; - options.DefaultChallengeScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; - }) + { + options.DefaultAuthenticateScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; + options.DefaultSignInScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; + options.DefaultChallengeScheme = IdentityServerConstants.DefaultCookieAuthenticationScheme; + }) // Adds Fontys Single Sign On authentication. .AddOpenIdConnect("FHICT", "Fontys", options => + { + options.ClientId = Config.FfhictOIDC.ClientId; + options.ClientSecret = Config.FfhictOIDC.ClientSecret; + options.Authority = Config.FfhictOIDC.Authority; + options.ResponseType = "code"; + options.Scope.Clear(); + + string[] scopes = Config.FfhictOIDC.Scopes.Split(" "); + foreach(string scope in scopes) { - options.ClientId = Config.FfhictOIDC.ClientId; - options.ClientSecret = Config.FfhictOIDC.ClientSecret; - options.Authority = Config.FfhictOIDC.Authority; - options.ResponseType = "code"; - options.Scope.Clear(); - - string[] scopes = Config.FfhictOIDC.Scopes.Split(" "); - foreach(string scope in scopes) - { - options.Scope.Add(scope); - } - - // Set this flow to get the refresh token. - // options.Scope.Add("offline_access"); - - options.SaveTokens = true; - options.GetClaimsFromUserInfoEndpoint = true; - - // This sets the redirect uri, this is needed because the blackbox implementation does not implement fontys SSO. - options.Events.OnRedirectToIdentityProvider = async n => - { - n.ProtocolMessage.RedirectUri = Config.FfhictOIDC.RedirectUri; - await Task.FromResult(0); - }; + options.Scope.Add(scope); } - // Add jwt validation this is so that the DGS can authenticate. + + // Set this flow to get the refresh token. + // options.Scope.Add("offline_access"); + + options.SaveTokens = true; + options.GetClaimsFromUserInfoEndpoint = true; + + // This sets the redirect uri, this is needed because the blackbox implementation does not implement fontys SSO. + options.Events.OnRedirectToIdentityProvider = async n => + { + n.ProtocolMessage.RedirectUri = Config.FfhictOIDC.RedirectUri; + await Task.FromResult(0); + }; + } + // Add jwt validation this is so that the DGS can authenticate. ).AddJwtBearer(o => { o.SaveToken = true; o.Authority = Config.Self.JwtAuthority; o.RequireHttpsMetadata = false; o.TokenValidationParameters = new TokenValidationParameters() - { - ValidateActor = false, - ValidateAudience = false, - NameClaimType = "name", - RoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - }; + { + ValidateActor = false, + ValidateAudience = false, + NameClaimType = "name", + RoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + }; }) .AddCookie(); if(Environment.IsDevelopment()) { builder.AddDeveloperSigningCredential(); - } - else + } else { X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); certStore.Open(OpenFlags.ReadOnly); @@ -237,16 +230,11 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment .CreateScope(); using IdentityDbContext context = serviceScope.ServiceProvider.GetService(); context.Database.Migrate(); - List identityUsers = TestUsers.GetDefaultIdentityUsers(); - foreach(IdentityUser identityUser in identityUsers.Where(identityUser => !context.IdentityUser.Any(e => e.SubjectId == identityUser.SubjectId))) + if(!context.IdentityUser.Any()) { - if(env.IsProduction()) - { - identityUser.Password = TestUsers.CreateTestUserPassword(identityUser.Username); - } - context.Add(identityUser); + context.IdentityUser.AddRange(TestUsers.GetDefaultIdentityUsers(env.IsProduction())); + context.SaveChanges(); } - context.SaveChanges(); } } } From 22279f4b04183f7fec3cd26f21d2d3ec6c70caf6 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 31 Oct 2020 19:15:28 +0100 Subject: [PATCH 132/157] Updated role service test to succeed --- Models/Defaults/Defaults.cs | 2 +- Services.Tests/RoleServiceTest.cs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index a15562dc..b93d3196 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -101,7 +101,7 @@ public static class Scopes public const string InstitutionUserWrite = "user:institution-write"; [Description("This scope gives write access to user roles for other users within their institution to the Project namespace.")] - public const string InstitutionProjectWrite = "user:institution-write"; + public const string InstitutionProjectWrite = "project:institution-write"; [Description("This scope gives write access to user roles for other users within their institution to the Embed namespace.")] public const string InstitutionEmbedWrite = "embed:institution-write"; diff --git a/Services.Tests/RoleServiceTest.cs b/Services.Tests/RoleServiceTest.cs index 4f8645cd..f1dda08c 100644 --- a/Services.Tests/RoleServiceTest.cs +++ b/Services.Tests/RoleServiceTest.cs @@ -76,7 +76,13 @@ public void GetValidScopes() "RoleRead", "RoleWrite", "EmbedWrite", - "EmbedRead" + "EmbedRead", + "InstitutionUserRead", + "InstitutionUserWrite", + "InstitutionProjectWrite", + "InstitutionEmbedWrite", + "InstitutionRead", + "InstitutionWrite", }; List retrievedScopes = Service.GetValidScopes(); Assert.AreEqual(currentScopes,retrievedScopes); From 959748b4efa82b514133e4b7bd373d9b2560dfb9 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sun, 1 Nov 2020 00:18:18 +0100 Subject: [PATCH 133/157] Set initial value for institutionIdFromUser variable --- Postman/local.postman_environment.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index a2d06269..92ccf1f4 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -224,7 +224,7 @@ }, { "key": "institutionIdFromUser", - "value": "", + "value": "1", "enabled": true }, { @@ -254,6 +254,6 @@ } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-10-31T12:03:28.870Z", + "_postman_exported_at": "2020-10-31T23:17:59.587Z", "_postman_exported_using": "Postman/7.35.0" } \ No newline at end of file From a4824f91e482215e7b6ca34eb2bf30b2c742acfa Mon Sep 17 00:00:00 2001 From: Ruben Date: Sun, 1 Nov 2020 00:56:13 +0100 Subject: [PATCH 134/157] Set init values for variables in environment --- Postman/local.postman_environment.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 92ccf1f4..0b80ea9e 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -209,12 +209,12 @@ }, { "key": "dataOfficerUserIdentityId", - "value": "", + "value": "954654861", "enabled": true }, { "key": "dataOfficerUserId", - "value": "", + "value": "33", "enabled": true }, { @@ -254,6 +254,6 @@ } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-10-31T23:17:59.587Z", + "_postman_exported_at": "2020-10-31T23:55:04.031Z", "_postman_exported_using": "Postman/7.35.0" } \ No newline at end of file From aa1fb37454c22719f80c1d3d40354a70545fe6c3 Mon Sep 17 00:00:00 2001 From: Niray Date: Tue, 3 Nov 2020 11:11:47 +0100 Subject: [PATCH 135/157] changed testimage path --- Postman/dex.postman_collection.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 58b13f37..d2f809fe 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -899,7 +899,7 @@ { "key": "File", "type": "file", - "src": "/C:/Users/Niray/Desktop/angular-226066.png" + "src": "testimage.png" }, { "key": "ProjectId", @@ -5233,7 +5233,7 @@ { "key": "File", "type": "file", - "src": "/C:/Users/Niray/Desktop/angular-226066.png" + "src": "testimage.png" } ] }, From 756ebf5999ca33b33f2d8919f4d20278151e5194 Mon Sep 17 00:00:00 2001 From: Niray Date: Tue, 3 Nov 2020 11:19:11 +0100 Subject: [PATCH 136/157] changed Postman collection testimage path --- Postman/dex.postman_collection.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index d2f809fe..9b1f0d15 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -899,7 +899,7 @@ { "key": "File", "type": "file", - "src": "testimage.png" + "src": "Postman/Postman/testimage.png" }, { "key": "ProjectId", @@ -3131,7 +3131,7 @@ { "key": "File", "type": "file", - "src": "testimage.png" + "src": "Postman/testimage.png" } ] }, @@ -5233,7 +5233,7 @@ { "key": "File", "type": "file", - "src": "testimage.png" + "src": "Postman/testimage.png" } ] }, @@ -7944,7 +7944,7 @@ { "key": "File", "type": "file", - "src": "testimage.png" + "src": "Postman/testimage.png" } ] }, @@ -11085,7 +11085,7 @@ { "key": "File", "type": "file", - "src": "testimage.png" + "src": "Postman/testimage.png" } ] }, From ff5b07659f7c41e854029843dbec67aa9f857fe7 Mon Sep 17 00:00:00 2001 From: Niray Date: Tue, 3 Nov 2020 11:30:23 +0100 Subject: [PATCH 137/157] Fixed path in postman collection --- Postman/dex.postman_collection.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 9b1f0d15..1e16569b 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -899,7 +899,7 @@ { "key": "File", "type": "file", - "src": "Postman/Postman/testimage.png" + "src": "Postman/testimage.png" }, { "key": "ProjectId", From 206466701871d8e31c1ddd23607925eb91dcfa84 Mon Sep 17 00:00:00 2001 From: Niray Date: Tue, 3 Nov 2020 11:42:57 +0100 Subject: [PATCH 138/157] changed testimage to remote testimage. --- Postman/dex.postman_collection.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 1e16569b..7891cb9b 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -899,7 +899,7 @@ { "key": "File", "type": "file", - "src": "Postman/testimage.png" + "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" }, { "key": "ProjectId", @@ -3131,7 +3131,7 @@ { "key": "File", "type": "file", - "src": "Postman/testimage.png" + "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" } ] }, @@ -5233,7 +5233,7 @@ { "key": "File", "type": "file", - "src": "Postman/testimage.png" + "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" } ] }, @@ -7944,7 +7944,7 @@ { "key": "File", "type": "file", - "src": "Postman/testimage.png" + "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" } ] }, @@ -11085,7 +11085,7 @@ { "key": "File", "type": "file", - "src": "Postman/testimage.png" + "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" } ] }, From 4e15bbc843ac8f4c4b8f924d35feef751b5455c3 Mon Sep 17 00:00:00 2001 From: Niray Date: Tue, 3 Nov 2020 12:28:21 +0100 Subject: [PATCH 139/157] refactor in fileuploader for docker enviroment --- API/HelperClasses/FileUploader.cs | 5 +++-- API/Startup.cs | 2 ++ Models/Defaults/Defaults.cs | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/API/HelperClasses/FileUploader.cs b/API/HelperClasses/FileUploader.cs index 2a5d6d25..8da7ea71 100644 --- a/API/HelperClasses/FileUploader.cs +++ b/API/HelperClasses/FileUploader.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Models.Defaults; using Models.Exceptions; using Serilog; using System; @@ -52,9 +53,9 @@ public class FileUploader : IFileUploader /// File Uploader /// /// - public FileUploader(IWebHostEnvironment env) + public FileUploader() { - uploadPath = Path.Combine(env.WebRootPath, "Resources\\"); + uploadPath = Defaults.Path.filePath; } /// diff --git a/API/Startup.cs b/API/Startup.cs index 6d11e453..e981840e 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -212,6 +212,8 @@ public void ConfigureServices(IServiceCollection services) /// The env. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + Defaults.Path.filePath = env.WebRootPath + "Resources\\"; + UpdateDatabase(app, env); if(env.IsDevelopment()) { diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index 3c093c39..b9c4055b 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -34,6 +34,13 @@ public static class Privacy } + public class Path + { + + public static string filePath; + + } + public static class Roles { From be1ce1a262e389eefa92c97cc51d0c23ae2bb8ee Mon Sep 17 00:00:00 2001 From: Niray Date: Tue, 3 Nov 2020 12:28:59 +0100 Subject: [PATCH 140/157] refactor path in postman collection --- Postman/dex.postman_collection.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 7891cb9b..1e16569b 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -899,7 +899,7 @@ { "key": "File", "type": "file", - "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" + "src": "Postman/testimage.png" }, { "key": "ProjectId", @@ -3131,7 +3131,7 @@ { "key": "File", "type": "file", - "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" + "src": "Postman/testimage.png" } ] }, @@ -5233,7 +5233,7 @@ { "key": "File", "type": "file", - "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" + "src": "Postman/testimage.png" } ] }, @@ -7944,7 +7944,7 @@ { "key": "File", "type": "file", - "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" + "src": "Postman/testimage.png" } ] }, @@ -11085,7 +11085,7 @@ { "key": "File", "type": "file", - "src": "https://i.gyazo.com/6446ee1ca87983f69cdc065144acfbc7.png" + "src": "Postman/testimage.png" } ] }, From 4f7f28a87c1364e1c127925bcf8c184f306fc5b3 Mon Sep 17 00:00:00 2001 From: Niray Date: Tue, 3 Nov 2020 17:54:30 +0100 Subject: [PATCH 141/157] fixed an error for uploading files in docker environment --- API/Controllers/FileController.cs | 1 + API/Controllers/ProjectController.cs | 1 - .../DependencyInjectionExtensions.cs | 1 + API/HelperClasses/FileUploader.cs | 19 ++++--------------- API/Startup.cs | 2 +- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs index 837a5477..aa0c6b59 100644 --- a/API/Controllers/FileController.cs +++ b/API/Controllers/FileController.cs @@ -16,6 +16,7 @@ */ using API.Extensions; +using API.HelperClasses; using API.Resources; using AutoMapper; using Microsoft.AspNetCore.Authorization; diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 41c617bb..68a8dd45 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -19,7 +19,6 @@ using API.Resources; using AutoMapper; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Models; diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 3f813687..9cb97c1d 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -15,6 +15,7 @@ * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ +using API.HelperClasses; using Data; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; diff --git a/API/HelperClasses/FileUploader.cs b/API/HelperClasses/FileUploader.cs index 8da7ea71..19c4dde3 100644 --- a/API/HelperClasses/FileUploader.cs +++ b/API/HelperClasses/FileUploader.cs @@ -1,23 +1,13 @@ -using AngleSharp; -using AngleSharp.Io; -using API.Resources; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Models.Defaults; using Models.Exceptions; using Serilog; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; using System.Threading.Tasks; using File = Models.File; -namespace API.Extensions +namespace API.HelperClasses { @@ -52,7 +42,6 @@ public class FileUploader : IFileUploader /// /// File Uploader /// - /// public FileUploader() { uploadPath = Defaults.Path.filePath; @@ -88,11 +77,11 @@ public async Task CopyFileToDirectory(IFormFile file, string fileName) /// Bool which tells if file is deleted successfully or not public void DeleteFileFromDirectory(File file) { - if(System.IO.File.Exists(Path.Combine(uploadPath, file.Name))) - { - System.IO.File.Delete(Path.Combine(uploadPath, file.Name)); + if(System.IO.File.Exists(uploadPath + file.Name)) { + System.IO.File.Delete(uploadPath + file.Name); return; } + throw new FileNotFoundException(file.Name); } diff --git a/API/Startup.cs b/API/Startup.cs index e981840e..df7af296 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -212,7 +212,7 @@ public void ConfigureServices(IServiceCollection services) /// The env. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { - Defaults.Path.filePath = env.WebRootPath + "Resources\\"; + Defaults.Path.filePath = env.WebRootPath + "\\Resources\\"; UpdateDatabase(app, env); if(env.IsDevelopment()) From 0e0db30aaa81984898d9887c53655d9bfcb83139 Mon Sep 17 00:00:00 2001 From: Ruben Date: Tue, 3 Nov 2020 21:03:18 +0100 Subject: [PATCH 142/157] Resolved Niray's feedback --- API/Extensions/DependencyInjectionExtensions.cs | 2 +- Services.Tests/SourceManagerServiceTest.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 8a55067c..1298c8a6 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -68,7 +68,7 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); - services.AddTransient(); + services.AddScoped(); return services; } diff --git a/Services.Tests/SourceManagerServiceTest.cs b/Services.Tests/SourceManagerServiceTest.cs index 749ab4d8..2d82e4af 100644 --- a/Services.Tests/SourceManagerServiceTest.cs +++ b/Services.Tests/SourceManagerServiceTest.cs @@ -1,5 +1,3 @@ -using Models; -using Moq; /* * Digital Excellence Copyright (C) 2020 Brend Smits * @@ -21,6 +19,8 @@ using Services.Services; using Services.Sources; using System; +using Models; +using Moq; namespace Services.Tests { From aa39bfcc366b81a7bdd652ce2104ce7d4a3d681f Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 4 Nov 2020 09:26:36 +0100 Subject: [PATCH 143/157] Merge branch 'develop' into feature/265-data-officer-role --- .gitignore | 3 + API/Configuration/MappingProfile.cs | 4 + API/Controllers/FileController.cs | 223 +++ API/Controllers/ProjectController.cs | 86 +- API/Controllers/RoleController.cs | 4 +- API/Extensions/AllowedExtensionsAttribute.cs | 71 + .../DependencyInjectionExtensions.cs | 24 +- API/Extensions/MaxFileSizeAttribute.cs | 67 + API/HelperClasses/FileUploader.cs | 89 ++ API/Resources/FileResource.cs | 40 + API/Resources/FileResourceResult.cs | 50 + .../ProjectHighlightResourceResult.cs | 5 + API/Resources/ProjectResource.cs | 5 + API/Resources/ProjectResourceResult.cs | 4 + API/Resources/ProjectResultResource.cs | 4 + API/Startup.cs | 13 +- API/wwwroot/Resources/.gitkeep | 1 + CHANGELOG.md | 3 +- Data/ApplicationDbContext.cs | 24 +- Data/Helpers/Seed.cs | 1 + ...dFilesAndProjectIconReferences.Designer.cs | 312 ++++ ...093942_AddFilesAndProjectIconReferences.cs | 74 + .../ApplicationDbContextModelSnapshot.cs | 45 + .../Configuration/IdentityConfig.cs | 4 +- Models/Defaults/Defaults.cs | 10 + Models/Exceptions/FileExistException.cs | 21 + Models/File.cs | 44 + Models/Project.cs | 4 + Postman/dex.postman_collection.json | 1414 +++++++++++++---- Postman/local.postman_environment.json | 30 +- Postman/runtests_linux.sh | 3 + Postman/runtests_windows.bat | 1 + Postman/testimage.png | Bin 0 -> 13976 bytes .../DataGenerators/FileDataGenerator.cs | 30 + .../DataSources/FileDataSourceAttribute.cs | 53 + Repositories.Tests/FileRepositoryTest.cs | 58 + Repositories/FileRepository.cs | 53 + Repositories/HighlightRepository.cs | 21 +- Repositories/ProjectRepository.cs | 12 +- Services.Tests/FileServiceTest.cs | 81 + Services.Tests/RoleServiceTest.cs | 28 +- Services/Services/FileService.cs | 52 + Services/Services/RoleService.cs | 4 +- 43 files changed, 2704 insertions(+), 371 deletions(-) create mode 100644 API/Controllers/FileController.cs create mode 100644 API/Extensions/AllowedExtensionsAttribute.cs create mode 100644 API/Extensions/MaxFileSizeAttribute.cs create mode 100644 API/HelperClasses/FileUploader.cs create mode 100644 API/Resources/FileResource.cs create mode 100644 API/Resources/FileResourceResult.cs create mode 100644 API/wwwroot/Resources/.gitkeep create mode 100644 Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.Designer.cs create mode 100644 Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs create mode 100644 Models/Exceptions/FileExistException.cs create mode 100644 Models/File.cs create mode 100644 Postman/runtests_linux.sh create mode 100644 Postman/runtests_windows.bat create mode 100644 Postman/testimage.png create mode 100644 Repositories.Tests/DataGenerators/FileDataGenerator.cs create mode 100644 Repositories.Tests/DataSources/FileDataSourceAttribute.cs create mode 100644 Repositories.Tests/FileRepositoryTest.cs create mode 100644 Repositories/FileRepository.cs create mode 100644 Services.Tests/FileServiceTest.cs create mode 100644 Services/Services/FileService.cs diff --git a/.gitignore b/.gitignore index 551cf78a..4f389a83 100644 --- a/.gitignore +++ b/.gitignore @@ -333,3 +333,6 @@ profile IdentityServer/tempkey.rsa + +/API/wwwroot/Resources/* +!/API/wwwroot/Resources/.gitkeep diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index cf722397..40daaf13 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -57,6 +57,10 @@ public MappingProfile() CreateMap(); CreateMap(); + CreateMap(); + CreateMap().ForMember(e => e.UploaderUserId, + opt => opt.MapFrom(e => e.Uploader.Id)); + CreateMap(); CreateMap(); diff --git a/API/Controllers/FileController.cs b/API/Controllers/FileController.cs new file mode 100644 index 00000000..aa0c6b59 --- /dev/null +++ b/API/Controllers/FileController.cs @@ -0,0 +1,223 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using API.Extensions; +using API.HelperClasses; +using API.Resources; +using AutoMapper; +using Microsoft.AspNetCore.Authorization; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Models; +using Models.Defaults; +using Models.Exceptions; +using Services.Services; +using System; +using System.IO; +using System.Net; +using File = Models.File; + +namespace API.Controllers +{ + /// + /// This class is responsible for handling HTTP requests that are related + /// to file uploading, for example creating, retrieving or deleting. + /// + [Route("api/[controller]")] + [ApiController] + public class FileController : ControllerBase + { + + private readonly IFileService fileService; + private readonly IMapper mapper; + private readonly IUserService userService; + private readonly IFileUploader fileUploader; + /// + /// Initializes a new instance of the class. + /// + /// The file service. + /// The mapper. + /// The User service + /// The file uploader extension + public FileController(IFileService fileService, IMapper mapper, IFileUploader fileUploader, IUserService userService) + { + this.fileService = fileService; + this.mapper = mapper; + this.userService = userService; + this.fileUploader = fileUploader; + } + + /// + /// This method is responsible for retrieving all files + /// + /// A response and list of files. + /// This endpoint returns all projects. + [HttpGet] + [Authorize] + [ProducesResponseType(typeof(IEnumerable), (int) HttpStatusCode.OK)] + public async Task GetFilesAsync() + { + IEnumerable files = await fileService.GetAll(); + + return Ok(mapper.Map, IEnumerable>(files)); + } + + /// + /// This method is responsible for uploading a file + /// + /// This methods return status code 200 + /// This endpoint returns all files. + /// The 400 bad request is returned when a file is null. + [HttpPost] + [Authorize] + [Consumes("multipart/form-data")] + [ProducesResponseType(typeof(FileResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.BadRequest)] + public async Task UploadSingleFile([FromForm] FileResource fileResource) + { + if(fileResource.File == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed posting file.", + Detail = "File is null.", + Instance = "ACD46F17-A239-4353-92A5-0B81AA0A96E9" + }; + return BadRequest(problem); + } + try + { + DateTime uploadDateTime = DateTime.Now; + int fileExtPos = fileResource.File.FileName.LastIndexOf("."); + string extension = fileResource.File.FileName.Substring(fileExtPos); + string newFileName = Guid.NewGuid() + extension; + User user = await HttpContext.GetContextUser(userService) + .ConfigureAwait(false); + File file = new File(newFileName, newFileName, user, uploadDateTime); + + await fileUploader.CopyFileToDirectory(fileResource.File, newFileName); + + await fileService.AddAsync(file); + fileService.Save(); + + return Ok(mapper.Map(file)); + } catch(FileExistException fileExistException) + { + ProblemDetails problem = new ProblemDetails + { + Title = fileExistException.Message, + Detail = "Please rename filename.", + Instance = "D902F8C6-23FF-4506-B272-C757BD709464" + }; + return BadRequest(problem); + } + } + + /// + /// Find file by id + /// + /// + ///This endpoint returns one single file. + /// File + [HttpGet("{fileId}")] + [ProducesResponseType(typeof(FileResourceResult), (int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] + public async Task GetSingleFile(int fileId) + { + File file = await fileService.FindAsync(fileId); + + if(file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File could not be found.", + Detail = "File could not be found.", + Instance = "875B6402-D771-45EC-AB56-3DE0CDD446D6" + }; + return NotFound(problem); + } + + return Ok(mapper.Map(file)); + } + + /// + /// Deletes single file + /// + /// + /// This endpoint deletes one single file. + /// The 404 Not Found response is returned when the file was not found. + /// The 401 Not Authorized response is returned when the user does not have the right credentials. + /// + [HttpDelete("{fileId}")] + [Authorize] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.Unauthorized)] + public async Task DeleteSingleFile(int fileId) + { + File file = await fileService.FindAsync(fileId); + User user = await HttpContext.GetContextUser(userService) + .ConfigureAwait(false); + + if(file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File was not found.", + Detail = "File was not found.", + Instance = "9D3830A2-E7D1-4610-A147-1D43BFB8DDBC" + }; + return NotFound(problem); + } + + bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.FileWrite)); + if(!(file.Uploader.Id.Equals(user.Id) || isAllowed)) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Not authorized.", + Detail = "You do not have the required permissions to delete this file.", + Instance = "88967A6F-B168-44E2-A8E7-E9EBD555940E" + }; + return Unauthorized(problem); + + } + + try + { + await fileService.RemoveAsync(fileId) + .ConfigureAwait(false); + fileService.Save(); + fileUploader.DeleteFileFromDirectory(file); + return Ok(); + } catch(FileNotFoundException) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File could not be deleted because the path does not exist.", + Detail = "File could not be found.", + Instance = "436349B4-50D9-49FD-8618-82367BEB7941" + }; + + return NotFound(problem); + } + + } + + } +} diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index b94a9cde..8caafcda 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -45,21 +45,25 @@ public class ProjectController : ControllerBase private readonly IProjectService projectService; private readonly IUserService userService; private readonly IAuthorizationHelper authorizationHelper; + private readonly IFileService fileService; /// /// Initializes a new instance of the class /// /// The project service which is used to communicate with the logic layer. /// The user service which is used to communicate with the logic layer. + /// The file service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. /// The authorization helper which is used to communicate with the authorization helper class. public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper, - IAuthorizationHelper authorizationHelper) + IAuthorizationHelper authorizationHelper, + IFileService fileService) { this.projectService = projectService; this.userService = userService; + this.fileService = fileService; this.mapper = mapper; this.authorizationHelper = authorizationHelper; } @@ -77,9 +81,9 @@ public ProjectController(IProjectService projectService, public async Task GetAllProjects([FromQuery] ProjectFilterParamsResource projectFilterParamsResource) { ProblemDetails problem = new ProblemDetails - { - Title = "Invalid search request." - }; + { + Title = "Invalid search request." + }; if(projectFilterParamsResource.Page != null && projectFilterParamsResource.Page < 1) { @@ -111,14 +115,13 @@ public async Task GetAllProjects([FromQuery] ProjectFilterParamsR mapper.Map, IEnumerable>(projects); ProjectResultsResource resultsResource = new ProjectResultsResource() - { - Results = results.ToArray(), - Count = results.Count(), - TotalCount = await projectService.ProjectsCount(projectFilterParams), - Page = projectFilterParams.Page, - TotalPages = - await projectService.GetProjectsTotalPages(projectFilterParams) - }; + { + Results = results.ToArray(), + Count = results.Count(), + TotalCount = await projectService.ProjectsCount(projectFilterParams), + Page = projectFilterParams.Page, + TotalPages = await projectService.GetProjectsTotalPages(projectFilterParams) + }; return Ok(resultsResource); } @@ -186,7 +189,22 @@ public async Task CreateProjectAsync([FromBody] ProjectResource p return BadRequest(problem); } Project project = mapper.Map(projectResource); + File file = await fileService.FindAsync(projectResource.FileId); + + if(projectResource.FileId != 0 && file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File was not found.", + Detail = "The specified file was not found while creating project.", + Instance = "8CABE64D-6B73-4C88-BBD8-B32FA9FE6EC7" + }; + return BadRequest(problem); + } + + project.ProjectIcon = file; project.User = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + try { projectService.Add(project); @@ -236,6 +254,24 @@ public async Task UpdateProject(int projectId, [FromBody] Project } mapper.Map(projectResource, project); + File file = null; + if(projectResource.FileId != 0) + { + file = await fileService.FindAsync(projectResource.FileId); + project.ProjectIcon = file; + } + + if(projectResource.FileId != 0 && file == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "File was not found.", + Detail = "The specified file was not found while updating project.", + Instance = "69166D3D-6D34-4050-BD25-71F1BEBE43D3" + }; + return BadRequest(problem); + } + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.ProjectWrite)); @@ -270,15 +306,16 @@ public async Task UpdateProject(int projectId, [FromBody] Project [ProducesResponseType(typeof(ProblemDetails), (int) HttpStatusCode.NotFound)] public async Task DeleteProject(int projectId) { - Project project = await projectService.FindAsync(projectId).ConfigureAwait(false); + Project project = await projectService.FindAsync(projectId) + .ConfigureAwait(false); if(project == null) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed to delete the project.", - Detail = "The project could not be found in the database.", - Instance = "AF63CF48-ECAA-4996-BAA0-BF52926D12AC" - }; + { + Title = "Failed to delete the project.", + Detail = "The project could not be found in the database.", + Instance = "AF63CF48-ECAA-4996-BAA0-BF52926D12AC" + }; return NotFound(problem); } @@ -291,15 +328,16 @@ public async Task DeleteProject(int projectId) if(!(project.UserId == user.Id || isAllowed)) { ProblemDetails problem = new ProblemDetails - { - Title = "Failed to delete the project.", - Detail = "The user is not allowed to delete the project.", - Instance = "D0363680-5B4F-40A1-B381-0A7544C70164" - }; + { + Title = "Failed to delete the project.", + Detail = "The user is not allowed to delete the project.", + Instance = "D0363680-5B4F-40A1-B381-0A7544C70164" + }; return Unauthorized(problem); } - await projectService.RemoveAsync(projectId).ConfigureAwait(false); + await projectService.RemoveAsync(projectId) + .ConfigureAwait(false); projectService.Save(); return Ok(); } diff --git a/API/Controllers/RoleController.cs b/API/Controllers/RoleController.cs index 63dd68ec..d532a801 100644 --- a/API/Controllers/RoleController.cs +++ b/API/Controllers/RoleController.cs @@ -150,7 +150,7 @@ public async Task CreateRoleAsync([FromBody]RoleResource roleReso foreach(RoleScope roleScope in role.Scopes) { - if(!roleService.isValidScope(roleScope.Scope)) + if(!roleService.IsValidScope(roleScope.Scope)) { ProblemDetails problem = new ProblemDetails { @@ -212,7 +212,7 @@ public async Task UpdateRole(int roleId, RoleResource roleResourc mapper.Map(roleResource,currentRole); foreach(RoleScope roleScope in currentRole.Scopes) { - if(!roleService.isValidScope(roleScope.Scope)) + if(!roleService.IsValidScope(roleScope.Scope)) { ProblemDetails problem = new ProblemDetails { diff --git a/API/Extensions/AllowedExtensionsAttribute.cs b/API/Extensions/AllowedExtensionsAttribute.cs new file mode 100644 index 00000000..15a4e75b --- /dev/null +++ b/API/Extensions/AllowedExtensionsAttribute.cs @@ -0,0 +1,71 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Extensions +{ + /// + /// Attribute for allowed file extensions + /// + public class AllowedExtensionsAttribute : ValidationAttribute + { + private readonly string[] extensions; + + /// + /// Constructor for allowed extensions + /// + /// array of extensions + public AllowedExtensionsAttribute(string[] extensions) + { + this.extensions = extensions; + } + + /// + /// Method which checks if extensions are allowed + /// + /// + /// + /// + protected override ValidationResult IsValid( + object value, ValidationContext validationContext) + { + IFormFile file = value as IFormFile; + if(file == null) + { + return new ValidationResult(FileIsNullError()); + } + + string extension = Path.GetExtension(file.FileName); + + if(!extensions.Contains(extension.ToLower())) + { + return new ValidationResult(GetErrorMessage()); + } + + + return ValidationResult.Success; + } + + /// + /// Error message + /// + /// + public string GetErrorMessage() + { + return $"This file extension is not allowed!"; + } + + /// + /// Error message + /// + /// + public string FileIsNullError() + { + return "File is null"; + } + } +} diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 1298c8a6..aa1e6eeb 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -1,21 +1,22 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ using API.Common; +using API.HelperClasses; using Data; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; @@ -57,6 +58,11 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + + services.AddScoped(); + services.AddScoped(); services.AddScoped(); diff --git a/API/Extensions/MaxFileSizeAttribute.cs b/API/Extensions/MaxFileSizeAttribute.cs new file mode 100644 index 00000000..ab1f9ec1 --- /dev/null +++ b/API/Extensions/MaxFileSizeAttribute.cs @@ -0,0 +1,67 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Extensions +{ + /// + /// Attribute for maximum file size + /// + public class MaxFileSizeAttribute : ValidationAttribute + { + private readonly int maxFileSize; + + /// + /// Constructor for maximum filesize attribute + /// + /// + public MaxFileSizeAttribute(int maxFileSize) + { + this.maxFileSize = maxFileSize; + } + + /// + /// Methods which checks if file is not larger than allowed size + /// + /// + /// + /// + protected override ValidationResult IsValid( + object value, ValidationContext validationContext) + { + IFormFile file = value as IFormFile; + if(file == null) + { + return new ValidationResult(FileIsNullError()); + } + + if(file.Length > maxFileSize) + { + return new ValidationResult(GetErrorMessage()); + } + + return ValidationResult.Success; + } + + /// + /// Error messsage + /// + /// + public string GetErrorMessage() + { + return $"Maximum allowed file size is {maxFileSize} bytes."; + } + + /// + /// Error message + /// + /// + public string FileIsNullError() + { + return "File is null"; + } + } +} diff --git a/API/HelperClasses/FileUploader.cs b/API/HelperClasses/FileUploader.cs new file mode 100644 index 00000000..19c4dde3 --- /dev/null +++ b/API/HelperClasses/FileUploader.cs @@ -0,0 +1,89 @@ +using Microsoft.AspNetCore.Http; +using Models.Defaults; +using Models.Exceptions; +using Serilog; +using System; +using System.IO; +using System.Threading.Tasks; +using File = Models.File; + +namespace API.HelperClasses +{ + + + /// + /// Interface for file uploader + /// + public interface IFileUploader + { + /// + /// Uploads single file + /// + /// + /// + /// path of file location + Task CopyFileToDirectory(IFormFile file, string fileName); + + /// + /// Method deletes the file from the file server + /// + /// + void DeleteFileFromDirectory(File file); + } + + /// + /// Class which is responsible for uploading files + /// + public class FileUploader : IFileUploader + { + + private readonly string uploadPath; + + /// + /// File Uploader + /// + public FileUploader() + { + uploadPath = Defaults.Path.filePath; + } + + /// + /// Uploads single file + /// + /// File to upload + /// Name of file + /// path of file location + public async Task CopyFileToDirectory(IFormFile file, string fileName) + { + try + { + if(System.IO.File.Exists(uploadPath + fileName)) throw new FileExistException(fileName); + await using Stream sourceStream = file.OpenReadStream(); + await using FileStream destinationStream = System.IO.File.Create(uploadPath + fileName); + await sourceStream.CopyToAsync(destinationStream); + + return fileName; + } catch(Exception e) + { + Log.Logger.Error(e, "Unexpected error"); + throw e; + } + } + + /// + /// Method deletes the file from the file server + /// + /// + /// Bool which tells if file is deleted successfully or not + public void DeleteFileFromDirectory(File file) + { + if(System.IO.File.Exists(uploadPath + file.Name)) { + System.IO.File.Delete(uploadPath + file.Name); + return; + } + + throw new FileNotFoundException(file.Name); + } + + } +} diff --git a/API/Resources/FileResource.cs b/API/Resources/FileResource.cs new file mode 100644 index 00000000..cb4feb44 --- /dev/null +++ b/API/Resources/FileResource.cs @@ -0,0 +1,40 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using API.Extensions; +using Microsoft.AspNetCore.Http; +using System.ComponentModel.DataAnnotations; + +namespace API.Resources +{ + + /// + /// Embedded project resource result + /// + /// + public class FileResource + { + /// + /// IFormFile + /// + [Required(ErrorMessage = "Please add a file")] + [AllowedExtensions(new [] { ".jpg", ".png", ".jpeg"})] + [MaxFileSize(2097152)] + public IFormFile File { get; set; } + + } +} diff --git a/API/Resources/FileResourceResult.cs b/API/Resources/FileResourceResult.cs new file mode 100644 index 00000000..71b9e435 --- /dev/null +++ b/API/Resources/FileResourceResult.cs @@ -0,0 +1,50 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using System; + +namespace API.Resources +{ + /// + /// File resource resource result + /// + /// + public class FileResourceResult + { + /// + /// Id of File + /// + public int Id { get; set; } + /// + /// Path of file + /// + public string Path { get; set; } + /// + /// Upload Date and time + /// + public DateTime UploadDateTime { get; set; } + /// + /// File name + /// + public string Name { get; set; } + /// + /// User Id that uploaded the file + /// + public int UploaderUserId { get; set; } + + } +} diff --git a/API/Resources/ProjectHighlightResourceResult.cs b/API/Resources/ProjectHighlightResourceResult.cs index fc4cf876..b24dc21c 100644 --- a/API/Resources/ProjectHighlightResourceResult.cs +++ b/API/Resources/ProjectHighlightResourceResult.cs @@ -21,5 +21,10 @@ public class ProjectHighlightResourceResult /// This gets or sets the Short Description /// public string ShortDescription { get; set; } + + /// + /// This gets or set the file of the project + /// + public FileResourceResult ProjectIcon { get; set; } } } diff --git a/API/Resources/ProjectResource.cs b/API/Resources/ProjectResource.cs index 44d85802..ee82d815 100644 --- a/API/Resources/ProjectResource.cs +++ b/API/Resources/ProjectResource.cs @@ -49,5 +49,10 @@ public class ProjectResource /// This gets or sets the collaborators /// public ICollection Collaborators { get; set; } + + /// + /// This gets or sets the file id + /// + public int FileId { get; set; } } } diff --git a/API/Resources/ProjectResourceResult.cs b/API/Resources/ProjectResourceResult.cs index 328aecc2..08614e47 100644 --- a/API/Resources/ProjectResourceResult.cs +++ b/API/Resources/ProjectResourceResult.cs @@ -74,5 +74,9 @@ public class ProjectResourceResult /// This gets or sets the Updated time of the project /// public DateTime Updated { get; set; } + /// + /// This gets or set the file of the project + /// + public FileResourceResult ProjectIcon { get; set; } } } diff --git a/API/Resources/ProjectResultResource.cs b/API/Resources/ProjectResultResource.cs index 1ace8100..12db64d4 100644 --- a/API/Resources/ProjectResultResource.cs +++ b/API/Resources/ProjectResultResource.cs @@ -55,6 +55,10 @@ public class ProjectResultResource /// Get or Set the owner of the project /// public LimitedUserResourceResult User { get; set; } + /// + /// This gets or set the file of the project + /// + public FileResourceResult ProjectIcon { get; set; } } } diff --git a/API/Startup.cs b/API/Startup.cs index dedf69dc..20422616 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -25,9 +25,11 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Logging; using Microsoft.OpenApi.Models; @@ -39,6 +41,7 @@ using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; +using System.IO; using System.Linq; using System.Threading.Tasks; @@ -148,6 +151,9 @@ public void ConfigureServices(IServiceCollection services) policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionWrite)))); o.AddPolicy(nameof(Defaults.Scopes.InstitutionRead), policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionRead)))); + + o.AddPolicy(nameof(Defaults.Scopes.FileWrite), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.FileWrite)))); }); services.AddCors(); @@ -221,6 +227,8 @@ public void ConfigureServices(IServiceCollection services) /// The env. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + Defaults.Path.filePath = env.WebRootPath + "\\Resources\\"; + UpdateDatabase(app, env); if(env.IsDevelopment()) { @@ -246,6 +254,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseProblemDetails(); + app.UseStaticFiles(); + app.UseRouting(); app.UseCors(c => { @@ -258,6 +268,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthentication(); app.UseAuthorization(); + + //UserInfo app.UseWhen(context => context.User.Identities.Any(i => i.IsAuthenticated), @@ -325,7 +337,6 @@ await next() o.OAuthClientId(Config.Swagger.ClientId); }); - app.UseStaticFiles(); } /// diff --git a/API/wwwroot/Resources/.gitkeep b/API/wwwroot/Resources/.gitkeep new file mode 100644 index 00000000..e02abfc9 --- /dev/null +++ b/API/wwwroot/Resources/.gitkeep @@ -0,0 +1 @@ + diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c71278..0c5db393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Add Postman tests to pipeline - [#189](https://github.com/DigitalExcellence/dex-backend/issues/189) +- Added a fileuploader which gives the opportunity to upload files and icons - [#217](https://github.com/DigitalExcellence/dex-backend/issues/217) +- Add Postman tests to pipeline [#189](https://github.com/DigitalExcellence/dex-backend/issues/189) - Added a new dex user that can be used to add projects manually - [#270](https://github.com/DigitalExcellence/dex-backend/issues/270) - Added data officer role and CRUD functionalities for institutions - [#265](https://github.com/DigitalExcellence/dex-backend/issues/265) diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index e570b9cc..302b8175 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -82,6 +82,12 @@ public ApplicationDbContext(DbContextOptions options) : ba /// The institution. /// public DbSet Institution { get; set; } + /// Gets or sets the file. + /// + /// + /// The file. + /// + public DbSet File { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 2362db92..bc663a6f 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -105,6 +105,7 @@ public static List SeedRoles() new RoleScope(nameof(Defaults.Scopes.EmbedWrite)), new RoleScope(nameof(Defaults.Scopes.InstitutionRead)), new RoleScope(nameof(Defaults.Scopes.InstitutionWrite)) + new RoleScope(nameof(Defaults.Scopes.FileWrite)) } }; roles.Add(administratorRole); diff --git a/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.Designer.cs b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.Designer.cs new file mode 100644 index 00000000..aa679b60 --- /dev/null +++ b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.Designer.cs @@ -0,0 +1,312 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20201016093942_AddFilesAndProjectIconReferences")] + partial class AddFilesAndProjectIconReferences + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UploaderId"); + + b.ToTable("File"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectIconId") + .HasColumnType("int"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectIconId"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.File", b => + { + b.HasOne("Models.User", "Uploader") + .WithMany() + .HasForeignKey("UploaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.File", "ProjectIcon") + .WithMany() + .HasForeignKey("ProjectIconId"); + + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs new file mode 100644 index 00000000..45e14ef4 --- /dev/null +++ b/Data/Migrations/20201016093942_AddFilesAndProjectIconReferences.cs @@ -0,0 +1,74 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class AddFilesAndProjectIconReferences : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectIconId", + table: "Project", + nullable: true); + + migrationBuilder.CreateTable( + name: "File", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Path = table.Column(nullable: false), + UploadDateTime = table.Column(nullable: false), + Name = table.Column(nullable: true), + UploaderId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_File", x => x.Id); + table.ForeignKey( + name: "FK_File_User_UploaderId", + column: x => x.UploaderId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Project_ProjectIconId", + table: "Project", + column: "ProjectIconId"); + + migrationBuilder.CreateIndex( + name: "IX_File_UploaderId", + table: "File", + column: "UploaderId"); + + migrationBuilder.AddForeignKey( + name: "FK_Project_File_ProjectIconId", + table: "Project", + column: "ProjectIconId", + principalTable: "File", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Project_File_ProjectIconId", + table: "Project"); + + migrationBuilder.DropTable( + name: "File"); + + migrationBuilder.DropIndex( + name: "IX_Project_ProjectIconId", + table: "Project"); + + migrationBuilder.DropColumn( + name: "ProjectIconId", + table: "Project"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index a16970a9..669c6d80 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -67,6 +67,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("EmbeddedProject"); }); + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UploaderId"); + + b.ToTable("File"); + }); + modelBuilder.Entity("Models.Highlight", b => { b.Property("Id") @@ -129,6 +156,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("ProjectIconId") + .HasColumnType("int"); + b.Property("ShortDescription") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -145,6 +175,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); + b.HasIndex("ProjectIconId"); + b.HasIndex("UserId"); b.ToTable("Project"); @@ -249,6 +281,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Models.File", b => + { + b.HasOne("Models.User", "Uploader") + .WithMany() + .HasForeignKey("UploaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Models.Highlight", b => { b.HasOne("Models.Project", "Project") @@ -260,6 +301,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Models.Project", b => { + b.HasOne("Models.File", "ProjectIcon") + .WithMany() + .HasForeignKey("ProjectIconId"); + b.HasOne("Models.User", "User") .WithMany("Projects") .HasForeignKey("UserId") diff --git a/IdentityServer/Configuration/IdentityConfig.cs b/IdentityServer/Configuration/IdentityConfig.cs index 94d55eb9..0365a291 100644 --- a/IdentityServer/Configuration/IdentityConfig.cs +++ b/IdentityServer/Configuration/IdentityConfig.cs @@ -55,6 +55,7 @@ public static IEnumerable GetIdentityResources() new Scope(nameof(Defaults.Scopes.HighlightRead)), new Scope(nameof(Defaults.Scopes.EmbedWrite)), new Scope(nameof(Defaults.Scopes.EmbedRead)), + new Scope(nameof(Defaults.Scopes.FileWrite)) } } }; @@ -81,7 +82,8 @@ public static IEnumerable Clients(Config config) nameof(Defaults.Scopes.HighlightRead), nameof(Defaults.Scopes.HighlightWrite), nameof(Defaults.Scopes.EmbedWrite), - nameof(Defaults.Scopes.EmbedRead) + nameof(Defaults.Scopes.EmbedRead), + nameof(Defaults.Scopes.FileWrite) }, Claims = new List { diff --git a/Models/Defaults/Defaults.cs b/Models/Defaults/Defaults.cs index b93d3196..ae36febf 100644 --- a/Models/Defaults/Defaults.cs +++ b/Models/Defaults/Defaults.cs @@ -34,6 +34,13 @@ public static class Privacy } + public class Path + { + + public static string filePath; + + } + public static class Roles { @@ -112,6 +119,9 @@ public static class Scopes [Description("This scope gives write access to the Insitution namespace.")] public const string InstitutionWrite = "institution:write"; + [Description("This scope gives write access to the file namespace")] + public const string FileWrite = "file:write"; + } } diff --git a/Models/Exceptions/FileExistException.cs b/Models/Exceptions/FileExistException.cs new file mode 100644 index 00000000..03cf61fa --- /dev/null +++ b/Models/Exceptions/FileExistException.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Models.Exceptions +{ + /// + /// File already exists exception + /// + [Serializable] + public class FileExistException : Exception + { + /// + /// File already exist constructor + /// + /// + public FileExistException(string name) + : base($"File {name} already exists") + { } + } +} diff --git a/Models/File.cs b/Models/File.cs new file mode 100644 index 00000000..4739a63e --- /dev/null +++ b/Models/File.cs @@ -0,0 +1,44 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using System; +using System.ComponentModel.DataAnnotations; + +namespace Models +{ + public class File + { + public File() { } + + public File(string path, string name, User uploader, DateTime uploadDateTime) + { + Path = path; + Name = name; + Uploader = uploader; + UploadDateTime = uploadDateTime; + } + + public int Id { get; set; } + [Required] + public string Path { get; set; } + public DateTime UploadDateTime { get; set; } + public string Name { get; set; } + [Required] + public User Uploader { get; set; } + + } +} diff --git a/Models/Project.cs b/Models/Project.cs index c22868e3..c23b01a8 100644 --- a/Models/Project.cs +++ b/Models/Project.cs @@ -56,6 +56,10 @@ public Project() [Required] public DateTime Updated { get; set; } + public int? ProjectIconId { get; set; } + + public File ProjectIcon { get; set; } + } } diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index 9281e4b6..19a53503 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "b3512cae-ecd6-4f18-9da9-20007d67e145", + "_postman_id": "17b78cc6-c6e3-4729-9e9c-7c14ab0f0153", "name": "Digital-Excellence-API", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "568853cf-d095-4e3b-bce6-72b90efb8d7f", + "id": "e4d675c8-df1c-46c3-8797-246dd4f9a11e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "a74ba107-101e-4611-8999-551342ce3262", + "id": "c7716dc8-f6d7-4def-b4fc-4f429cf92c41", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -134,7 +134,7 @@ { "listen": "test", "script": { - "id": "d3679468-0b5a-4345-b7c7-211dbde99c64", + "id": "aadc9346-397e-4376-8182-bafe44566f18", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -203,7 +203,7 @@ { "listen": "test", "script": { - "id": "d3a0ba96-eaa4-41f4-a725-76d56ac959ad", + "id": "b5e30ffe-7109-489a-8519-f7f5f2d7341d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -271,7 +271,7 @@ { "listen": "test", "script": { - "id": "d16a4918-c6a2-4e5f-a6b4-31cf93cdf800", + "id": "a4ed493b-eac8-470a-a674-629492c71937", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -339,7 +339,7 @@ { "listen": "test", "script": { - "id": "39437434-f1e4-4ea3-8d6d-f46c086588fc", + "id": "53f1ad3d-7eda-4933-a643-940ae0871da9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -414,7 +414,7 @@ { "listen": "test", "script": { - "id": "498207f3-e29a-4de0-b17e-93e3e1c9a834", + "id": "7b0edfd4-de29-4bb9-9094-3d40399992f5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -479,7 +479,7 @@ { "listen": "test", "script": { - "id": "7c525034-1ea2-4c1b-9c9d-ddd6ebae5808", + "id": "0d37d129-845f-429f-b693-b7315418e217", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -557,7 +557,7 @@ { "listen": "test", "script": { - "id": "db03d8c3-1d72-421b-957e-0101a0486f60", + "id": "cb3af99c-f8dd-4ad0-9171-65947875e59c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -630,7 +630,7 @@ { "listen": "test", "script": { - "id": "be9bf4cf-3f51-4c4d-aba1-08ce2a6c0ee4", + "id": "a7ecd991-abb3-48e7-a4ad-1de76e82df22", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -699,7 +699,7 @@ { "listen": "test", "script": { - "id": "b1c189e9-2ddd-411a-aec3-2de2e49aafb2", + "id": "074fd171-164a-44ee-8442-a044f91be043", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -767,7 +767,7 @@ { "listen": "test", "script": { - "id": "29b03f03-90c0-4219-aee3-c06fd94abdaa", + "id": "ecb8fbf5-e127-43b8-aad2-1754e90c5c4e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -835,7 +835,7 @@ { "listen": "test", "script": { - "id": "fe12c976-14c4-4950-ab77-7a8ed8dfb8c0", + "id": "b76f3fcc-e708-4f4a-adf4-f0d024b30a77", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -895,7 +895,7 @@ { "listen": "test", "script": { - "id": "32248fcd-b305-4b8d-9ebb-e239e685705b", + "id": "1b80675c-37b3-4b41-928d-437c1303f928", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -924,7 +924,7 @@ { "listen": "prerequest", "script": { - "id": "b83bc5e6-e276-4714-8a11-2a49b53f47c2", + "id": "4e3f5ced-0c43-4cfe-80b4-b491bae18b8e", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -974,7 +974,7 @@ { "listen": "test", "script": { - "id": "e4fe8480-a165-4abe-a820-ca4ddeedf53c", + "id": "7451b779-6f5e-4dba-bbf5-a243b5e152a6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1043,7 +1043,7 @@ { "listen": "test", "script": { - "id": "22f8a2c4-ec7b-4814-b41a-964a26b3314b", + "id": "c7123522-e8d9-44d8-a417-d198e64ef932", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1105,7 +1105,7 @@ { "listen": "test", "script": { - "id": "6cf43faf-159b-4011-bf77-10cb48f82010", + "id": "1dc455c3-20fb-4e86-9c51-e3a797c77922", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1192,7 +1192,7 @@ { "listen": "test", "script": { - "id": "40d96fc0-6f5d-435d-9592-480a0c16c328", + "id": "9dfc4423-f148-4c6e-98b6-c513ae9de51c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1224,7 +1224,7 @@ { "listen": "prerequest", "script": { - "id": "c70d1815-5c77-44fa-a097-b1db232e77cc", + "id": "d97575fb-d17e-41f0-95a2-7b46081228b1", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1271,7 +1271,7 @@ { "listen": "test", "script": { - "id": "84027fd3-342a-462d-922d-bd5dd289c6ca", + "id": "334387db-3880-42f1-b929-5a169322fd42", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1330,7 +1330,7 @@ { "listen": "test", "script": { - "id": "23339c58-61b0-4222-b563-c09e3f4a4d9b", + "id": "de6a3894-bb53-481f-b171-6073eae247d5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1391,7 +1391,7 @@ { "listen": "test", "script": { - "id": "d41caa39-845e-4a55-bd72-b81e67a4dbda", + "id": "7637688b-9c35-46e2-bc16-939ad0a1a50d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1455,7 +1455,7 @@ { "listen": "test", "script": { - "id": "cfef8aba-4a7d-4c42-90a5-05351fda33e4", + "id": "effdff56-a369-418e-86ea-b56f5ae107fb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1524,7 +1524,7 @@ { "listen": "test", "script": { - "id": "a4373a0d-2e9b-4611-876c-59a22338dc64", + "id": "39705b80-c1d8-49ee-9214-32127968ca94", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -1582,7 +1582,7 @@ { "listen": "test", "script": { - "id": "7b47898e-b22f-4dce-983b-3c344342d2d7", + "id": "e477086d-d852-41f3-9a5d-9e5cd103ce9c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1636,7 +1636,7 @@ { "listen": "test", "script": { - "id": "5fbf8c98-fb9a-41df-8ef5-4bae0faab079", + "id": "81373fed-1633-40a3-b82f-6c7f021d1684", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1697,7 +1697,7 @@ { "listen": "test", "script": { - "id": "84cc7913-5f49-4698-b5ad-63b5ff08fbe8", + "id": "bc07c9cb-b01e-4862-8df8-4382546bf60f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -1770,7 +1770,7 @@ { "listen": "test", "script": { - "id": "e8322644-7e18-41a2-8626-490688ef59ff", + "id": "1100c1f1-9386-406f-95a4-9c9e77cb77ae", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -1843,7 +1843,7 @@ { "listen": "test", "script": { - "id": "11677dc5-2c53-49a0-9dc9-7f2c26e47029", + "id": "2839d834-c985-46eb-9e0c-462fce7cce6f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1909,7 +1909,7 @@ { "listen": "test", "script": { - "id": "a31f483b-471b-49cb-acd7-3b0a011db464", + "id": "363f5c68-996f-4164-8192-ea964d5140ff", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -1968,7 +1968,7 @@ { "listen": "test", "script": { - "id": "bfd77a49-5900-42da-890f-25d6db2d90f1", + "id": "40850dfd-7968-43b8-a232-e6e9d17315e4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2035,7 +2035,7 @@ { "listen": "test", "script": { - "id": "a8aab8c4-8442-4c84-9f13-8e7ce80c4404", + "id": "aa73512b-9605-483c-b275-691563dc7dee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2093,7 +2093,7 @@ { "listen": "test", "script": { - "id": "1de15b3f-6c1b-41cd-b784-b86ad7f8b9c3", + "id": "c0c50e9b-8a35-4c01-8fb0-10a2127560c3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2172,7 +2172,7 @@ { "listen": "test", "script": { - "id": "f82c7f67-7335-449e-a617-186e32417ce3", + "id": "5b1e6244-3bce-423f-a6d0-807d281dea08", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2230,7 +2230,7 @@ { "listen": "test", "script": { - "id": "73037dd6-71f3-4379-8b07-b9bc1e129e54", + "id": "25f038a6-b20a-4739-96d6-36913cd12703", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2291,7 +2291,7 @@ { "listen": "test", "script": { - "id": "ad5c91ae-d6c8-4eca-9265-7f8f76621383", + "id": "81e2007a-3ef3-43f7-8551-828db97b8cbf", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2357,7 +2357,7 @@ { "listen": "test", "script": { - "id": "bb76435f-c28b-4291-b0b1-b6215c21774e", + "id": "dfa71273-4203-43a7-a0fb-9a66374f7da7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2423,7 +2423,7 @@ { "listen": "test", "script": { - "id": "ec449042-6ddf-49b1-8ce3-09d352bf9e7e", + "id": "9a85b31f-e86c-48eb-b877-f348752a310d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var institutionName = pm.environment.get(\"institutionName\");", @@ -2491,7 +2491,7 @@ { "listen": "test", "script": { - "id": "e9d649e8-c9e3-4d4b-9317-6fac21ccedb4", + "id": "4fef7ef6-64d3-43be-a02a-7f2c7026b93e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", @@ -2554,7 +2554,7 @@ { "listen": "test", "script": { - "id": "43216e86-a81f-48ee-a766-9530f7c35507", + "id": "d20c866f-308b-4217-82df-2574460f44fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var institutionName = pm.environment.get(\"updatedInstitutionName\");", @@ -2622,7 +2622,7 @@ { "listen": "test", "script": { - "id": "a2076029-2e34-4163-b6b8-f73711ec837c", + "id": "644eb441-a0f2-44c7-8d57-ec7a4d345f65", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", @@ -2699,7 +2699,7 @@ { "listen": "test", "script": { - "id": "5cf1d90a-7368-4132-862a-00c811b2b508", + "id": "7c43b2c0-341d-404d-aab7-557ecb43d975", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2744,7 +2744,7 @@ { "listen": "test", "script": { - "id": "42f54bc9-ec9e-4eaf-80f2-f0f44d982df8", + "id": "5a2da150-9435-46ae-8258-35195629f87c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2789,7 +2789,7 @@ { "listen": "test", "script": { - "id": "dbd0c2a3-2e3e-44e4-a17f-01c8cd01bf45", + "id": "21ad5897-257b-4084-bb27-dc6446596044", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2834,7 +2834,7 @@ { "listen": "test", "script": { - "id": "3a5b32f1-8ee3-4671-8f29-4c11e5866442", + "id": "bda79cba-4dcb-43a1-bda9-e9239cfb92de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2879,7 +2879,7 @@ { "listen": "test", "script": { - "id": "fef623fa-7285-49f7-8e07-643d910e2cf2", + "id": "1e5aad1e-b92f-49fb-b898-c97b8f8db6c8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2924,7 +2924,7 @@ { "listen": "test", "script": { - "id": "2ab1d274-475c-484f-b79f-4e589c9c7b8a", + "id": "d7c3380b-1b23-4129-b791-909452009993", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2969,7 +2969,7 @@ { "listen": "test", "script": { - "id": "0d96120a-3df6-44fe-8c58-1c1f4151f7de", + "id": "0aee9f9e-cfc4-4715-b1c1-9251b5b541e5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3021,7 +3021,7 @@ { "listen": "test", "script": { - "id": "d0743633-0349-4cde-94e3-af7fdecfec08", + "id": "42966f10-7f63-4a30-8428-036e4f8c4472", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3072,7 +3072,7 @@ { "listen": "test", "script": { - "id": "99c5e7d5-981d-4ccc-964f-7827267402cf", + "id": "20c23aa4-1167-4925-8fc7-691dc7caf8c0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3123,7 +3123,7 @@ { "listen": "test", "script": { - "id": "568de2a1-82a9-47b8-b006-09e36f4a8bdd", + "id": "b52032b5-a591-4ef9-b311-97efa08d7803", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3174,7 +3174,7 @@ { "listen": "test", "script": { - "id": "1321254d-c67d-409d-8b15-d35e754279d8", + "id": "3e2e6a18-0092-4a6e-86d4-00baf47a69be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3225,7 +3225,7 @@ { "listen": "test", "script": { - "id": "158001e1-cba7-4f2c-8476-73774d13231a", + "id": "b7a3d215-79cd-40b9-9fd2-6746124b848a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3276,7 +3276,7 @@ { "listen": "test", "script": { - "id": "af0f614e-fb8f-45bc-b4e4-e209a6813314", + "id": "9878ec5d-a679-45fa-b4c3-8f7ea37d5013", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3324,6 +3324,176 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "File-CreateFile-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "85272f6c-c757-449a-9f64-e36299faaf85", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"adminFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Files-GetAll-Adminstrator", + "event": [ + { + "listen": "test", + "script": { + "id": "8c028bd5-e4c2-47a7-9aaf-c3ed104f3537", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "File-Delete-Administrator", + "event": [ + { + "listen": "test", + "script": { + "id": "77118faf-217e-4477-8f50-d6a9f3106a38", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{adminFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{adminFileId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, @@ -3341,7 +3511,7 @@ { "listen": "test", "script": { - "id": "0c0c6596-b713-4570-8bc4-44f5b731447c", + "id": "cd71ac74-15e7-47a7-acc6-647a005ddf64", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -3419,7 +3589,7 @@ { "listen": "test", "script": { - "id": "97c40e04-aac0-4dfc-ae46-fb71622409de", + "id": "f4e4c4f7-58e6-4b80-b3fe-72f30b08e3e5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -3448,7 +3618,7 @@ { "listen": "prerequest", "script": { - "id": "0a7a4b5e-079e-4624-b79e-9f3878ce1ce2", + "id": "fdc74da0-1a13-445c-b49b-3da300ff4ed3", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -3498,7 +3668,7 @@ { "listen": "test", "script": { - "id": "66976c67-07a1-4148-9a01-111e65aadef6", + "id": "10683efa-08ee-4b6e-84ef-d1c13397a70a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3562,7 +3732,7 @@ { "listen": "prerequest", "script": { - "id": "8d93ee50-ff46-4c72-b214-dc139e6f3ea1", + "id": "ecff05dc-03bc-410d-a57e-5199fede5b2b", "type": "text/javascript", "exec": [ "" @@ -3572,7 +3742,7 @@ { "listen": "test", "script": { - "id": "a2c49225-a7d9-4821-90a0-34e2f7c58ddb", + "id": "77be045b-6aaf-4bc1-afa1-1c15ec0ead5c", "type": "text/javascript", "exec": [ "" @@ -3592,7 +3762,7 @@ { "listen": "test", "script": { - "id": "763389a0-5666-497e-8ce9-997a415e63d6", + "id": "671f89fd-75bc-49e5-9899-9d0e52a24833", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3650,7 +3820,7 @@ { "listen": "test", "script": { - "id": "affe213e-50f6-48bf-b695-63f1bd343a05", + "id": "86cf1c0d-67c3-49ef-8bee-e3cdbc37f30e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3700,7 +3870,7 @@ { "listen": "test", "script": { - "id": "30da528a-89b4-4cb1-8b31-cb17c543ca0f", + "id": "ebb5a9fc-98f7-4968-8346-868824cd28a4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3759,7 +3929,7 @@ { "listen": "test", "script": { - "id": "91d4357b-a0f7-433d-ab6a-3dd8058c74b8", + "id": "95b3df87-709d-4658-8f91-6d3d1443961f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3808,7 +3978,7 @@ { "listen": "prerequest", "script": { - "id": "7e81fa6d-9ffb-4d38-9727-ebb2ed80f60f", + "id": "9d980c96-f5da-4cfb-b349-0088e5521248", "type": "text/javascript", "exec": [ "" @@ -3818,7 +3988,7 @@ { "listen": "test", "script": { - "id": "4bca4c06-e14d-400c-b104-6007cf228bad", + "id": "27db928e-0f7b-4911-ba23-3c56de2d5f25", "type": "text/javascript", "exec": [ "" @@ -3838,7 +4008,7 @@ { "listen": "test", "script": { - "id": "efe0804b-a9dd-40dd-aa92-643045e6235a", + "id": "a77564bb-336a-440c-a13c-10cea22aa14e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3898,7 +4068,7 @@ { "listen": "test", "script": { - "id": "d9ae44d6-9a24-44ce-a575-31883f0eaa9f", + "id": "2a487fcd-3836-4008-b74b-30f7e5a61f80", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -3968,7 +4138,7 @@ { "listen": "test", "script": { - "id": "b9b2cb24-c591-48fe-b82f-25712b1355e5", + "id": "4a5a9792-3d83-49d0-baf9-1b2e2ff23cae", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -4023,7 +4193,7 @@ { "listen": "test", "script": { - "id": "08b37e12-1335-4d8c-93e3-9716268ac01c", + "id": "e340a938-0f46-415f-aa82-aaed4146afb2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4080,7 +4250,7 @@ { "listen": "test", "script": { - "id": "eff4dc08-f719-4591-84df-ef5e9b6ed2d5", + "id": "f615a264-0f33-4bf2-a9cb-c381f470b3cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4129,7 +4299,7 @@ { "listen": "prerequest", "script": { - "id": "904358ef-5d56-4b02-8197-7706242c53d0", + "id": "d9c26743-4a65-4a66-b1ac-2a510ad02aa3", "type": "text/javascript", "exec": [ "" @@ -4139,7 +4309,7 @@ { "listen": "test", "script": { - "id": "4d623819-5c86-4a13-bb39-35a6bc4f6d96", + "id": "cb4569b2-b65d-4b15-8966-ad11a0e01d6a", "type": "text/javascript", "exec": [ "" @@ -4159,7 +4329,7 @@ { "listen": "test", "script": { - "id": "1acbfe0d-8bdd-473c-ba19-fdc0e1462d65", + "id": "ee5e5562-3909-49f6-8565-3fc5f966bf2b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4186,7 +4356,7 @@ { "listen": "prerequest", "script": { - "id": "c46d438e-99f0-436d-b116-5fa37a48683d", + "id": "f7a59e5e-b66f-4fc2-9926-d6815514c0f2", "exec": [ "" ], @@ -4225,7 +4395,7 @@ { "listen": "test", "script": { - "id": "1f5a87ce-8431-48c4-860e-a55df4fea262", + "id": "59f2bb7e-9518-467e-9d90-7e4eb3b2042d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -4270,7 +4440,7 @@ { "listen": "test", "script": { - "id": "4359c796-1d7c-4a3c-9572-4e38047014a5", + "id": "75f8d7ea-557b-463e-9fc3-ed43f5b479db", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", @@ -4325,7 +4495,7 @@ { "listen": "test", "script": { - "id": "b83a01a5-f205-4850-9568-c29a5b0cd699", + "id": "f3cfe7c6-da7c-4c6b-abc9-95d6c686fcad", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4374,7 +4544,7 @@ { "listen": "test", "script": { - "id": "f2b1ce0c-58c5-4523-b1e0-58f3e192ec23", + "id": "c50b2fd0-1777-491f-b1e5-718cd5f7233f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4401,7 +4571,7 @@ { "listen": "prerequest", "script": { - "id": "d4264917-3672-48fd-bcb7-ebd1ac0408da", + "id": "11977df8-0c6c-4121-8701-96e906f0a95d", "exec": [ "" ], @@ -4441,7 +4611,7 @@ { "listen": "test", "script": { - "id": "b4073b4e-7bf3-49a2-beb0-59e32189133a", + "id": "185d8587-0452-4aa0-8a73-04e476c51f55", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4490,7 +4660,7 @@ { "listen": "prerequest", "script": { - "id": "65c4d09a-c093-4cfb-b456-12f592e4948c", + "id": "8d274820-220a-45f5-9843-f8978e3d63a1", "type": "text/javascript", "exec": [ "" @@ -4500,7 +4670,7 @@ { "listen": "test", "script": { - "id": "b5a807a1-e49d-4ce7-9926-e273add34764", + "id": "cdadcea1-57de-42d6-b0d1-8c83349fea15", "type": "text/javascript", "exec": [ "" @@ -4520,7 +4690,7 @@ { "listen": "test", "script": { - "id": "181d6378-1dd7-4ada-aab7-f26dc2e117c2", + "id": "73a273af-200b-4f1e-95e5-e2fa5e9eb92a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4575,7 +4745,7 @@ { "listen": "test", "script": { - "id": "54cbbdc6-b309-455a-9fde-1925594aae91", + "id": "ec49bd8f-d968-4824-a250-084e7a95c875", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4621,7 +4791,7 @@ { "listen": "test", "script": { - "id": "00ab5074-5846-4aa8-bc07-010b735fe110", + "id": "9637bc13-0fd6-428e-9fd2-fc7b4b823a56", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4668,7 +4838,7 @@ { "listen": "test", "script": { - "id": "97acdaa7-13b7-4902-9e4f-955baa14b97c", + "id": "42cec933-bc78-4945-9f63-da3a50f0971b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4717,7 +4887,7 @@ { "listen": "prerequest", "script": { - "id": "a91b7dfc-cbb5-43c1-b7a8-327ca5bf48bd", + "id": "c197006e-8277-46c5-a469-394768b92cc6", "type": "text/javascript", "exec": [ "" @@ -4727,7 +4897,7 @@ { "listen": "test", "script": { - "id": "8676df00-9361-483f-b1c0-3bc807667740", + "id": "7c2172d0-c9dd-4078-8423-f4622e9ea074", "type": "text/javascript", "exec": [ "" @@ -4747,7 +4917,7 @@ { "listen": "test", "script": { - "id": "cdf78829-afba-4fec-8756-7cd46d4a784d", + "id": "dfffac94-7033-4a08-9fe0-c9e49d266f87", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4803,7 +4973,7 @@ { "listen": "test", "script": { - "id": "5aedaaa6-1900-4ff5-b1ab-8b6607298e92", + "id": "e5c612de-3f27-492d-9aa2-5d98f2e2a382", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4850,7 +5020,7 @@ { "listen": "test", "script": { - "id": "a96dbcae-ad6c-4d26-bbd4-ff18586deaa3", + "id": "f062e3c8-864b-4bea-92aa-358f521e210c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4898,7 +5068,7 @@ { "listen": "test", "script": { - "id": "37a4b06f-9734-48bb-b792-2c6933406e21", + "id": "847da1c0-a0b3-4760-b799-207ae34eed31", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4946,7 +5116,7 @@ { "listen": "test", "script": { - "id": "cbc9aa2e-bd1a-4407-b225-235463237f15", + "id": "9fbc2499-629b-419c-9d68-cceea25737f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5003,7 +5173,7 @@ { "listen": "test", "script": { - "id": "3a93e128-2f5e-48a3-b0cc-052c91232551", + "id": "96556495-8fa2-47da-87ea-51e7b3885f8e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5074,7 +5244,7 @@ { "listen": "prerequest", "script": { - "id": "9d25dba5-2dcd-4a11-8287-c653d09f1661", + "id": "67cd2870-c414-44ac-81a9-ad7b0a795db8", "type": "text/javascript", "exec": [ "" @@ -5084,7 +5254,7 @@ { "listen": "test", "script": { - "id": "93fd5588-3bf3-4275-b5fa-1453203a8aa1", + "id": "0ff0dc84-c653-4942-85f3-7d90244c1b8b", "type": "text/javascript", "exec": [ "" @@ -5104,7 +5274,7 @@ { "listen": "test", "script": { - "id": "a610852b-fbef-4a0f-8f7f-68f8ad25a5a8", + "id": "5fb3275c-40aa-4a2d-89d5-167edc894b9a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5155,7 +5325,7 @@ { "listen": "prerequest", "script": { - "id": "077df9c1-3744-48c2-87d8-18bf785452ed", + "id": "62e021ad-d0c0-47ea-96fd-d122e1342e77", "type": "text/javascript", "exec": [ "" @@ -5165,7 +5335,7 @@ { "listen": "test", "script": { - "id": "a5394ee3-96d8-4f42-be9e-2aead5ff385c", + "id": "b22f600a-e78b-4554-9ab1-dea72c26f62b", "type": "text/javascript", "exec": [ "" @@ -5185,7 +5355,7 @@ { "listen": "test", "script": { - "id": "566d6355-d487-40f9-a4cf-e79d073d48b4", + "id": "41ab80fa-7b5e-4d65-8937-3249927b5367", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5241,7 +5411,7 @@ { "listen": "prerequest", "script": { - "id": "329139f5-30f2-45de-8bc5-b60b749479ff", + "id": "260bf6b0-68e5-4732-8745-89d8da7088cd", "type": "text/javascript", "exec": [ "" @@ -5251,7 +5421,7 @@ { "listen": "test", "script": { - "id": "10279a00-8a5c-4379-97f6-5f5eef8c3889", + "id": "5f0333e5-0922-49e3-8cf6-e4c8bf53d000", "type": "text/javascript", "exec": [ "" @@ -5271,7 +5441,7 @@ { "listen": "test", "script": { - "id": "91e060e8-ddaa-4c7e-aaf1-add0482f3d86", + "id": "f811924a-e646-47d0-9260-3de6276dc6eb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5329,7 +5499,7 @@ { "listen": "test", "script": { - "id": "489e3de4-5045-4876-9232-a0c5464826de", + "id": "25891708-22c7-406b-8573-66ef96c37e5b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5379,7 +5549,7 @@ { "listen": "test", "script": { - "id": "79bd41e1-d47e-4432-a839-6f7ea8698a83", + "id": "d3ff2e2c-0838-4411-8681-39a4ee64ff9b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5438,7 +5608,7 @@ { "listen": "test", "script": { - "id": "374ece63-fbb5-4d58-b282-a89e17fd8958", + "id": "b0bcedcb-0bf0-49c1-a7ae-cdcdc3cce922", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5487,7 +5657,7 @@ { "listen": "prerequest", "script": { - "id": "37272cf8-6e7e-46ec-9d29-5a1805232398", + "id": "06f1a2be-350e-4609-ba81-3b0b386f4f34", "type": "text/javascript", "exec": [ "" @@ -5497,7 +5667,7 @@ { "listen": "test", "script": { - "id": "83084b33-5da2-4e73-aaea-ad34e0d53856", + "id": "3f90d52d-1fbd-4ded-aecd-1a0a9278be42", "type": "text/javascript", "exec": [ "" @@ -5507,13 +5677,170 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "14d87563-37e6-43b6-b44a-2645295fcb35", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "ba556b21-4b95-4579-9747-d1604e0595c1", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "File-Delete-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "9951dae5-5425-46d1-92f7-8ab03cb2acb3", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "1" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "event": [ { "listen": "prerequest", "script": { - "id": "caf35d96-6c2e-4846-b9e6-2baf340f3cef", + "id": "6e02c091-0900-41a0-9077-ccd2cad6865f", "type": "text/javascript", "exec": [ "" @@ -5523,7 +5850,7 @@ { "listen": "test", "script": { - "id": "5ab2e293-da9f-4f12-ba80-069e05790dcf", + "id": "cfa8ffe4-be64-49d4-9a46-8030a6df07aa", "type": "text/javascript", "exec": [ "" @@ -5546,7 +5873,7 @@ { "listen": "test", "script": { - "id": "d01622a4-6f97-4471-959a-7bf015814685", + "id": "efd93081-8109-45ac-b1d2-bef2e418a022", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -5615,7 +5942,7 @@ { "listen": "test", "script": { - "id": "cddce38e-5f62-457b-9507-e599884f478c", + "id": "6ae0aada-43ba-4ed3-a1d6-ac07eb691955", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -5694,7 +6021,7 @@ { "listen": "test", "script": { - "id": "311ba597-b48c-4c34-8518-5107ea4cca25", + "id": "d87e9bb5-e8d3-4308-8e73-1f38b28e004b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -5723,7 +6050,7 @@ { "listen": "prerequest", "script": { - "id": "9569e97d-822a-4855-8211-263649e6b0a3", + "id": "554822e8-5590-43c7-a1ce-49d05282c104", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -5773,7 +6100,7 @@ { "listen": "test", "script": { - "id": "ed5bc65b-9c4e-4b24-a6dd-7a7e5b1d365a", + "id": "4e4d5265-22c1-4054-8f9f-66b115f6d9f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5838,7 +6165,7 @@ { "listen": "test", "script": { - "id": "f917c6aa-9bbe-4b66-82d4-1cb94ec39c8e", + "id": "be427964-77e0-4af5-91fa-dae6fb4bd6e4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -5911,7 +6238,7 @@ { "listen": "prerequest", "script": { - "id": "3058e1f6-8eac-42ab-a31c-f239fff796a5", + "id": "f8f49158-b549-4ee3-8de5-080b2da90e99", "type": "text/javascript", "exec": [ "" @@ -5921,7 +6248,7 @@ { "listen": "test", "script": { - "id": "476b0244-8385-4a05-872f-896b32e61142", + "id": "3f294db4-f835-420e-ad6a-200940613df9", "type": "text/javascript", "exec": [ "" @@ -5941,7 +6268,7 @@ { "listen": "test", "script": { - "id": "f3624c3d-6163-4379-913e-5992562cb7b5", + "id": "dcebc4c3-4c24-4a64-a650-5b5dda77614d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -6001,7 +6328,7 @@ { "listen": "test", "script": { - "id": "946710bf-d82a-493f-899c-c445c226ef57", + "id": "faafd754-5b00-485c-a39a-2fdea04a741b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6054,7 +6381,7 @@ { "listen": "test", "script": { - "id": "9288fcfd-8ebf-41f3-9b4f-07d7ebafad51", + "id": "67370901-142d-4541-9072-ea5e645aa766", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", @@ -6112,7 +6439,7 @@ { "listen": "test", "script": { - "id": "6a21ad86-40cc-47a9-bdab-9c7bc598f255", + "id": "6b3e7c4b-8d93-41f1-9905-4674304ede00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -6179,7 +6506,7 @@ { "listen": "test", "script": { - "id": "0e38744d-5e92-4a92-be7a-c6fca4b2d455", + "id": "f1540f96-73ce-4ead-9403-66a8f37f3850", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6241,7 +6568,7 @@ { "listen": "prerequest", "script": { - "id": "03a3ecb6-3c5f-48de-a77a-bfe2970666e5", + "id": "b83e9c1b-08d3-49ab-ba7c-053467c331c3", "type": "text/javascript", "exec": [ "" @@ -6251,7 +6578,7 @@ { "listen": "test", "script": { - "id": "cc4e4f50-a7f6-41f1-a5b2-cb5a7a6b3267", + "id": "fc0a5f95-1a5d-4f1e-961a-6b0dab9839ba", "type": "text/javascript", "exec": [ "" @@ -6271,7 +6598,7 @@ { "listen": "test", "script": { - "id": "c3023a01-8f19-41d5-af68-c60d974d3735", + "id": "edb62e93-a646-4a3c-bca7-a082e0e7f589", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"registeredUserId\");", @@ -6337,7 +6664,7 @@ { "listen": "test", "script": { - "id": "676d2c2f-ae2c-4d15-a1d3-02593e62f0eb", + "id": "26f2437c-db69-4236-9dcd-8b21c44f2459", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6410,7 +6737,7 @@ { "listen": "test", "script": { - "id": "f96c90b5-8c4d-4682-9941-bdc3af14067a", + "id": "86005a6d-9972-4a7d-83f9-a17c857168d9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -6468,7 +6795,7 @@ { "listen": "test", "script": { - "id": "789e2fec-ae9d-4a09-a962-bc92311b6139", + "id": "9774571e-e32a-4358-a1b9-88b3669a8203", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -6518,7 +6845,7 @@ { "listen": "test", "script": { - "id": "8298c381-928e-499c-93b7-2f14b0dbdc3a", + "id": "ddb2a53e-de53-4536-9506-71c893a76867", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -6585,7 +6912,7 @@ { "listen": "test", "script": { - "id": "121f9d73-4a84-41e0-ba5f-124f79e83427", + "id": "76994717-5513-4023-ade0-ab788f4fcb55", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6652,7 +6979,7 @@ { "listen": "test", "script": { - "id": "5fa8df5a-7643-4dad-8983-eddd67122405", + "id": "f5026ba1-debf-4ce5-807a-d0f9e336fe1c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6716,7 +7043,7 @@ { "listen": "test", "script": { - "id": "8ef5073a-9cb0-478f-b2f9-0d1baf34ece9", + "id": "876760ad-6493-41a4-8f6d-2c27a93b979b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6777,7 +7104,7 @@ { "listen": "test", "script": { - "id": "59010dc5-c53c-45d6-be38-25a5293433ee", + "id": "9e214472-9d70-4d6e-8c01-83976c8495a5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6829,7 +7156,7 @@ { "listen": "test", "script": { - "id": "8065f986-71a3-46af-85d5-769ac77a38ad", + "id": "b22dc234-2a05-4601-baf2-9f7384efb11f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -6894,7 +7221,7 @@ { "listen": "test", "script": { - "id": "379dcce8-1326-4caa-a929-f55be3670530", + "id": "7efbf02f-139f-4cff-bba4-f3864f6542f9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -6920,7 +7247,7 @@ { "listen": "prerequest", "script": { - "id": "77b78bbc-05c7-45fe-9b75-c8e0aaf702e8", + "id": "752ac1b2-c8b1-4b5b-9086-543c78552815", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -6970,7 +7297,7 @@ { "listen": "test", "script": { - "id": "060f5504-02cd-4630-bc14-f35b7cc08b65", + "id": "9bfcd63c-8684-4014-bd35-7859ab45f76d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -7039,7 +7366,7 @@ { "listen": "test", "script": { - "id": "02dd708d-c226-4a9a-b1aa-5f726a1d0614", + "id": "ad18dc21-d5c4-4092-8323-ef66c7ab4971", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -7101,7 +7428,7 @@ { "listen": "test", "script": { - "id": "f247250e-25f0-4fa8-91fe-8724d0520f9a", + "id": "4bf927f8-475e-4193-99c7-ff95aa591dbc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7156,7 +7483,7 @@ { "listen": "test", "script": { - "id": "f49bce60-7be5-4a41-875b-db62228cfd78", + "id": "9dfd1aab-6539-4670-a5d4-38b8a54a93c4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7225,7 +7552,7 @@ { "listen": "test", "script": { - "id": "a0e15975-2cd2-4b09-9e2c-23c9068a8de2", + "id": "35c63c9a-c35d-4899-a28c-ca33c64e088b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7286,7 +7613,7 @@ { "listen": "test", "script": { - "id": "e20fdfa9-7e06-4664-8d3c-bcf61d770fb3", + "id": "3015ac09-96d1-44b3-b967-cf7c26377b42", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7338,7 +7665,7 @@ { "listen": "test", "script": { - "id": "7f41ee44-8ffa-4238-9025-117f45d1e17a", + "id": "8af24dc4-dd95-4b01-bef4-e906e09aafd9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7391,7 +7718,7 @@ { "listen": "test", "script": { - "id": "5a3a2127-0857-40ba-9468-f6f77816f4bb", + "id": "22654e7f-c52f-4dff-9c63-9a478d21c94b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7444,7 +7771,7 @@ { "listen": "test", "script": { - "id": "8f74c061-052d-4e43-b27a-a739dd91329e", + "id": "0204ec41-2a06-456a-8699-a05401d3f3ec", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7506,7 +7833,7 @@ { "listen": "test", "script": { - "id": "51d1e695-da09-4f81-974d-0bf5c7e915b4", + "id": "11751929-42b8-4d98-b79f-b6840b79a0dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7587,7 +7914,7 @@ { "listen": "test", "script": { - "id": "9786dc0c-883b-4e8d-99f7-94bf46ad751c", + "id": "4a8ca9a8-6d27-4fed-a5bd-44f638845746", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7646,7 +7973,7 @@ { "listen": "test", "script": { - "id": "4224789a-9618-4d21-9f47-1a2fad0fa288", + "id": "6e5bfd98-52ac-4f1e-8e73-0cf95683d5a9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -7712,7 +8039,7 @@ { "listen": "test", "script": { - "id": "6e60604b-2daa-41d5-9d5c-bdc1539a6770", + "id": "4d7bffe7-a0d0-48ff-8d2c-beeb7cb0596d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7770,7 +8097,7 @@ { "listen": "test", "script": { - "id": "189b7378-8446-4b26-a0d0-1eba394821b9", + "id": "1978807d-71c6-40cc-a3f6-d55a2d234b08", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7820,7 +8147,7 @@ { "listen": "test", "script": { - "id": "d77e4fb9-b783-4834-b6bd-290328a07b5b", + "id": "06a45ad6-d8f9-4c5e-a7ea-7cd084f850ed", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7879,7 +8206,7 @@ { "listen": "test", "script": { - "id": "0c85da4b-4a83-400f-9a40-324da601a43d", + "id": "e7c61104-3ae2-44f6-a1c6-5909aa4fee58", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7928,7 +8255,7 @@ { "listen": "prerequest", "script": { - "id": "f4ace369-5153-4bff-8cda-1a5a11192ca2", + "id": "1f088fef-622b-46c6-8bb0-2d9c0a384636", "type": "text/javascript", "exec": [ "" @@ -7938,7 +8265,7 @@ { "listen": "test", "script": { - "id": "3ca77cec-bd62-4709-a4d5-bc03a38cf71e", + "id": "d7e700f1-4f4b-4131-b009-674887252cda", "type": "text/javascript", "exec": [ "" @@ -7958,7 +8285,7 @@ { "listen": "test", "script": { - "id": "19b8fab2-0dff-4187-9f90-3ba88cf5496c", + "id": "bd57786c-730c-47c4-a92c-8d00a2b1490b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8007,7 +8334,7 @@ { "listen": "test", "script": { - "id": "675c0ee4-0c30-49b0-9b90-c940e98ddb51", + "id": "62d832cb-e9d3-4f35-9e3c-494d28d49638", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8058,7 +8385,7 @@ { "listen": "test", "script": { - "id": "2c05eecc-745c-405c-81b0-90a5fabd2d8a", + "id": "3fe4980c-f7e7-431b-a18f-66177ef5f92d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8109,7 +8436,7 @@ { "listen": "test", "script": { - "id": "c63a85e7-a0ad-44ab-bc63-ab9fe5acbf09", + "id": "49e8f256-2f3a-4e7f-85e9-96e832ade0e7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8154,7 +8481,7 @@ { "listen": "test", "script": { - "id": "67682990-48fd-459a-a9ec-e1ffda82789a", + "id": "92d669a0-08df-44b1-bc2d-200520fb2faa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8205,7 +8532,7 @@ { "listen": "test", "script": { - "id": "a6bbdce6-5cae-4dd1-921b-d33c07278f6e", + "id": "2607b908-abdf-48ed-9631-918c62f3c32a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8256,7 +8583,7 @@ { "listen": "test", "script": { - "id": "304e1dd2-2091-4615-a04a-c920f6069163", + "id": "bfdf8423-31ad-4a82-b5f1-18842feeb3bd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8283,19 +8610,184 @@ "header": [ { "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "c2ed11cd-842d-4517-8f9d-d25ffb18b348", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"registeredFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "e5982d50-f3f8-438b-a16c-6c88a49b20ce", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "4a5e6f20-1321-42aa-b3bd-6a644a9bea35", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/File/{{registeredFileId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "File", + "{{registeredFileId}}" ] } }, @@ -8321,7 +8813,7 @@ { "listen": "test", "script": { - "id": "5ace4f8d-a8b2-4269-88ff-99afe0b1d8c9", + "id": "e228cfed-72be-49e0-8c79-63ec4fb4b27c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var institutionName = pm.environment.get(\"institutionName\");", @@ -8389,7 +8881,7 @@ { "listen": "test", "script": { - "id": "f532d300-ffaa-4ff9-989c-4c94c1ad59aa", + "id": "2197320a-6a40-43e4-b2ab-b3f8d7a4d36f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8458,7 +8950,7 @@ { "listen": "test", "script": { - "id": "d59127b0-671b-4c5a-b753-88d4a040a8ee", + "id": "f653eae2-4d63-4000-921a-60fbc9eb0bd6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8526,7 +9018,7 @@ { "listen": "test", "script": { - "id": "523feaa5-ba43-4009-bea4-c7f3505a34d6", + "id": "f3d92d98-a5f8-44aa-ab2e-b413c49a0f46", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8605,7 +9097,7 @@ { "listen": "test", "script": { - "id": "4756bf87-03fa-480b-88ad-6bf10725db5c", + "id": "1731415a-40d7-4533-9de2-d352aa67d147", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8669,7 +9161,7 @@ { "listen": "test", "script": { - "id": "ad07f846-87f9-47fb-b8d3-052838821085", + "id": "ee5cfd6d-b663-451a-828d-6160043a9195", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8698,7 +9190,7 @@ { "listen": "prerequest", "script": { - "id": "95438c0a-a0cf-4543-a9ed-072234344299", + "id": "79f5aeb1-3360-450f-bebe-f6042c7871c6", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8748,7 +9240,7 @@ { "listen": "test", "script": { - "id": "942bc196-9a33-4339-9dbd-1e0934b5346f", + "id": "294035c2-0084-4b34-a266-e831587c9a1d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8813,7 +9305,7 @@ { "listen": "test", "script": { - "id": "ed48935f-45de-4417-b2f3-f9913804e714", + "id": "c930505d-f0da-4fa4-a877-5e6c6c13d861", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8876,7 +9368,7 @@ { "listen": "test", "script": { - "id": "c627a6d0-a81f-4430-8ae0-814fba493f48", + "id": "91434a60-903b-4e81-a0d1-5b5b44022b1e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8949,7 +9441,7 @@ { "listen": "prerequest", "script": { - "id": "c052d69c-d00a-4033-8651-f13e33c3a9a7", + "id": "9e1e6d1e-d4fc-49d5-a78f-9afb9f1f3dd6", "type": "text/javascript", "exec": [ "" @@ -8959,7 +9451,7 @@ { "listen": "test", "script": { - "id": "738b21a5-b547-48e0-9e14-39aaf16af39c", + "id": "71246453-e04f-45fc-9f20-1e170e87bab6", "type": "text/javascript", "exec": [ "" @@ -8979,7 +9471,7 @@ { "listen": "test", "script": { - "id": "1e8d604c-0ddb-411c-8a11-894a477a95f6", + "id": "8024967e-0025-4e45-8ef0-35c31d579935", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -9039,7 +9531,7 @@ { "listen": "test", "script": { - "id": "e2c5e1da-0018-48e6-b4b9-d062b6966cb7", + "id": "20c6ff4d-21ac-4ade-93e4-7583c2221797", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9092,7 +9584,7 @@ { "listen": "test", "script": { - "id": "e868377b-d4dd-42d7-99ac-990da54c1b9e", + "id": "874b6d14-fbee-4703-8f5b-5462019b0f7c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9145,7 +9637,7 @@ { "listen": "test", "script": { - "id": "8041d88a-a1d9-4b4c-b9b8-a38dc0be7544", + "id": "32cb6a6d-253e-43fd-8758-e95408f3723e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var aliceIdentityId = parseInt(pm.environment.get(\"dataOfficerUserIdentityId\"));", @@ -9203,7 +9695,7 @@ { "listen": "test", "script": { - "id": "44f7b3a1-361f-4b7c-b6c7-45bc83ee5b75", + "id": "d13de2a5-4198-404b-a634-00a40f060d0c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", @@ -9270,7 +9762,7 @@ { "listen": "test", "script": { - "id": "e29370b9-4c13-4714-9c75-1be77202790f", + "id": "d6205307-5f13-4e5b-9044-ff65b06d7aab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9332,7 +9824,7 @@ { "listen": "prerequest", "script": { - "id": "7310225e-c51b-4036-8b2c-87564480363f", + "id": "bd099590-8510-4d93-8ca9-7ce8cbe4fbe2", "type": "text/javascript", "exec": [ "" @@ -9342,7 +9834,7 @@ { "listen": "test", "script": { - "id": "ec085291-9390-40c5-bb54-e98f9e00ddc7", + "id": "916b7dbb-dc54-4921-896f-65dd44c484e8", "type": "text/javascript", "exec": [ "" @@ -9362,7 +9854,7 @@ { "listen": "test", "script": { - "id": "507d2f62-4398-4f68-ab35-3be0d44dd982", + "id": "b58a972c-27af-4afc-ac0f-56390185b31c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var registeredUserId = pm.environment.get(\"dataOfficerUserId\");", @@ -9428,7 +9920,7 @@ { "listen": "test", "script": { - "id": "0047e1a9-117b-432b-9bf4-6527941f93be", + "id": "551fd0aa-4715-4b63-ba93-b7201ba688c7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9501,7 +9993,7 @@ { "listen": "test", "script": { - "id": "89174912-af79-428f-823e-e00a69256bcf", + "id": "3bf77d40-b1e2-4cc2-9e73-6ef86fe6ddb0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9559,7 +10051,7 @@ { "listen": "test", "script": { - "id": "99e800cd-1d1f-4a19-93c0-73f2e12ada0a", + "id": "0e2a4a40-def0-4b95-98b8-8ad0a774b30b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -9609,7 +10101,7 @@ { "listen": "test", "script": { - "id": "287ba2fa-b2a0-4ebd-9341-71304265e35d", + "id": "ac7b9f44-a2ed-452b-b59f-258f2b1fac87", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -9676,7 +10168,7 @@ { "listen": "test", "script": { - "id": "48243c48-696f-4190-a1a8-d5554b860c1b", + "id": "1fd692c6-039d-43f8-8800-60942047e44c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9743,7 +10235,7 @@ { "listen": "test", "script": { - "id": "dfa88d1d-937f-448a-830b-bb07647bc38b", + "id": "fea96e15-cc3c-4616-9c96-d69efa8428cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9807,7 +10299,7 @@ { "listen": "test", "script": { - "id": "ba015027-1090-4a07-9ce9-c6d643018c0a", + "id": "b4a01334-72db-49f3-9fd3-b0fd0899ed09", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9868,7 +10360,7 @@ { "listen": "test", "script": { - "id": "9a2904f7-e20f-4493-b850-fd23c16956df", + "id": "894efcc7-e372-42f6-9032-3d1172cc9be6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9920,7 +10412,7 @@ { "listen": "test", "script": { - "id": "27e505d7-3a2c-4929-940b-ae1e890ad4a5", + "id": "8be7e811-2844-4524-bbdb-4b9804b8bac6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -9985,7 +10477,7 @@ { "listen": "test", "script": { - "id": "2c65891d-fd02-4436-ab77-bdd38974134f", + "id": "b993248f-005e-489d-b67e-3176c38c120a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10011,7 +10503,7 @@ { "listen": "prerequest", "script": { - "id": "80ef5ac0-1d53-4ac3-8415-f65685d1a498", + "id": "d70aefbd-5321-47a4-9240-da6ad76176f9", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10061,7 +10553,7 @@ { "listen": "test", "script": { - "id": "e14f5140-20e7-486f-82f6-e4ad94da993f", + "id": "ec7a1cdf-5ed8-4161-9c30-74544248e04a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10130,7 +10622,7 @@ { "listen": "test", "script": { - "id": "a0474f7c-7c7b-4757-9fa7-af9fdce60a50", + "id": "5f4f7caa-fbbc-4235-8feb-45f22fb1c9cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10192,7 +10684,7 @@ { "listen": "test", "script": { - "id": "3877ae50-f715-4d96-a49e-adefea3170fa", + "id": "a7034d0c-5a71-4f2d-ad13-f309b3cfbe7a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10247,7 +10739,7 @@ { "listen": "test", "script": { - "id": "37978479-2816-4b7f-b69b-a428f88e0c33", + "id": "a542c864-c1eb-41b3-8fbb-007678284ab3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10316,7 +10808,7 @@ { "listen": "test", "script": { - "id": "a570ef07-5014-4731-90a5-0d5d839b5bdc", + "id": "a0315deb-7876-477e-b4fc-8c1d8b2ca3cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10377,7 +10869,7 @@ { "listen": "test", "script": { - "id": "c531ce80-a484-45bd-b3d4-d51ce0b09f0a", + "id": "d7b37e3e-4b1d-4b3f-8cb1-34b820c92319", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10429,7 +10921,7 @@ { "listen": "test", "script": { - "id": "761686fd-4bfc-4d68-a609-591f4771d0e9", + "id": "d8959db5-8753-45e5-8286-5187ab846dc0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10482,7 +10974,7 @@ { "listen": "test", "script": { - "id": "7cd2f32c-dea5-4199-9d4e-a89aad4a68af", + "id": "205b1466-8161-4b67-babd-77817d23c88b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10535,7 +11027,7 @@ { "listen": "test", "script": { - "id": "63f5d504-7963-4917-9b8c-9250d961db11", + "id": "e0c053fd-6907-4fc3-8fe5-d59de0bcfe9b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10597,7 +11089,7 @@ { "listen": "test", "script": { - "id": "f95182cb-ac02-4c48-90a7-983183162484", + "id": "322d87c3-42f2-4208-9910-7191f257faa1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10678,7 +11170,7 @@ { "listen": "test", "script": { - "id": "cd28dbb7-9c57-4772-94df-26a3b40984e2", + "id": "2127be3b-b610-4f50-9a51-dbc740b8d0f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10737,7 +11229,7 @@ { "listen": "test", "script": { - "id": "6767d56f-c830-4250-80b0-ef109d87397c", + "id": "550b80f0-3498-492e-bdb1-9e4b209e239f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -10803,7 +11295,7 @@ { "listen": "test", "script": { - "id": "a0614038-2853-4e80-9182-f12381c4a45d", + "id": "c691ab9b-0f55-42b0-85db-998ebd9b2b9f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10861,7 +11353,7 @@ { "listen": "test", "script": { - "id": "ffb53d2e-c164-4812-9bf1-19056172cf94", + "id": "685898e4-a036-48a5-b823-15d3098ab316", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10911,7 +11403,7 @@ { "listen": "test", "script": { - "id": "ad62fe81-45b9-43d1-b396-38b73cc5902a", + "id": "50424406-f1ed-4af1-8c71-07962fb29208", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10970,7 +11462,7 @@ { "listen": "test", "script": { - "id": "3b68f192-9b25-4e15-a715-2ba8cd4c2158", + "id": "49b4228d-cbe1-48c2-ae09-c629acdf65d6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11019,7 +11511,7 @@ { "listen": "prerequest", "script": { - "id": "d8851461-68a7-4b89-be8d-00328fc8517e", + "id": "8d794d5f-e1cf-49e6-9f9f-04eb88b544fa", "type": "text/javascript", "exec": [ "" @@ -11029,7 +11521,7 @@ { "listen": "test", "script": { - "id": "7a0869f6-4a89-4280-a387-54eb36efbf31", + "id": "3e0147ce-663e-4e39-9687-129bdcd0b624", "type": "text/javascript", "exec": [ "" @@ -11049,7 +11541,7 @@ { "listen": "test", "script": { - "id": "9c873c78-a41a-418f-bd1c-ad85e3610a00", + "id": "5a439fd2-fd26-45cf-ba3b-b99d50ff7a03", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11098,7 +11590,7 @@ { "listen": "test", "script": { - "id": "f45e0cb5-7123-4589-8170-a10ce4957df9", + "id": "e5ad464d-70e2-4bb8-8d50-5d23b816f765", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11149,7 +11641,7 @@ { "listen": "test", "script": { - "id": "147ace2a-d385-47ff-813b-d1368280c9fe", + "id": "b031509f-5f3a-40ff-978d-caafb4e8ee56", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11198,7 +11690,7 @@ { "listen": "test", "script": { - "id": "d77ca8dc-fa58-461e-af81-a30445fe3747", + "id": "f426f8f1-ecd9-4f2c-ba6b-d627e0c3f718", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11249,7 +11741,7 @@ { "listen": "test", "script": { - "id": "5780ab7a-5024-4191-9043-1ee05441f599", + "id": "85953625-955a-4288-aa52-94a30d24d4da", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11294,7 +11786,7 @@ { "listen": "test", "script": { - "id": "3fa88271-64ea-4693-8d14-8482abf1e9ad", + "id": "3cd30557-a56c-4e7e-9e6f-6c417513a0c1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11345,7 +11837,7 @@ { "listen": "test", "script": { - "id": "352ee6ba-cea8-47f1-aa25-9e668076ff1e", + "id": "bf097ff8-c8c3-48eb-95c8-1afdfa685044", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11394,7 +11886,7 @@ { "listen": "test", "script": { - "id": "6830807e-2950-40fa-b24b-ea132020ba71", + "id": "3219415c-9516-4b1c-977c-c547a1b28253", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11445,7 +11937,7 @@ { "listen": "test", "script": { - "id": "4b0726cb-7d99-4641-9b12-821b5d864cb7", + "id": "72da760f-8897-4b8d-a1ef-b395e505e670", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11496,7 +11988,7 @@ { "listen": "test", "script": { - "id": "a2e89731-b91b-4f4d-9667-bc03efb416a2", + "id": "705d09bd-0264-4d6a-bdd6-66795aa2d3ee", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11542,6 +12034,172 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "id": "4a6bade3-56e7-4ee3-ae46-bb1bd0deaca3", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"dataOfficerFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "id": "5bfedad1-c8eb-4339-8172-02350400c6ac", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "id": "f235499b-dbbb-444e-ac50-856db74c00a1", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{dataOfficerFileId}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{dataOfficerFileId}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, @@ -11559,7 +12217,7 @@ { "listen": "test", "script": { - "id": "ab38aa83-fb6a-4824-a789-4e4a616b4943", + "id": "d4d32500-5552-4774-a9a7-633820f7b552", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -11628,7 +12286,7 @@ { "listen": "test", "script": { - "id": "43a6252c-4931-4a9e-9978-6b831eb153d6", + "id": "a55d7111-0035-429f-a8e5-5b69bfdeb59b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -11707,7 +12365,7 @@ { "listen": "test", "script": { - "id": "f7055bb7-2fa6-43f0-a8b8-f8c8d3101517", + "id": "37e91b48-2fe9-4208-9cf1-dfc6dc702139", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -11736,7 +12394,7 @@ { "listen": "prerequest", "script": { - "id": "223c1d65-0f1e-4ed5-88a3-f04ccd4b2e47", + "id": "18e996e7-ad23-49c7-8ca5-332af708132c", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -11786,7 +12444,7 @@ { "listen": "test", "script": { - "id": "b64cb8a2-2cb7-4d5b-8eba-025149db58bd", + "id": "b2a6d508-58a8-460e-ac2a-4aab065ef51a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11850,7 +12508,7 @@ { "listen": "test", "script": { - "id": "da6e4c66-c390-4bee-acea-2a9c08421b55", + "id": "2166f423-2aaf-4ade-af63-c77e0f9b7b14", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -11923,7 +12581,7 @@ { "listen": "prerequest", "script": { - "id": "f8d06515-bb25-4136-b4f7-60f572ed9e81", + "id": "81855d8b-20df-4e35-887b-2012d8e15c9c", "type": "text/javascript", "exec": [ "" @@ -11933,7 +12591,7 @@ { "listen": "test", "script": { - "id": "96b7c0ba-3566-4e25-a78e-bee6c4754bd1", + "id": "83686841-0322-40c3-b205-86c2c94b1d12", "type": "text/javascript", "exec": [ "" @@ -11953,7 +12611,7 @@ { "listen": "test", "script": { - "id": "5bd092e5-1315-4201-a0d7-bea8a71ce3f9", + "id": "0fae6d4d-8a8b-40b9-af5a-22f0d3d8120c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -12013,7 +12671,7 @@ { "listen": "test", "script": { - "id": "059c65ab-7a2a-454a-9f4a-d50a0a6bec61", + "id": "7952e644-9f50-4d8c-a9e6-f9a2b2a47079", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -12066,7 +12724,7 @@ { "listen": "test", "script": { - "id": "04c0fa7f-e3d0-4647-9bf6-0e2598088aba", + "id": "f6b962c5-e7f1-49ec-9cae-47854b3e972b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -12124,7 +12782,7 @@ { "listen": "test", "script": { - "id": "bbf4aebb-ff3d-47c9-8d0b-ba4651d21ace", + "id": "fac73f95-8afe-4758-950e-e7fad1a7f5d7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -12191,7 +12849,7 @@ { "listen": "test", "script": { - "id": "43c931a6-a0a8-41f3-a25b-50fa5bd16be7", + "id": "7e9c125f-b35d-41cc-81a8-d51bae18aa81", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -12253,7 +12911,7 @@ { "listen": "prerequest", "script": { - "id": "837c74f0-ce17-447f-bf54-573fef251278", + "id": "26f12609-1246-4a1c-9508-2fcfa047b4f5", "type": "text/javascript", "exec": [ "" @@ -12263,7 +12921,7 @@ { "listen": "test", "script": { - "id": "1ad1cb11-9be8-46a0-8d25-a68aa29defbb", + "id": "914bd00b-8246-410a-a735-b66ffa817214", "type": "text/javascript", "exec": [ "" @@ -12283,7 +12941,7 @@ { "listen": "test", "script": { - "id": "8328636a-d9b4-45c7-9af9-f725fbfe35a6", + "id": "9be07e94-481a-45a6-8c6d-144c7e8dda6b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -12349,7 +13007,7 @@ { "listen": "test", "script": { - "id": "8bd3d30f-1d53-4eed-8b1b-704388d9af24", + "id": "3fe101ab-2d4b-4eed-bef8-2175a6c79cb0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -12422,7 +13080,7 @@ { "listen": "test", "script": { - "id": "db900427-0545-40c4-8002-6038b0524289", + "id": "2642bfc0-bea6-4c0e-89c2-59ba8b5bab38", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -12480,7 +13138,7 @@ { "listen": "test", "script": { - "id": "60ce3afd-f037-4d19-9d65-3dfea80faf0b", + "id": "2ca20c68-583b-414f-a95d-359213f1509b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -12530,7 +13188,7 @@ { "listen": "test", "script": { - "id": "9ad81d33-a6f3-4b83-a5ae-8a6f91db2ea7", + "id": "931bc61f-0f8c-478a-95ab-9a70ff0a0c17", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -12597,7 +13255,7 @@ { "listen": "test", "script": { - "id": "01d9c105-5e6c-4fdd-b9c2-1c9b5b8aa445", + "id": "2cafe92f-1645-4e8e-b43e-2609863fefdd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -12664,7 +13322,7 @@ { "listen": "test", "script": { - "id": "3c684171-758d-4c78-87cd-9377cd1f0630", + "id": "0728294d-13cb-4f9d-9c87-7bb12f23e030", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -12728,7 +13386,7 @@ { "listen": "test", "script": { - "id": "f6cdcb65-c48c-408d-87b8-754568c65bef", + "id": "a1e28d96-45c9-486f-9643-c79e00aa6b5c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -12792,7 +13450,7 @@ { "listen": "test", "script": { - "id": "7654bc87-5952-458f-a849-9d70ac220383", + "id": "702adb47-210c-42dc-bbfe-e2ce9df13f17", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -12844,7 +13502,7 @@ { "listen": "test", "script": { - "id": "e61c8c40-d940-4c3b-80eb-0e474b59e0b0", + "id": "a8254518-ffc6-40b2-abba-50a5b0942bc0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -12902,7 +13560,7 @@ { "listen": "test", "script": { - "id": "df82731c-5ab7-44bb-8363-be611bf42f38", + "id": "d8aea0d4-0fc4-43b7-a86a-e68c2706474d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -12967,7 +13625,7 @@ { "listen": "test", "script": { - "id": "a15fc494-aad4-4a6a-8a8a-dfd1ee60a01b", + "id": "8260c327-b4de-46cd-bcf9-808e29a5fa24", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -12995,7 +13653,7 @@ { "listen": "prerequest", "script": { - "id": "30a26376-5874-43dd-9a7b-724b198c81f8", + "id": "894fb5c9-070c-48a4-865e-917cff28dba6", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -13045,7 +13703,7 @@ { "listen": "test", "script": { - "id": "7fd9263a-a3b4-46b0-8771-5c3dd8c9ed80", + "id": "5a5dc681-8d72-4d0a-b216-72cfee10667f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -13107,7 +13765,7 @@ { "listen": "test", "script": { - "id": "d63d1d5b-e1e7-42bd-a3c2-ff5053807a78", + "id": "d1f599ab-0777-48ef-9b3e-cee92c6e07f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -13194,7 +13852,7 @@ { "listen": "test", "script": { - "id": "55166ec9-70ce-4b51-b17f-ee02410b5487", + "id": "2e7ad38a-32bc-4639-afb1-7b04836b6e88", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13220,7 +13878,7 @@ { "listen": "prerequest", "script": { - "id": "f7d804d4-fa0b-428e-b9bb-83d600ee3646", + "id": "e5757281-61c5-4fc9-b579-cae8aafab73f", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -13267,7 +13925,7 @@ { "listen": "test", "script": { - "id": "93c1e48b-c540-4ce1-99d8-20dd59a904f7", + "id": "0971d4e9-eb2b-464a-a168-d5c43de27de6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13294,7 +13952,7 @@ { "listen": "prerequest", "script": { - "id": "377f003c-890a-42f8-ada5-6da94c56e346", + "id": "f95c840f-f253-4b2f-a175-603a3886813b", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -13344,7 +14002,7 @@ { "listen": "test", "script": { - "id": "fb71a1dc-1554-4f4c-8f00-def502c6f3d1", + "id": "b330cd8e-b537-430c-8ba5-58502f29dfc1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -13406,7 +14064,7 @@ { "listen": "test", "script": { - "id": "62c6efc4-41c9-4179-9c3e-371aa1de1124", + "id": "25ea3968-544d-4794-b2ab-cfe0e5c27efb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -13493,7 +14151,7 @@ { "listen": "test", "script": { - "id": "c1324b05-8832-4afa-8412-c5ddf698e2f1", + "id": "02d4a2c1-3e65-4ea8-8f05-473fa663887a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13519,7 +14177,7 @@ { "listen": "prerequest", "script": { - "id": "5725d784-0934-42d3-bc44-eae7d0d79fec", + "id": "c78ad631-849f-4d87-99b3-c12b006f7bb8", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -13566,7 +14224,7 @@ { "listen": "test", "script": { - "id": "f3d41599-f7fe-40f4-b48e-2a15ff62b7f5", + "id": "99d5198c-e899-4258-9ec7-717887a65d40", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -13642,7 +14300,7 @@ { "listen": "test", "script": { - "id": "46c616f4-caf2-4640-8c40-16ca2ffdc857", + "id": "80cd732e-f6b6-4272-b261-ebfb80983fef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13703,7 +14361,7 @@ { "listen": "test", "script": { - "id": "7681027d-da07-4c57-9a10-70400e9002cb", + "id": "6f12790c-8329-4cea-ad1b-78ba8baf41a9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13755,7 +14413,7 @@ { "listen": "test", "script": { - "id": "a59cf22e-dd7a-4ce2-828f-c6335eb8edcb", + "id": "d12b9618-e29b-4aa6-8e0e-62577c453efb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13808,7 +14466,7 @@ { "listen": "test", "script": { - "id": "4eef1d32-915f-451f-bcb5-513d9d319c53", + "id": "8a58eef0-ab90-4acb-b58c-8a307511a322", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13861,7 +14519,7 @@ { "listen": "test", "script": { - "id": "01986237-1b02-4b98-b3e3-8e1b7624c8a0", + "id": "bac135a8-2915-491e-9ae5-2f08cedd5f73", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -13923,7 +14581,7 @@ { "listen": "test", "script": { - "id": "5d6606e4-5fd7-4f7f-83c9-e8c8dc03b16e", + "id": "80e234b3-f5a7-4840-969d-324d76de39ab", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14004,7 +14662,7 @@ { "listen": "test", "script": { - "id": "f0ed38ed-61b9-44f6-b713-4b1b03470de5", + "id": "6b1a249f-5778-4df7-a991-0673772e7d5a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14063,7 +14721,7 @@ { "listen": "test", "script": { - "id": "dd04eab3-726c-482d-9ed8-290948607f19", + "id": "65f55ed7-c379-49d8-952c-56c6060870c2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -14129,7 +14787,7 @@ { "listen": "test", "script": { - "id": "5acacbbc-b1f2-412e-96bd-dbee3664f49d", + "id": "ab91c9ff-d6b2-4619-8526-5ebdf56a6719", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14187,7 +14845,7 @@ { "listen": "test", "script": { - "id": "b26af678-98a3-42ce-8c32-22f0d2d803e6", + "id": "80c54122-052f-47b3-a2ef-b522504a217f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14237,7 +14895,7 @@ { "listen": "test", "script": { - "id": "db509be6-5c8e-4834-a895-0af943fe62f9", + "id": "408b739e-4f56-4ddf-a440-5adbc0cd5d9d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14296,7 +14954,7 @@ { "listen": "test", "script": { - "id": "ed30ce84-4052-4a9e-b6ad-7ee7df463cb2", + "id": "d5c8ebee-d745-473b-ba27-ac6da302b8eb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14345,7 +15003,7 @@ { "listen": "prerequest", "script": { - "id": "70d72573-56aa-443c-ab37-1834b68a9a5f", + "id": "3cc939d1-eb2b-45b7-8512-2a82c77a9bb1", "type": "text/javascript", "exec": [ "" @@ -14355,7 +15013,7 @@ { "listen": "test", "script": { - "id": "7e45a4dd-53d3-4019-ab97-5e145fc063f0", + "id": "2142aecf-e774-43ec-8571-f179988d5e62", "type": "text/javascript", "exec": [ "" @@ -14375,7 +15033,7 @@ { "listen": "test", "script": { - "id": "27b316fc-d4ea-4a47-8ab9-2b598c424344", + "id": "d3aac316-7776-4874-b026-60f18ab88091", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14424,7 +15082,7 @@ { "listen": "test", "script": { - "id": "fe30cae9-0108-453d-8a91-9039eaa10b4e", + "id": "e17f78f2-24fe-4ff7-bee1-9e2173e94e1c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14473,7 +15131,7 @@ { "listen": "test", "script": { - "id": "27aea67c-4ffc-42ee-ad29-3ca48207dc01", + "id": "2fc7e5cb-905d-476f-8259-a112ebf8d702", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14518,7 +15176,7 @@ { "listen": "test", "script": { - "id": "c65bb6bc-8c89-4754-b16c-059d26a8873d", + "id": "b28e10e3-5f51-4a0d-978f-8b6e2c7fe672", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14563,7 +15221,7 @@ { "listen": "test", "script": { - "id": "2c180652-8cac-4963-8aec-a8540f8717db", + "id": "128554c5-6b1a-4cb9-96df-06dab00ff9b2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14608,7 +15266,7 @@ { "listen": "test", "script": { - "id": "566158db-f9ec-4f24-94b7-e9532836b3ce", + "id": "1d69d533-38d1-40ad-9f13-1dd8f48ee5a4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14661,7 +15319,7 @@ { "listen": "test", "script": { - "id": "a949e075-a60a-4af4-b91e-c223dc688947", + "id": "a951dab6-ec32-4b74-83ac-239133bed297", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14714,7 +15372,7 @@ { "listen": "test", "script": { - "id": "faa6bf86-f2c3-49ed-84b5-db22eaa55993", + "id": "5c9495ab-e2a6-4e59-baa5-79a57f7eef48", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -14764,6 +15422,174 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "fdb09b54-41da-44fa-b9da-86b8a6164bb4", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"prFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "22594f5c-385c-47f1-8200-1cceb7ae28a4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "c7dcd241-1992-463b-89c2-215ef82a402e", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{prFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{prFileId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, @@ -14797,7 +15623,7 @@ { "listen": "prerequest", "script": { - "id": "c583d74f-89d3-44de-a502-8ad3e19cc151", + "id": "06cec91c-5525-4876-ad3f-49be66a04ff7", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -14841,7 +15667,7 @@ { "listen": "test", "script": { - "id": "47e1fe4d-c641-4ad6-adbd-d23055325dc9", + "id": "97ac432b-569e-45cf-9107-31ad81786ac6", "type": "text/javascript", "exec": [ "" @@ -14850,4 +15676,4 @@ } ], "protocolProfileBehavior": {} -} \ No newline at end of file +} diff --git a/Postman/local.postman_environment.json b/Postman/local.postman_environment.json index 0b80ea9e..b0d60699 100644 --- a/Postman/local.postman_environment.json +++ b/Postman/local.postman_environment.json @@ -238,22 +238,42 @@ "enabled": true }, { - "key": "createdInstitutionId", + "key": "createdInstitutionId", + "value": "", + "enabled": true + }, + { + "key": "fileId", "value": "", "enabled": true }, { - "key": "projectIdWithInstitution", + "key": "projectIdWithInstitution", + "value": "", + "enabled": true + }, + { + "key": "prFileId", "value": "", "enabled": true }, { - "key": "embedGuidWithInstitution", + "key": "embedGuidWithInstitution", + "value": "", + "enabled": true + }, + { + "key": "adminFileId", "value": "", "enabled": true - } + }, + { + "key": "dataOfficerFileId", + "value": "", + "enabled": true + } ], "_postman_variable_scope": "environment", "_postman_exported_at": "2020-10-31T23:55:04.031Z", "_postman_exported_using": "Postman/7.35.0" -} \ No newline at end of file +} diff --git a/Postman/runtests_linux.sh b/Postman/runtests_linux.sh new file mode 100644 index 00000000..f95b36a8 --- /dev/null +++ b/Postman/runtests_linux.sh @@ -0,0 +1,3 @@ +newman run dex.postman_collection.json -e local.postman_environment.json -k + +$SHELL \ No newline at end of file diff --git a/Postman/runtests_windows.bat b/Postman/runtests_windows.bat new file mode 100644 index 00000000..17b98801 --- /dev/null +++ b/Postman/runtests_windows.bat @@ -0,0 +1 @@ +start cmd /k newman run dex.postman_collection.json -e local.postman_environment.json -k \ No newline at end of file diff --git a/Postman/testimage.png b/Postman/testimage.png new file mode 100644 index 0000000000000000000000000000000000000000..b415191db085ca2688bb06e5d5e49857d8ebe1b4 GIT binary patch literal 13976 zcma*OWk6Kl7d3om=#cJ^7F49AJEWvr8bm}=VnA}}p&OKL0hN;OQoxb!4(X1e>$$)G z`+j-8J$$(g!#U^Pz4uvr?S0pY&{S7^giC`90Kg+b}Rru^fLfZx@0zKiGyEY zTB$0^gIDn9O0GEoykNO2t0`cuU=kBN<9K3s08aQaQdwR`*K2ma^;0srP4?#9C#yzP zC!u~;QX*YJaxG$v#9#E9bA9_<3)jUTa(kPnha0=!`A!JGU5|NPaO#uY z@TvVGV(HWvo!F0HOyFfMju-wkP79Qd2frKF+lly|IVf8?M5?B)?wKsYI54yWYSE+c zkcqhnNd=IPx-Xw>UA?-LV+Cwt?b2B)rH=66yzo(^>L8>YYKA_G-z`jmqG4Vm#*zMF znf|0hdYRaQ_*~zd+ogfOyShJ1`0 z$VAtNwxcid;Quoj-i_tRRsvK$PfkwaGW7`TIbVxN*J>2EW4w0Y_3Gt`9?U&dkhheF zYFd3Rrbc^W9k9iKNrRR>3dtq+lEJQOYityuKk{WZA;OWyu}Cil4tma)hp@shCB8nd zq`gr(W4XA9jRWiVlpw2z=_TsDEX7Ac7zuLMB51O}d2V4e%z1z&D<65<(Ikit4f z__}${(IxWQKod!h?sv8m-hA=r(quqo%F5ChhWmZLeCEP|D|`~J1h9_H&X(aa{kC>K z+(erq3cBH{rcOq~>U-3LiIPRbC>q9TiFtupOtkvm&CPAt?U^z3L4i|oc6OEwd{E1P zF)4z1Y3zgAzD?!2!~A#uL_bK*cXj@>6)7os?-?tXBS3u?mLWYBl)dpQ6K&E$>dAKj z{C{tUNuLQpABs3B^~+6^xzcDO_dCrIeohRL*3FllXyXpEN*|D~td>laP;*~P_N06^ zZkH6={ont4lB`23qgC3Qc{J&nwcq{}pe#Tg#tF9J{IFx*sU*$~kwtn7W7b$kbsB4NxUR@UmlG!^ z^+SjzIvn;0@7!~lw?08iHV3utj`g)^Cv}b|C=m|lWmD#Az#t2{iX6*q$dj64<&r5v z4B|5L3}^UyN0cnWGb1B|Uq+)O8GAyE`rYfXXf&NFDHLWruD3d%@Zq=!iN*cxAq2wLpt(AU6z`M=d~38 z<2cdYYYB@!95FX#%C^^nb52UK~#L_+WZplYqwhEDM zJ@BqkP8#_wlqW!deXVaAjj`835nR-9UUI&I!3+UXxy@tqIan&A-g2Qkv9a=AURM>2 zJIuWP@Xwp%=G<)ZivdSAPRB0}+?~pm_i9PQ?62j=!=Ft)C3NUk*M7tIemIx=cN_y4 zjL@PXTxrkk?+_EEmM_>Lt3)OeKB+r#b&0dn`+t$j)2+Cj35}=IS6$q!T=EL^yd-|3 zWHlfE5!c?W&A4h%ToQ>X+eO$I`P{4y<__V&?b2(d`A<}A$wLy=b*^U4oop9j$u(}a zW=!wv=l?`VJy45f`=#HSF?1d2J#rl90Nn@1sN(o|U;TC_=Mkjt^oU$Ri(v2zKl_%* zm23_XFedQ4Qfe=%GVW0Jc#hpwBvGurZTYX*KXV7wv!VOM;QIOBQ{1;fgY7pJ_gp4Z zBTkQF1V8f4PKy!i>D|w^i<(ZejhdssdDP9ZI74FfM;~}&Z0y0*voJk`A|&+G%8fW>Nxh)QQ2Cw~gKK zSTkpS8SZ}U$GRbl@c~O!b4giGy|>GE+DKK7r;vsc_ethuGuhQn%0@bJb3f$|-J)eu zi;>>v4#PT4;!Wxce4^pQ~53+pO+F>cEUA}bvbO*!!L!n6SpO5Ksw2fg>h z^+e$GRnBpmKR>aQ#_UEgh*OpD50OX8wo|6&#x&mD#=#C3)qH$zuG%-_9&qt}9=5Mk{m(O?!0;7efZ|4$IfleS*S4~`Q~LWu{PI?=*H#vg zoY5DU9ceOYN`xr1$^A}-n1!b6j}CcC{EqOnbEj=t*Wy4-~B!EBMF>; zG$v57DZ4sAAJP-dU2XKN{r2Tc5P$Fb6-zd|_KDmgMSX=mepL8ijPmUc-!Uc}6EE!)%Nsihj0*FU<4N zVKt{JxO$3#S)ydIn)GE4w7Ko{bbiYG41CzDo6xWjYFGMGvq^%g3j5>aTww!=}xY0bua%s}$SC%vTu=b4iJ9Bq@7AoU`osMCdke z9;p|pG5+i2hN(Lear08Ubev^~gRL3A=JOja5d|@i#B{=X&7XE?xnt(dOb(WWUx1e0c!E&AMkd*B)Vf>8GY4Kn8>-(=xiQb=fhJX3 zwI2WC0CXy{VYO=l629pNj*V&B3g+fGV4h z2O9qJPE+dFtm$E}F@^ewX-;EBbThC9=C*;GB4;c;TSMXA6PeAPWQqzEYb#XL$Mf;%rk9K z$Va>g%q>It{E}}z{{7r+Gy{l7emp09cySes6=bINp6K`hwO*_YdlCFrc>c`-9W)i> z06ywv%oopq1&LiO$Z4e%DhWrqRh%g?l~s5<&Y0i}O{OpZBiNm%zmd393s?`IZnK&I~gEt*cA9))WX6fr*gjbQSY?;2%;4Ar{ zv*&%8r_=%&R?n`)vvHc0uJ$uP_afy3I?waI6jUxOvtTDFPTA2=W1TYR zV)m?ck&WeR502?Lsq)>t3{l`fw1s@N(Qy}^2Q^5xKn=AnE^D8=3Qd1~BCJXLBCIQb4+ z$afv~{+8O*zsC05`)%T`tQ>6(qmi?a%pR@)-RBovMm>b|)o!~& zo?@rWxXe{s%JP4|H2;nu%nhGLh4;1G)1*c%1{0@Q(Mzds#7w+hH1x~6IqB&ykqiGr z7JUBg&e|C|9I@b6tN;5i>R)f^l?(q%+Nq=#@V>A&5j!6e<6gw`!^$Y`4t$g=Oi59E z$e`Q$r9`vZL{wP{2O6f?`(Fo+7wZD&n-`HLdH{ZRUq*2wCE=L+P<`cMLv|#$kFzEH zN@h=sB5~;(yMMdij}Gv=EUre zBl7P6=A^u`4vIF&M#@V5i8wbQj(&zS&NebViIzzQm*m4f1jE;19(e>7T>0=#2(QX1q5dx zC1xOWMU)z=&WWYpPA|$)mgAP)h$X2B^8#6-jDLDac|p3vcMgt-QgzIE5H5Q8s_ z3BaY|Nxv<0JGLN(I%+j|jCYke#N`w_J}-?5aA5=prEXmwi`5SE&iI4>8mMicXm!vM zWNwZiJqr35I=#1%>nyV*tF@ONIw%|w%#UF?v%R!5u&vr$z)MfC zp#oIDe9HMS_V|YEcxHeDEvUk_V!^M%l!sqdv}=Jlw_t-=9iu~!Q(E#divjukWX+zI zZlXqj)Rqx&uFfiWmzVo>gx%#6`t&Xi&@cxPUK}${SFdaO-7YrPi%@IC+b>={{Tb;B zH4BmSxVE8+UTa1OkJ zGKQ{=El%8=?hpgg;}Zp;nxFq*>M4wi5L6xZ91ssbck)j%5rOjGSsp5g(;Ma9^Q#3U0xmJi)jC$ z64TQi=e1ZqtI8lv2-X@U15dyMuDrd`<9IF zjE{?OeblL7zzsa}-?vakT5`Yz#a-t79`Z>IS! zyEVfS=gzBiGp_#{Q6Z8*FPPOxN`-s9`j$K=2 zP@-=?U1u}QTKYkraC3s^Dh5-krO#N{GkRIj7BsqCM%f{QtmZ5K&26EsC6LQnlkti; z!!@nu_=kJ?ARD*Y3d4(0M`TgCM&r3?4X<_4EQe6?eT>sBf3xwMHztn%3J-zm+B+5g z|^JbUo9DkLA-HO6;Ucp|3KZ6M)KPG@n3V7nk)ZSI*3$+*| zL(mYau~~;+_c`VMfhp{*`FcBa(yg)f@Q}Z(*ydyj+C;6D2(gF>s z&2-h1q&@WKXZwBT-wm}^^ZGNnlN%Ge7W;f%%gw$rG#CF{=!QFb^IoMKo{BD2A*H+x z8&3b(y{P$R=ubquZ#D{7XUC*w&Pfr>9;JeRpiD#uA3j_%1GaGIg%(Cp+!oP@#<*N1 z_tZD+8pGSGa#=GC*|$PVea4mf)9g@U1I4lV@j!Re3N&0I0PK5o$Ou(Ls6)$xiW7WQ zoLbul*DI{DME>1k%y4c`%@z(S=kO30@m?PMwtQ7u{!s_>9^GZMHU_%6@rN)z1_l_g z-goGZ=XI}9_pNVTuAi2hr+#`c{cf$eKA<{=7{GTTy@+AndEtT!`Xvtz%Q)sj?~YY&*_;nRc&It7j2XsaN+4LpF@ z&C{!(So=s~Ak71kUmy*?{5!)DjHz5ZavYW8Bl+&W&ysIfGG6o$O!ORj4Yc*_fZOKa zi@)l`ZVur7O(uk!9v<2?p531;(J{BeVv?)Ip3fBul4ylLQfyuqwELGv;@<;Ee}pb` zQRKFneORB-X8fl!Hq0T?`i8C}Pm3aqr- zwt2xN{idkcB5vi{1hbK6dVLcaiUqM$Pdy$L!B<=8h0$x!gaP4LzJ4~6wQHB2G}u42 zo`WXEvKSPtbG+2rtxGYH>wa^eKXX+`15wXA#bzKa4%iQ!eQF4BB1J=@x)}92U#V}5 z81yMiwi;d&luRX>KTdE;np2W*K2-znFS9_H1LWSe(nFK|oHhUGfj6JES{VK?6c z9rlcaru>HVuu09mle$U%J4xtgq;Y`c?z_8o`-DlB@_FqVVfm_1+liTlKh>u3!=xMU zFMl=>Pf0`l90}alTqdloLT0^qL#mD^pKv6TiKf_>)&NqgsxYq0%fTj{9?34yVxm!TL%oqF7G30Xu?PVX%_ zT=Eh-{{1H^g_FUryAuYLgH1cwdg7@HO=?a!A3+*JG?){L#7t9!`=n>!Ra6*$2gryX zO@~`S1Y*{7hWcs~21bup@d7!yZ&u!wvh^tNMM$1?N>5U-R%Zm7L=VLQcknjS9qRT& z2*@#uW|i6>9yc!RcXIONu(xVE;T%t+u!?RpWJ7HlV<6bNz`4~|W>IDXy_lkl6pE3q z@=F%#_SpM!`FGvkC*kWUM3gU|qI?eU++*69(YwBKNOPD0=l`BimE;GRFlf2mozIQ* z#-x2CX{n0yQBxv zAvC_lX8+C1tNWga+%)fO5V)+eQVnEH{!2=8huGdzJId6CiY z-^Q|41)+406)S}V+k*PAVt_%Hs9*ZuibXI? z5GPzzt8VxJIwQEbUg&=jb+h7smuKb{qe}}G@=EPb>(v8z3k}*aNmLQ`^|3OI{_nwQ zgUgub_v7W5fE!4!t=3F>`U&U5cMe@~mik2o>E1-js?k`V>dRP8;dHsd0Cy~#D03LD8oI$dv$ly=d{4==t~?&nsKi= zj6{(Yb*2D&Lihz+B$|QP(sj`=Kt(PX9BIsR~iVAZUlNbhx0zn%R4 zTLoFmLa!iG>Us9d&>bJ}Vh6A)ts!(0*tXXbGrS9Ii_bVM|0*2kx&9FKMJMl8^pbjz z@EP{pPm~P!g7EivuXB({8@Pp)9;P(W^eL2G45)YvQD0_$!JG3sF{#BdHMVSaupQ9> zl5DgxgC(2JT+}zWT_vZBo^s0IObMSlG~rd0x2o2jSs>f%+qN4mHs9xp4T{vl*nTbZ zJF3;hcQ?)b?&9nr!aJd+8t4`)U7^db5<)mWNlCjN69#3=ju^7tW5al__cjv2Kplm6 ziKij6P(9`0_AYu1P04Z4vpFa3E9XpCIeJmLeTv4sX}*uNXgr<=CK~zQTgc!rAp`L)1a^)Rz*2xQ2mygJ zdID_M*zvcEW7wNn#w@pmA$Va84p@^1UrY(7hDq_35wA`C`hP(X>0}X#tW!5p9AKMV zObe3`$D5{{C<499G}8AH21aT3bS;D~;YaDyMlP8MMFzR?WQ`ZWuA&&iars0UdT%h~ zLT;$wM^`|4M#j)Gv((I}hpS$!ST1@j;+K-YhJR~2Vs(UF4c1&lKvvYY7;`#m%AdXH z;M0-{`%3vH{ne!DRe^MblmME?(Q@ur;uUmL#enzv!#`c3k)-gSsWyJQDUKBw9aldi zY*Gf5;Y6@+6^KNc_6z^|p^3ni6LgCJu&HXBq7R*eNN@K*x70{gMf(c5nG=;!cCK?j zKZPP08HchTnEL2}A~!O_DntK*A?(8lH6Nk`?0``tO&RIsRv_8bj>n@%$;xInr;Sqs z!X-OCp1VYQe=)euB3*)E!M)sosr$4Cs(Yz<$SwQ$I@*Y6_1`-!t%#Bmm(xT|Joq=K zqM2F$yx3BMYat?`H()U>Pt0*gJIt<5;7wy7U-+TJ^lho_|CVYf)64!=!kDAvC5~~Z zBz}+1yseVOBCEvNQ`)8C7fk!0O)$M#>K8Xo$_ zHu&Z!IQzE^@j-f^`CvIa~3>~oVO zEv13Rq^@ePa%@ZHiDA~%dzSr%bKy1Eo^8@^=V~pQPT3Om4=P8yxf(*fPSNXUp ztf#mT?cE(SI$0J=6#+I{UBx7m-W3pmOm*+qqK(h1N~pAO9Mt+^K3r7W-|VWf{XtCB z+=ymcRE#VIHNzh`(@y0v?efh3MCa4e=t5~1y(I|%mc;^1pMD)2nAX|$9YrVm@@W3D zy0UDa>`!uUZF{y=6c%Q3!{uu3$21WJLpp*TI*itFypl50N7EwNk0C*H5SK;lvv=UJSYnSOO2W4#dx6NdSzQ>Sf*`M_9 z6B2Aj8rO<)(`ZDi8Jw5`#(&D!BlBaNWvPXEwu+#zLaTUQfKd@phxBHeW&SAd9PJtz zm!TK`JT1pxIM?rg!aFnMiQYPYl+Yjl$^M54ZJCP0MrN)7E_`%&OOT|F6$TjXomj;7 z>FFg*b!%C3H*P&O-?{VP{KSi58kR};bYozcc!RU!xe$XbV~)FWfZj1C%P8T+1%z1| zHcXcpM#|RJP43z?yc!>m_d@Y*!@ei6t5%Oym>YgoPh6-}FHbPcoOZtwYh84qMsvY7 zMsLXqF04(N*Rrr$^p#if56vG;aZEU^pyYG@j*0xJZX~ls_*xEZS2d~E4@irOiAg+1 zcl9SooZL_cf+TUrJ^thWOR@i1<(I|O8|WHXbljY6YC9tSsGx4XVl=6zc>uEvK7ViM zKM12UF4Ifjc2bwft)(Rn$`4BQ78*O5v!-s#H^ifY>1IlBcSIhi{ zVy~z!6H0HYwnt|M5cK<_n6A3Ri)M-LuJhCy#p2H*4F5VtT*0VM;~UXjZZjUQvA`w$ zp|d~gmFumu#FeLZI8KIm8|l6XO(_YHW{6-xg~PaVDdC%-k2C;v*uzKp;yQDSFK@`B z0+yrp!6!GgW!}u8vQhp+cv*7$s64!`gRbEA3;CZ*(s}j3GaE?B#Qg@niGiV&2ce~sb&1GqqSyU zRp{rET_&^;ExL-iG|3A6fOVe{@(Q?(#;DxAdvWqhe>0Nfq{6UzPKqhuDA$B#0YlDL zMr$uDcQAnj4RFO^tO=C?nUNT&s-V_dj?kLx+sQvtB;&th6{uZ*xQj7oyUf+Qq*;aQknd6s zqQW^XZ)7gd9q zsZNSHym;;lW4sD_wR2et&3|8BSD|6Ia7kM&79ezgtQF0IyX(r3p8oBkpJEezQJd6t z;nVEcryuMWp5!W*f{m6KJ}fK(tFL^bvVU0M=4bbek+-J_e>3bEckK%1kt7)}dmUF| zziCTH2X3|kTwmh;cK)2%)9N^$vMeqiJni^$S%alj(W<_|$Ng6d92#@G(*0KIUa5)R z=7^}K%F|0ITMW_%xdFRR8_TB~13z6>disjB4Ih{N$oc;k%Rr^;wap(+I~;0xUms#w7vwz)i{NCE>!ZIRWid^L3_Q}N+!HG|iBr{rWYzxF= zd>}iz2<7R4?p0V+r0_vaKnlI%QyQZwyRqK>mzA|uTfgTg!?nz=_gAqD^r6iW19ngE zJ^QQY>(G*}Zwc?Qr5X3TCM>%nmM-9gNVM-9C)^y>w3C)ut|kF>7B$Asa;^UFKL$4( zVhs19cT|f#2Vk_3TmfYq>)@9xH-Wt`|8rkrpr zXzut#()&--;YBm@kEDXwPAA{=y)B&kPws+Gr+c)kP&Vmkk>HLM&S0K!0~cTJYd!qM zB5l?A&%pWCtCsMajf`Y?%76?P-VB{Smu-&7X7z&9kjFy+#qNA#-xVd#Rl!o?LKDUh zyF?SYGE<(y(||ia8Eylxl=9b7T7q0M0g7-pILqPUl_8v&j_b?Wu5jc2&3U+hZGgp( z=sU=hq{gGb!C3~YYNPKa6yD`k-|?K2ZD!`uqVD}?9$ulVY;p$#Hd)fkPV9ALMcpHo zZksiwbz~anU(%GQTnuqVvk5#BAh+p|mgkF@SXmS~JVEcse+>gf_DtagZpjXgrX!1! ze-(}W4E5zdSH?bO^Fh5I9&32UWevE>V%rsUc*h^0ZSCy1lH(_TD`RDd>d)4f4>@dz zfmCv;I++Xj62Y%dH-n>WznD}9wG@i)ArKvvob{kQ$m%e=Xw^WjM$;1~5)mI$@?E|` zY-QG(>g0y(a)NS3kF%q{ShW4g_=PvBy@txhxJlrj< zPNR*zH#z4^X^$OsU{OIkYub%?VTgduQROa^{-~aX_(sv=EjQ8H_6}R_-7hQ^c+d3; zv|aNZqha}`yUK@%B{z9noo*B?dDK%X$p29Uxs_?E4LvlBQW*H!8@>K_%ed6am#z8nSC>dIU92{G5*8ZbA`(~hZu|dmW zI;v8fCUHZSa;LSq+BG5oHV#zJ%X#U%m(r=p`s|+p< zJMNe*)yaQ`3XrMh(n2(QDNz@2)7P%NECjz z;o(%1?}AK`P@>Wv$*;9{?} zq-UlS!R3BJ0!K2U&o&(QY)ZxQZP6I%OJdwBVUNtt&(ppCY@Z7qmb16FH^DyUJYvZ` zN>?>ts`4a^L8fYxd+bYSumWlMu`QjjqXhw#)Cjo_jZmV8VQ^&R>8>WWG@+xT<5N(l zNqA{Wr%&V>YNK^F1EWc6eccsKF=ok50?-zH1gfs^KgY&u0&8^4i5`o`9F#*-`5Zp+q#5C6(rv31Hcf7rdrs(IP2=2{yV2c-&-jLd7 zN0prW7ewqY`=DLsSyE*Ln;lGG*8%`2%>~u4x_hL-IR7)+*l=Cu_%-2mazQ01q9b}w z`ec@%4Wd1G0;z*Yq3hFx5nqd+599ssq0?=Q;?N$lWs@SknW~(*V~}RWJ3sgR@@JjR zNr1Crt-4_6wMW&j>41Cm%cU^O60Td{J4cPlJDTO6o!Tiis1e9We zPF9ri=iFLX$;-r$9xp`Hiof2wFLi1@7G^`crMrxzjSa(5uPowWY<`}z z9j`PlIR!us&(6}2%5q}*;v3c__dGUNsaMV$#{lI`A(z&11u?BUslkV2 zM`<1AG+`e_x6c0La$@9SjS1Mp17hgk?0r&6>)YfO#*GVY=3ZFm(1Q@w*7j^l2KgV} zffU0o3G<%#k`&ZLVYQllNv;J~otzY$uKvz|7L`Es=DWKG2wF5d1{Ja|m=rBbao|d< z!wl)l4lsV^?WT?zQcerDqi|5xLWlCc%hmXwa~C7`8F=1)Hx>JI5>&vG@yNTeRhthw zJZ5SOmM*Oqc?=7_*y6TEleAzTx@dp?qf8D7Ak6T_SL!@MCMnv7NXiBN+aOK5bw5c{ z3|EdDkj-6i%~&wqyw0oszK3~Fb=hc1wPN5Hx9tXQT4Upk4@Q&FJ*uDtJ_lX@w&343 zs>%mWgx-y5Y=5D-CZ4VP%e4IZsS%_d4}`b1;K&vn$zfZJ-0*|p)qq&gK39FN%7z`HE9r1EPU(9NNQKW>tXdUyfL z4%~eFgl$1#A;Z4Z{ElX)(M^V%5<3k*yiJ_`F0#e{j)^2&5f;3^%wNTFnP08BAP+sF z{ah?UcT;7-L?RnitHZwCo*(0X*iPC|z(WSjEn8Udc&vart!WKj}%?xS4U0}!jS@n%1Cc(1cBx=ac*XC*exoKMkHwQ#BoPecn8K=g$P~IMm4$U9) zHpY_5*3aAmhZqNr1}c^e6;ZW?ib?HfWu_=!O1C>&KH9OM>^qiF^&sE9novhIIBo*s!E5a{aNNdqUHDy zO~vS%DCgKFqu)OO;YdHxQ*-=oY(;4W98w&(;^*R0D^KzJr!EDXm?xh=o%`#5CpMsN z`uwdDH-@wwo%HQU?{NB){+;qM$SwVmZJ4E(8yYh+&+eF?YW(tWm*I7?+^SI5K>ebqEk~Axj$gAeY0qaJv14Fwy zy#xVr|Grgd{`82lSG1IY=5oCM$L{VqMa{8W=Lfm%tNvaD?n)aiU;gi)7fFllV!L5v zl8BHSv*U?00WM>eUsL8H{xQZ7P3M+=FdZ(pMipeROncDWXIN4d>AWcoi9qjA1a-~i zOg;DxOjNs#fxg-4Ka3p|S5}<8Tjxsw4m2#{oCjer6Z6sgK44senz)eXwoQM*0~7zh z_%*wyT;45f>R;6BuqMyN{0IBznnNa6Xp0#DBAv$ScX!X@&riNJs}mSPZ~J)gH;vP< zhY;wD(yzz9L+{y+oPi-X%L#tlt@aNX9?tC^Mv5yb=-^8QN{^}1#42|@FUn?Yq-ZzK z+i8RgXdNa{qZ!!20By%$ZFwvOyX1*MHq(b*;YrpWV*iKinIN+FYSM^Hb?&XWEytZ) z-BvfcZN4ICgM&9L4+bmlC1Hnn$7%R}WS05J5ZPz3Xy1;mb;v9kGrv(oJ&x-v3 zs<4r#NTm=lW(YPlNEW)Pzc*KQn|@tB_F?6W+WBGp-sB!PJkA%{sT+A26w24Un~8Q$ zaj5~OOxuig5|F#ZSG%sOu%#g-g6Q9f|JglOcoKZQPWjfkMOoi7i}Q%NE_mqS13Pgn zXoxlUaEb?tx;W`KYcb)59dpwJZI2Ryx#z)yEzJLYC3(aRJT3o3c!__Rm(Q`0DdNVA zWsU + { + /// + /// Initializes the projectDataGenerator + /// and define dataGenerator options + /// + public FileDataGenerator() + { + Faker fakeUser = new Faker() + .RuleFor(user => user.Name, faker => faker.Name.FirstName()) + .RuleFor(user => user.Email, faker => faker.Internet.Email()) + .RuleFor(user => user.IdentityId, faker => faker.Random.Int().ToString()); + + Faker = new Faker() + .RuleFor(p => p.Name, faker => faker.Name.FindName()) + .RuleFor(p => p.Path, faker => faker.System.FilePath()) + .RuleFor(p => p.UploadDateTime, faker => faker.Date.Past()) + .RuleFor(p => p.Uploader, fakeUser); + } + } +} diff --git a/Repositories.Tests/DataSources/FileDataSourceAttribute.cs b/Repositories.Tests/DataSources/FileDataSourceAttribute.cs new file mode 100644 index 00000000..ea71877e --- /dev/null +++ b/Repositories.Tests/DataSources/FileDataSourceAttribute.cs @@ -0,0 +1,53 @@ +using Models; +using NUnit.Framework.Interfaces; +using Repositories.Tests.DataGenerators; +using Repositories.Tests.DataGenerators.Base; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Repositories.Tests.DataSources +{ + /// + /// Attribute to generate projects + /// + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] + public class FileDataSourceAttribute : Attribute, IParameterDataSource + + { + private readonly IFakeDataGenerator fakeDataGenerator; + private readonly int amountToGenerate = 0; + + public FileDataSourceAttribute() + { + fakeDataGenerator = new FileDataGenerator(); + } + + /// + /// Initializes fileDataSourceAttribute + /// and setting the amount of files to be generated + /// + public FileDataSourceAttribute(int amount) : this() + { + amountToGenerate = amount; + } + + /// + /// Generate the data and return it + /// + /// Extra parameters given in the attribute, not in use but required due to inheritance + /// The generated data + public IEnumerable GetData(IParameterInfo parameter) + { + if(amountToGenerate <= 1) + { + return new[] { fakeDataGenerator.Generate() }; + } + List files = fakeDataGenerator.GenerateRange(amountToGenerate).ToList(); + return new[] { files }; + } + } + +} diff --git a/Repositories.Tests/FileRepositoryTest.cs b/Repositories.Tests/FileRepositoryTest.cs new file mode 100644 index 00000000..a20618f3 --- /dev/null +++ b/Repositories.Tests/FileRepositoryTest.cs @@ -0,0 +1,58 @@ +using Models; +using NUnit.Framework; +using Repositories.Tests.Base; +using Repositories.Tests.DataSources; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Repositories.Tests +{ + public class FileRepositoryTest : RepositoryTest + { + /// + /// Gets the repository. + /// + /// + /// The repository. + /// + protected new IFileRepository Repository => (IFileRepository) base.Repository; + + /// + [Test] + public override Task AddAsyncTest_GoodFlow([FileDataSource] File entity) + { + return base.AddAsyncTest_GoodFlow(entity); + } + + /// + [Test] + public override void AddRangeTest_BadFlow_EmptyList() + { + base.AddRangeTest_BadFlow_EmptyList(); + } + + /// + [Test] + public override void AddRangeTest_BadFlow_Null() + { + base.AddRangeTest_BadFlow_Null(); + } + + /// + [Test] + public override Task AddRangeTest_GoodFlow([FileDataSource(5)] List entities) + { + return base.AddRangeTest_GoodFlow(entities); + } + + /// + [Test] + public override void AddTest_BadFlow_Null() + { + base.AddTest_BadFlow_Null(); + } + + } +} diff --git a/Repositories/FileRepository.cs b/Repositories/FileRepository.cs new file mode 100644 index 00000000..8233f266 --- /dev/null +++ b/Repositories/FileRepository.cs @@ -0,0 +1,53 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Microsoft.EntityFrameworkCore; +using Models; +using Repositories.Base; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Linq; + +namespace Repositories +{ + /// + /// IFileRepository + /// + /// /// + public interface IFileRepository : IRepository + { + + + } + + /// + /// FileRepository + /// + /// + /// + public class FileRepository : Repository, IFileRepository + { + + /// + /// Initializes a new instance of the class. + /// + /// The database context. + public FileRepository(DbContext dbContext) : base(dbContext) { } + + } +} diff --git a/Repositories/HighlightRepository.cs b/Repositories/HighlightRepository.cs index ad5f770b..2235ca20 100644 --- a/Repositories/HighlightRepository.cs +++ b/Repositories/HighlightRepository.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -80,6 +80,7 @@ public override async Task FindAsync(int id) Highlight project = await GetDbSet() .Where(s => s.Id == id) .Include(p => p.Project) + .Include(p => p.Project.ProjectIcon) .SingleOrDefaultAsync(); return RedactUser(project); @@ -95,6 +96,7 @@ public async Task> GetHighlightsAsync() .Where(s => s.StartDate <= DateTime.Now || s.StartDate == null) .Where(s => s.EndDate >= DateTime.Now || s.EndDate == null) .Include(p => p.Project) + .Include(p => p.Project.ProjectIcon) .ToListAsync(); return RedactUser(highlights); } @@ -104,6 +106,7 @@ public async Task> GetHighlightsByProjectIdAsync(int projectId) return await GetDbSet() .Where(s => s.ProjectId == projectId) .Include(p => p.Project) + .Include(p => p.Project.ProjectIcon) .ToListAsync(); } } diff --git a/Repositories/ProjectRepository.cs b/Repositories/ProjectRepository.cs index 047691ec..a76f1961 100644 --- a/Repositories/ProjectRepository.cs +++ b/Repositories/ProjectRepository.cs @@ -16,6 +16,7 @@ */ using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query; using Models; using Models.Defaults; using Repositories.Base; @@ -179,7 +180,9 @@ public virtual async Task> GetAllWithUsersAsync( bool? highlighted = null ) { - IQueryable queryable = DbSet.Include(p => p.User); + IQueryable queryable = DbSet + .Include(p => p.User) + .Include(p => p.ProjectIcon); queryable = ApplyFilters(queryable, skip, take, orderBy, orderByAsc, highlighted); List projects = await queryable.ToListAsync(); @@ -243,6 +246,7 @@ public async Task FindWithUserAndCollaboratorsAsync(int id) Project project = await GetDbSet() .Include(p => p.User) .Include(p => p.Collaborators) + .Include(p => p.ProjectIcon) .Where(p => p.Id == id) .FirstOrDefaultAsync(); @@ -268,6 +272,12 @@ public override void Update(Project entity) .State = EntityState.Unchanged; } + if(entity.ProjectIcon == null) + { + DbContext.Entry(entity) + .Entity.ProjectIconId = null; + } + DbSet.Update(entity); } diff --git a/Services.Tests/FileServiceTest.cs b/Services.Tests/FileServiceTest.cs new file mode 100644 index 00000000..cefcf012 --- /dev/null +++ b/Services.Tests/FileServiceTest.cs @@ -0,0 +1,81 @@ +using AngleSharp.Io.Dom; +using Models; +using NUnit.Framework; +using Repositories; +using Repositories.Tests.DataSources; +using Services.Services; +using Services.Tests.Base; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Services.Tests +{ + /// + /// FileServiceTest + /// + /// + [TestFixture] + public class FileServiceTest : ServiceTest + { + + /// + /// Gets the service. + /// + /// + /// The service. + /// + public new IFileService Service => (IFileService) base.Service; + + /// + [Test] + public override void AddRangeTest_GoodFlow([FileDataSource(100)] IEnumerable entities) + { + base.AddRangeTest_GoodFlow(entities); + } + + /// + [Test] + public override void AddTest_GoodFlow([FileDataSource] File entity) + { + base.AddTest_GoodFlow(entity); + } + + /// + [Test] + public override Task GetAll([FileDataSource(100)] List entities) + { + return base.GetAll(entities); + } + + /// + [Test] + public override void Remove([FileDataSource] File entity) + { + base.Remove(entity); + } + + /// + [Test] + public Task RemoveAsync() + { + return base.RemoveAsync(1); + } + + /// + [Test] + public override void Save() + { + base.Save(); + } + + /// + [Test] + public override void Update([FileDataSource] File entity) + { + base.Update(entity); + } + + } +} diff --git a/Services.Tests/RoleServiceTest.cs b/Services.Tests/RoleServiceTest.cs index f1dda08c..dd31ba12 100644 --- a/Services.Tests/RoleServiceTest.cs +++ b/Services.Tests/RoleServiceTest.cs @@ -1,16 +1,16 @@ /* * Digital Excellence Copyright (C) 2020 Brend Smits -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 3 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty -* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. -* -* You can find a copy of the GNU Lesser General Public License +* +* You can find a copy of the GNU Lesser General Public License * along with this program, in the LICENSE.md file in the root project directory. * If not, see https://www.gnu.org/licenses/lgpl-3.0.txt */ @@ -30,7 +30,7 @@ namespace Services.Tests [TestFixture] public class RoleServiceTest : ServiceTest { - + protected new IRoleService Service => (IRoleService) base.Service; /// @@ -83,6 +83,7 @@ public void GetValidScopes() "InstitutionEmbedWrite", "InstitutionRead", "InstitutionWrite", + "FileWrite" }; List retrievedScopes = Service.GetValidScopes(); Assert.AreEqual(currentScopes,retrievedScopes); @@ -105,9 +106,10 @@ public void isValidScope_true() "RoleRead", "RoleWrite", "EmbedWrite", - "EmbedRead" + "EmbedRead", + "FileWrite" }; - bool isValidScope = Service.isValidScope("RoleRead"); + bool isValidScope = Service.IsValidScope("RoleRead"); Assert.IsTrue(isValidScope); } @@ -118,7 +120,7 @@ public void isValidScope_true() [Test] public void isValidScope_false() { - bool isValidScope = Service.isValidScope("role:read"); + bool isValidScope = Service.IsValidScope("role:read"); Assert.IsFalse(isValidScope); } diff --git a/Services/Services/FileService.cs b/Services/Services/FileService.cs new file mode 100644 index 00000000..9b5003cb --- /dev/null +++ b/Services/Services/FileService.cs @@ -0,0 +1,52 @@ +/* +* Digital Excellence Copyright (C) 2020 Brend Smits +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation version 3 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You can find a copy of the GNU Lesser General Public License +* along with this program, in the LICENSE.md file in the root project directory. +* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt +*/ + +using Models; +using Repositories; +using Services.Base; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Services.Services +{ + /// + /// The file service interface. + /// + public interface IFileService : IService + { + + } + + public class FileService : Service, IFileService + { + + /// + /// Initializes a new instance of the class. + /// + /// The repository. + public FileService(IFileRepository repository) : base(repository) { } + + /// + /// + /// + protected new IFileRepository Repository => (IFileRepository) base.Repository; + + + } + +} diff --git a/Services/Services/RoleService.cs b/Services/Services/RoleService.cs index 7298a5de..7df1d937 100644 --- a/Services/Services/RoleService.cs +++ b/Services/Services/RoleService.cs @@ -32,7 +32,7 @@ public interface IRoleService : IService Task> GetAllAsync(); List GetValidScopes(); - bool isValidScope(string scope); + bool IsValidScope(string scope); } @@ -76,7 +76,7 @@ public List GetValidScopes() /// /// true if [is valid scope] [the specified scope]; otherwise, false. /// - public bool isValidScope(string scope) + public bool IsValidScope(string scope) { List scopes = GetValidScopes(); return scopes.Contains(scope); From 6a3ecc5308c031728a234705346fd78da07e6d6f Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 4 Nov 2020 09:49:47 +0100 Subject: [PATCH 144/157] refactor after merge errors --- API/Startup.cs | 3 ++- Data/Helpers/Seed.cs | 3 ++- Postman/dex.postman_collection.json | 4 ++-- runtests_windows.bat | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 runtests_windows.bat diff --git a/API/Startup.cs b/API/Startup.cs index 36ab5ba4..e2315e3f 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -135,6 +135,7 @@ public void ConfigureServices(IServiceCollection services) o.AddPolicy(nameof(Defaults.Scopes.EmbedRead), policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.EmbedRead)))); o.AddPolicy(nameof(Defaults.Scopes.EmbedWrite), + policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.EmbedWrite)))); o.AddPolicy(nameof(Defaults.Scopes.InstitutionEmbedWrite), policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionEmbedWrite)))); @@ -149,7 +150,7 @@ public void ConfigureServices(IServiceCollection services) policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionWrite)))); o.AddPolicy(nameof(Defaults.Scopes.InstitutionRead), policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.InstitutionRead)))); - policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.EmbedWrite)))); + o.AddPolicy(nameof(Defaults.Scopes.FileWrite), policy => policy.Requirements.Add(new ScopeRequirement(nameof(Defaults.Scopes.FileWrite)))); diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index bc663a6f..6a4cab39 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -85,6 +85,7 @@ public static List SeedRoles() new RoleScope(nameof(Defaults.Scopes.InstitutionUserWrite)), new RoleScope(nameof(Defaults.Scopes.InstitutionEmbedWrite)), new RoleScope(nameof(Defaults.Scopes.InstitutionProjectWrite)), + new RoleScope(nameof(Defaults.Scopes.FileWrite)) } }; roles.Add(dataOfficerRole); @@ -104,7 +105,7 @@ public static List SeedRoles() new RoleScope(nameof(Defaults.Scopes.EmbedRead)), new RoleScope(nameof(Defaults.Scopes.EmbedWrite)), new RoleScope(nameof(Defaults.Scopes.InstitutionRead)), - new RoleScope(nameof(Defaults.Scopes.InstitutionWrite)) + new RoleScope(nameof(Defaults.Scopes.InstitutionWrite)), new RoleScope(nameof(Defaults.Scopes.FileWrite)) } }; diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index e2eb903d..8422f6d4 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -12184,14 +12184,14 @@ } ], "url": { - "raw": "{{apiUrl}}/api/File/{dataOfficerFileId}", + "raw": "{{apiUrl}}/api/File/{{dataOfficerFileId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", "File", - "{dataOfficerFileId}" + "{{dataOfficerFileId}}" ] } }, diff --git a/runtests_windows.bat b/runtests_windows.bat new file mode 100644 index 00000000..0f080d83 --- /dev/null +++ b/runtests_windows.bat @@ -0,0 +1 @@ +start cmd /k newman run Postman/dex.postman_collection.json -e Postman/local.postman_environment.json -k \ No newline at end of file From 0adb68b410ea48cb3ad89d415645ab4874f1f902 Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 4 Nov 2020 09:55:07 +0100 Subject: [PATCH 145/157] removed FileWrite from DataOfficer role --- Data/Helpers/Seed.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Data/Helpers/Seed.cs b/Data/Helpers/Seed.cs index 6a4cab39..6c64b32e 100644 --- a/Data/Helpers/Seed.cs +++ b/Data/Helpers/Seed.cs @@ -85,7 +85,6 @@ public static List SeedRoles() new RoleScope(nameof(Defaults.Scopes.InstitutionUserWrite)), new RoleScope(nameof(Defaults.Scopes.InstitutionEmbedWrite)), new RoleScope(nameof(Defaults.Scopes.InstitutionProjectWrite)), - new RoleScope(nameof(Defaults.Scopes.FileWrite)) } }; roles.Add(dataOfficerRole); From f7804f9b67e877a8f784d618e46285a0855c87b4 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 4 Nov 2020 10:47:54 +0100 Subject: [PATCH 146/157] Resolved Brend's feedback for merging --- IdentityServer/Quickstart/TestUsers.cs | 56 ++++++++++++++------------ IdentityServer/Startup.cs | 17 ++++++-- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/IdentityServer/Quickstart/TestUsers.cs b/IdentityServer/Quickstart/TestUsers.cs index 48a49fdf..16755b2a 100644 --- a/IdentityServer/Quickstart/TestUsers.cs +++ b/IdentityServer/Quickstart/TestUsers.cs @@ -37,9 +37,8 @@ public static class TestUsers /// /// Gets the default users. /// - /// if set to true [is production]. /// The list of default identity users. - public static List GetDefaultIdentityUsers(bool isProduction) + public static List GetDefaultIdentityUsers() { List users = new List() { @@ -84,6 +83,16 @@ public static List GetDefaultIdentityUsers(bool isProduction) Email = "berrySmith@email.com" }, new IdentityUser + { + SubjectId = "14785236923", + Username = "dex", + Password = LoginHelper.GetHashPassword("dex"), + Name = "DeX User", + Firstname = "DeX", + Lastname = "User", + Email = "dex@dex.software" + }, + new IdentityUser { SubjectId = "954654861", Username = "john", @@ -93,33 +102,28 @@ public static List GetDefaultIdentityUsers(bool isProduction) Lastname = "Smith", Email = "johnSmith@email.com" }, - new IdentityUser - { - SubjectId = "14785236923", - Username = "dex", - Password = LoginHelper.GetHashPassword("dex"), - Name = "DeX User", - Firstname = "DeX", - Lastname = "User", - Email = "dex@dex.software" - } - }; - if(isProduction) - { - Log.Logger.Information("The passwords for this instance:"); - foreach(IdentityUser testUser in users) - { - // Generate a secure password - string generateSecurePassword = GenerateSecurePassword(); - // Hash it - testUser.Password = LoginHelper.GetHashPassword(generateSecurePassword); - // Notify the user - Log.Logger.Information("{0} has the new password: {1}", testUser.Username, generateSecurePassword); - } - } + }; + return users; } + /// + /// Creates a password for a test user and logs it into the console. + /// + /// The hashed password/. + public static string CreateTestUserPassword(string userName) + { + // Generate a secure password + string securePassword = GenerateSecurePassword(); + + // Hash it + string password = LoginHelper.GetHashPassword(securePassword); + + // Notify the user + Log.Logger.Information("{0} has the new password: {1}", userName, securePassword); + return password; + } + /// /// Generates a secure password. /// diff --git a/IdentityServer/Startup.cs b/IdentityServer/Startup.cs index 78fe170c..a7000045 100644 --- a/IdentityServer/Startup.cs +++ b/IdentityServer/Startup.cs @@ -28,13 +28,19 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Tokens; +using Models; using Repositories; using Services.Services; using System; +using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; + + + + namespace IdentityServer { /// @@ -230,11 +236,16 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment .CreateScope(); using IdentityDbContext context = serviceScope.ServiceProvider.GetService(); context.Database.Migrate(); - if(!context.IdentityUser.Any()) + List identityUsers = TestUsers.GetDefaultIdentityUsers(); + foreach(IdentityUser identityUser in identityUsers.Where(identityUser => !context.IdentityUser.Any(e => e.SubjectId == identityUser.SubjectId))) { - context.IdentityUser.AddRange(TestUsers.GetDefaultIdentityUsers(env.IsProduction())); - context.SaveChanges(); + if(env.IsProduction()) + { + identityUser.Password = TestUsers.CreateTestUserPassword(identityUser.Username); + } + context.Add(identityUser); } + context.SaveChanges(); } } } From aae8da63fed606824b4bde1ea3363da23913277d Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 4 Nov 2020 14:43:50 +0100 Subject: [PATCH 147/157] fixed summaries for controllers --- API/Controllers/ProjectController.cs | 3 ++- API/Controllers/UserController.cs | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 320bc1f1..13d9ff2e 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -57,12 +57,13 @@ public class ProjectController : ControllerBase /// The file service which is used to communicate with the logic layer. /// The mapper which is used to convert the resources to the models to the resource results. /// The authorization helper which is used to communicate with the authorization helper class. + /// The user project service is responsible for users that are following / liking projects. public ProjectController(IProjectService projectService, IUserService userService, IMapper mapper, IAuthorizationHelper authorizationHelper, IFileService fileService, - userProjectService userProjectService) + IUserProjectService userProjectService) { this.projectService = projectService; this.userService = userService; diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index ba5eb19c..b201fbc7 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -45,7 +45,6 @@ public class UserController : ControllerBase private readonly IRoleService roleService; private readonly IAuthorizationHelper authorizationHelper; private readonly IInstitutionService institutionService; - private readonly IProjectService projectService; private readonly IUserUserService userUserService; /// /// Initializes a new instance of the class @@ -55,6 +54,7 @@ public class UserController : ControllerBase /// The role service which is used to communicate with the logic layer. /// The institution service which is used to communicate with the logic layer. /// The authorization helper which is used to communicate with the authorization helper class. + /// The user user service is responsible for users that are following users. public UserController(IUserService userService, IMapper mapper, IRoleService roleService, @@ -67,7 +67,6 @@ public UserController(IUserService userService, this.roleService = roleService; this.authorizationHelper = authorizationHelper; this.institutionService = institutionService; - this.projectService = projectService; this.userUserService = userUserService; } From 5d218e999a82d5b9cfd96eae80df1f94584f0e86 Mon Sep 17 00:00:00 2001 From: Niray Date: Wed, 4 Nov 2020 14:57:48 +0100 Subject: [PATCH 148/157] Postman fix --- Postman/dex.postman_collection.json | 9221 +++++++++++++++++++++------ 1 file changed, 7193 insertions(+), 2028 deletions(-) diff --git a/Postman/dex.postman_collection.json b/Postman/dex.postman_collection.json index e46eb9ee..cd76e8ad 100644 --- a/Postman/dex.postman_collection.json +++ b/Postman/dex.postman_collection.json @@ -1,7 +1,7 @@ { "info": { - "_postman_id": "ff5c49cd-ec16-4a94-86d3-ca649a0d190c", - "name": "Digital-Excellence-API", + "_postman_id": "c6e592b6-9acd-4c94-acba-3334c2b64f46", + "name": "DEV", "description": "Testing Digital Excellence API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "3959ca25-5454-4789-a68e-eb9f48fc2dbe", + "id": "6964ebd2-82a9-41cf-a5ce-d8056f3d3602", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", "", @@ -64,7 +64,7 @@ { "listen": "test", "script": { - "id": "342b4180-2f6c-4c49-89f8-9eba436e912a", + "id": "0b9fa8fb-51ad-4db5-b97c-024ac6ab7ce9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -134,7 +134,7 @@ { "listen": "test", "script": { - "id": "7cacb551-f975-4ceb-881d-4f9d49f1fc18", + "id": "9ef7fd73-e775-4ec9-9f78-fad33b7ddec5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -203,7 +203,7 @@ { "listen": "test", "script": { - "id": "d971f1ae-1aef-463c-b92a-b4a81a1f3a96", + "id": "1d7ea43f-7dc8-4ab3-bc2c-d22c9c34059f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -271,7 +271,7 @@ { "listen": "test", "script": { - "id": "a1745bf9-14cd-44ed-89e0-c26db7e3d387", + "id": "02716b6c-1c35-4a7d-9c62-30b2e7a368d3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userNameUpdated\");", @@ -339,7 +339,7 @@ { "listen": "test", "script": { - "id": "805af601-042b-41f8-a210-33999a98ee38", + "id": "36bb6aa5-5f76-48f6-8e5b-4ad407fc7537", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", @@ -414,7 +414,7 @@ { "listen": "test", "script": { - "id": "072eeb3b-87f6-4c42-844d-2be95810d1b6", + "id": "51b1137d-52f4-4c6c-b5d6-a79735cec350", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", @@ -479,7 +479,7 @@ { "listen": "test", "script": { - "id": "e778d98a-4719-467e-9283-93505626c66a", + "id": "7346272e-372f-4d3d-ab5a-8b03d78e69a6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -546,7 +546,7 @@ { "listen": "test", "script": { - "id": "065d35c4-da01-4a1a-86cb-56972bfeda41", + "id": "251d6939-b80c-4ece-b8f0-6ab6267df5e4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -615,7 +615,7 @@ { "listen": "test", "script": { - "id": "46bf26be-b56e-401b-90c7-3364eaa48bbe", + "id": "ce791940-1a26-47c2-b9bb-bc8b3b665047", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -669,7 +669,7 @@ { "listen": "prerequest", "script": { - "id": "c7889f31-4c31-46b7-8b0a-c14b45c157da", + "id": "1b45bbea-3471-4e86-8480-5b1de2bad9b9", "type": "text/javascript", "exec": [ "" @@ -679,7 +679,7 @@ { "listen": "test", "script": { - "id": "5a9c8687-8786-4dcf-b185-96dc97a02c0a", + "id": "7bf6aea9-eb5f-4d95-8383-ebc845558c91", "type": "text/javascript", "exec": [ "" @@ -699,7 +699,7 @@ { "listen": "test", "script": { - "id": "74d7a485-a039-4f5a-962b-ca11ef0ece3b", + "id": "a24dbef8-9fec-45b3-a69c-9ef795c5cae5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -777,7 +777,7 @@ { "listen": "test", "script": { - "id": "5a3fced7-64d3-40b8-aa39-01d65e3027d2", + "id": "bdf14b4e-8d4e-472c-ac4a-1b2db0e88b00", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -850,7 +850,7 @@ { "listen": "test", "script": { - "id": "f5eeb059-b513-48ee-be05-887b880e7d26", + "id": "c88fa95b-37fb-4b0e-81cb-07cc101ca809", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = parseInt(pm.environment.get(\"projectId\"));", @@ -919,7 +919,7 @@ { "listen": "test", "script": { - "id": "7de7cccf-3170-45c4-9ab0-7da05e1a8d64", + "id": "a8e78dcb-2bd3-4373-b682-cdf7fb0b1f4c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -987,7 +987,7 @@ { "listen": "test", "script": { - "id": "34b9c063-ef9c-456e-8a95-8093cd556523", + "id": "c72e0ffe-1217-47cb-a776-1e33efc12721", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -1055,7 +1055,7 @@ { "listen": "test", "script": { - "id": "d8cee4d6-58df-4396-835f-43cc2561759e", + "id": "d3620fda-c48c-496b-b64e-fca386977ec3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1115,7 +1115,7 @@ { "listen": "test", "script": { - "id": "118b72c4-3865-46ce-93ca-cd5054dd9ace", + "id": "cdbed58f-2ac5-4809-a233-9879d3be326c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -1193,7 +1193,7 @@ { "listen": "test", "script": { - "id": "42ba633b-c28c-41b8-bcdd-31b845308db7", + "id": "0db35c2f-e582-4ed2-a8de-78425cc6beba", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1261,7 +1261,7 @@ { "listen": "test", "script": { - "id": "4558acd9-5c79-4149-bb5b-b91cd1634a47", + "id": "4b6ca7da-74d1-4002-b58b-61350b9119f1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1323,7 +1323,7 @@ { "listen": "test", "script": { - "id": "66f1eb1a-f7a7-4ec2-be15-6d0321994838", + "id": "cd7239f1-475c-407c-890d-0ff0519ce3dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1352,7 +1352,7 @@ { "listen": "prerequest", "script": { - "id": "365a0fcf-1749-42b1-b7ef-b8d1d8e0b253", + "id": "257b66ed-ad88-4b20-8bfb-9e2d9ff1ed36", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -1402,7 +1402,7 @@ { "listen": "test", "script": { - "id": "c791cf1f-5ca9-4a94-8bd9-0609df615dbb", + "id": "0170bc0a-d46b-4ade-a181-7b045cffe3c2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"projectId\");", @@ -1471,7 +1471,7 @@ { "listen": "test", "script": { - "id": "62eb20fb-cdc9-4c4f-9a3a-4e5d882f90dd", + "id": "dfb7191d-2649-4518-a544-00734de7c6fa", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1533,7 +1533,7 @@ { "listen": "test", "script": { - "id": "609b188c-54bc-4928-8b58-f0ebbad36c86", + "id": "4a2c84ce-9e01-4dcd-87a9-09f09d694c27", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -1620,7 +1620,7 @@ { "listen": "test", "script": { - "id": "97d0a335-1e34-4227-b0ed-2ea058dc779f", + "id": "5a01207e-cb21-48aa-9e47-25a97586bcf4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", @@ -1652,7 +1652,7 @@ { "listen": "prerequest", "script": { - "id": "3b461ee3-0b1a-4e4e-a157-f1da4cb02ed5", + "id": "fe233e65-9f3c-4b1a-aff9-85cd22443e79", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -1699,7 +1699,7 @@ { "listen": "test", "script": { - "id": "e8752b93-f3a0-4add-a2b6-97996b1a1ddb", + "id": "a77679fc-f302-4dd5-a6a6-51459773d1e8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", @@ -1758,7 +1758,7 @@ { "listen": "test", "script": { - "id": "7140cc49-6ba3-43ef-a97a-42ee619995a5", + "id": "33c80ca4-9ba7-457b-a204-6b5dbdeaf1a6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1819,7 +1819,7 @@ { "listen": "test", "script": { - "id": "6c64ba60-3ad6-4a88-aa87-b85e79b74d6e", + "id": "97b72717-0ce2-435a-b988-f575fed14b26", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -1883,7 +1883,7 @@ { "listen": "test", "script": { - "id": "1a2d9162-fb27-457c-8990-349a5e86ccf3", + "id": "58cb74a6-235d-4120-9903-67756693ebd6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embedGuid = pm.environment.get(\"embedGuid\");", @@ -1952,7 +1952,7 @@ { "listen": "test", "script": { - "id": "dcbb6572-5b6d-4aee-ba93-b3be3b3371d5", + "id": "1d90d06b-58a8-41b2-887a-b3738ed6e86f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -2010,7 +2010,7 @@ { "listen": "test", "script": { - "id": "e5555f9c-1047-4582-a35d-73b58eb820fd", + "id": "61b30f3f-9cce-4e1d-8768-3926c887da85", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2064,7 +2064,7 @@ { "listen": "test", "script": { - "id": "b911a209-d97f-4a6f-8ea3-eb67c2469825", + "id": "72484a1b-6e8c-4fec-8501-76c2c944d7cd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2125,7 +2125,7 @@ { "listen": "test", "script": { - "id": "f57f81b9-4c7a-4fd6-b3ae-ceb11ea9cc77", + "id": "f9becb0f-0fc4-46b5-8777-cb5844bf8220", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -2198,7 +2198,7 @@ { "listen": "test", "script": { - "id": "4b3b497f-6330-4458-b2cd-284aa8cf217d", + "id": "21fed1c0-dce9-4e71-803a-4fd6319c081b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleName = pm.environment.get(\"roleName\");", @@ -2271,7 +2271,7 @@ { "listen": "test", "script": { - "id": "69097da4-06b5-4e33-b1e5-558d2908b6fc", + "id": "c03aee07-8842-4b8f-9509-33985bce54de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -2337,7 +2337,7 @@ { "listen": "test", "script": { - "id": "58d4ef31-3447-443b-a512-0fb1d9a3d895", + "id": "d4726ff9-0e6c-401c-86ac-1b3aa92b9eb4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2396,7 +2396,7 @@ { "listen": "test", "script": { - "id": "ffed08e6-da64-43d9-9c03-1ed8dd68b33d", + "id": "2091fdaa-5c19-4a52-bcb3-c8f932284814", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2463,7 +2463,7 @@ { "listen": "test", "script": { - "id": "36dab30c-47a9-486e-b076-2e84dce7ab24", + "id": "705ae45e-b8b6-42dd-b8ab-866fd0cab5ea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", @@ -2521,15 +2521,13 @@ { "listen": "test", "script": { - "id": "5f31bdcd-f3c0-4c17-a267-cfb2d49a9b7e", + "id": "aeaf55e2-bd91-4261-ba69-dcae53a1b1ce", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", "", "var jsonData = pm.response.json();", "", - "console.info(pm.environment.get(\"createdUserId\") + \" \" + pm.environment.get(\"roleId\") + \" \" + pm.environment.get(\"projectNameUpdated\") )", - "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -2602,7 +2600,7 @@ { "listen": "test", "script": { - "id": "063fbd43-8a4c-481b-add3-8ce39928077e", + "id": "805f741e-3d37-4714-8182-e99fd2389c3b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var roleId = parseInt(pm.environment.get(\"roleId\"));", @@ -2660,7 +2658,7 @@ { "listen": "test", "script": { - "id": "eab16568-2d97-45d2-aed0-2c09be304b29", + "id": "24aa7ab2-8798-46ac-acc6-c63c68652ddb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -2721,7 +2719,7 @@ { "listen": "test", "script": { - "id": "1626d531-386b-40ca-9eef-cf53ffdfebb0", + "id": "2ca25d0e-b7c5-44db-bcbe-61d7101724f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -2787,7 +2785,7 @@ { "listen": "test", "script": { - "id": "1599761e-8d44-49c4-b817-f94c5c9f8f3e", + "id": "0466ea4a-f5a2-480f-aa3e-a8993af3c29b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", @@ -2845,24 +2843,39 @@ "_postman_isSubFolder": true }, { - "name": "Cleanup", + "name": "Institution", "item": [ { - "name": "Embed-DeleteEmbed-Administrator", + "name": "Institution-CreateInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "3113e8b3-7291-4bc6-965c-a902820f20eb", + "id": "d5b26583-93da-47e3-be58-d2505064a7c9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var institutionName = pm.environment.get(\"institutionName\");", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdInstitutionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -2870,7 +2883,7 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [ { "key": "IdentityId", @@ -2878,29 +2891,41 @@ "value": "{{administratorUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Institution", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "Institution" ] } }, "response": [] }, { - "name": "Highlight-DeleteHighlight-Administrator", + "name": "Institution-GetInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "26808b2e-841f-4893-9388-eaf6ef22a86d", + "id": "909201f5-a955-4461-9627-b4e472296537", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", + "var institutionName = pm.environment.get(\"institutionName\");", + "", + "var jsonData = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", @@ -2908,6 +2933,20 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Id matches: \" + createdInstitutionId, function () {", + " pm.expect(jsonData.id).to.eql(createdInstitutionId);", + "});", + "", + "pm.test(\"Check previously created UserName with id \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -2915,7 +2954,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [ { "key": "IdentityId", @@ -2924,28 +2963,32 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] }, { - "name": "Project-DeleteProject-Administrator", + "name": "Institution-UpdateInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "c05a97c9-6efa-45b9-bbc6-7f810047750f", + "id": "81c8486f-80a9-4b1d-9a8e-1c45acca7e18", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var institutionName = pm.environment.get(\"updatedInstitutionName\");", + "pm.environment.set(\"institutionName\", institutionName);", + "", + "var jsonData = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", @@ -2953,6 +2996,16 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Institution Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -2960,7 +3013,7 @@ } ], "request": { - "method": "DELETE", + "method": "PUT", "header": [ { "key": "IdentityId", @@ -2968,36 +3021,63 @@ "value": "{{administratorUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedInstitutionName}}\",\r\n \"description\": \"postmantest_updated_description\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] }, { - "name": "Role-DeleteRole-WithUsers-Administrator", + "name": "Institution-GetUpdatedInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "52909033-6a79-4035-8f76-71e3fc10d4cc", + "id": "a980ac5b-3836-4a1c-998f-dadb7ecb011c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", + "var institutionName = pm.environment.get(\"institutionName\")", "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Institution Id matches: \" + createdInstitutionId, function () {", + " pm.expect(jsonData.id).to.eql(createdInstitutionId);", + "});", + "", + "pm.test(\"Check if updated institution matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", "});" ], "type": "text/javascript" @@ -3005,7 +3085,7 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [ { "key": "IdentityId", @@ -3014,26 +3094,40 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "Institution", + "{{createdInstitutionId}}" + ], + "query": [ + { + "key": "", + "value": "", + "disabled": true + } ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Cleanup", + "item": [ { - "name": "User-DeleteUser-Administrator", + "name": "Embed-DeleteEmbed-Administrator", "event": [ { "listen": "test", "script": { - "id": "7de5f4bd-5a10-45a9-a12a-dd27866c2b00", + "id": "fd489ab5-f7f4-482b-a80f-36d7084f7ff0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3059,26 +3153,26 @@ } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Embed", + "{{embedGuid}}" ] } }, "response": [] }, { - "name": "Role-DeleteRole-Administrator", + "name": "Highlight-DeleteHighlight-Administrator", "event": [ { "listen": "test", "script": { - "id": "6a8629e4-25c6-44f8-80c9-c23c75ab1054", + "id": "9c275131-d07e-44b0-88d9-ccc319b3cb81", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -3104,44 +3198,31 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "Highlight", + "{{highlightId}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Checkup-on-Cleanup", - "item": [ + }, { - "name": "Project-Get-Deleted-Project-Administrator", + "name": "Project-DeleteProject-Administrator", "event": [ { "listen": "test", "script": { - "id": "86b45db5-d4d6-474c-af2e-8f846673b309", + "id": "c51b5f1c-35dd-4529-bbf4-ef2038c453bc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3153,7 +3234,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -3176,23 +3257,17 @@ "response": [] }, { - "name": "User-Get-Deleted-User-Administrator", + "name": "Institution-DeleteInstitution-Administrator", "event": [ { "listen": "test", "script": { - "id": "debe2ab8-776a-4bac-8ca9-1492a29f8e42", + "id": "766ffcb8-1827-4358-a9b4-8aca9d416850", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3204,7 +3279,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -3213,37 +3288,31 @@ } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] }, { - "name": "Role-Get-Deleted-Role-Administrator", + "name": "Role-DeleteRole-WithUsers-Administrator", "event": [ { "listen": "test", "script": { - "id": "ee615379-27dc-4654-b135-0c85ce68ace5", + "id": "3d0f9e35-e764-4fff-be26-f20b78fa70a4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3255,7 +3324,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -3278,23 +3347,17 @@ "response": [] }, { - "name": "Embed-Get-Deleted-Embed-Administrator", + "name": "User-DeleteUser-Administrator", "event": [ { "listen": "test", "script": { - "id": "8a0f9611-a75d-42f4-91f0-ad66bf1ddf84", + "id": "ddb2f837-c01e-4008-908b-6229dd613e3f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3306,7 +3369,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -3315,37 +3378,31 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "Highlight-Get-Deleted-Highlight-Administrator", + "name": "Role-DeleteRole-Administrator", "event": [ { "listen": "test", "script": { - "id": "a8bb2394-c923-4063-a400-e21a49da52fa", + "id": "22e19434-8ffb-4e15-913e-1e6bc14dce71", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3357,7 +3414,7 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", @@ -3366,14 +3423,14 @@ } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Role", + "{{roleId}}" ] } }, @@ -3382,58 +3439,32 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Guest", - "item": [ + }, { - "name": "Preparation", + "name": "Checkup-on-Cleanup", "item": [ { - "name": "Project-CreateProject", + "name": "Project-Get-Deleted-Project-Administrator", "event": [ { "listen": "test", "script": { - "id": "90d0cf29-65d9-46c2-b4f3-5b5b248347c4", + "id": "e11df416-c5aa-40f8-9372-0a52fff84b78", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectId\", jsonData.id);", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", "});" ], "type": "text/javascript" @@ -3441,7 +3472,7 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -3449,51 +3480,38 @@ "value": "{{administratorUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "Highlight-CreateHighlight", + "name": "User-Get-Deleted-User-Administrator", "event": [ { "listen": "test", "script": { - "id": "afbd00bd-2a58-4ff3-95a1-3e6690c83edf", + "id": "9737e645-34d9-40ac-821a-639dca7d3a80", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3502,25 +3520,10 @@ ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "id": "4956a3a6-f0e0-4d87-b9a4-e08eee04bcb3", - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -3528,51 +3531,38 @@ "value": "{{administratorUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "Embed-CreateEmbed", + "name": "Role-Get-Deleted-Role-Administrator", "event": [ { "listen": "test", "script": { - "id": "8630b5a2-f8c1-4967-98ca-d98d61eebce3", + "id": "7d2e2aa1-ebfc-4b41-8d48-68e2033f4d1e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3584,7 +3574,7 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", @@ -3592,78 +3582,38 @@ "value": "{{administratorUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Role", + "{{roleId}}" ] } }, "response": [] - } - ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "856e690e-92be-4b6c-8f47-4fdaea094f63", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "db9e5e46-34ae-4f6c-bd26-845ff883128d", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-Guest", + "name": "Embed-Get-Deleted-Embed-Administrator", "event": [ { "listen": "test", "script": { - "id": "09207dfd-36c6-4b7e-bf50-d191eb6de97d", + "id": "93892424-c337-4c51-abe4-514aa8effc5b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -3675,57 +3625,50 @@ } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" } - }, + ], "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "Embed", + "{{embedGuid}}" ] } }, "response": [] }, { - "name": "User-GetUser-Guest", + "name": "Highlight-Get-Deleted-Highlight-Administrator", "event": [ { "listen": "test", "script": { - "id": "6f8f2253-da52-45ce-b904-9db4c0d883f6", + "id": "aab50ccd-4d78-4520-ba69-9130d8c0929d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3733,49 +3676,50 @@ } ], "request": { - "auth": { - "type": "noauth" - }, "method": "GET", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "1" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Guest", + "name": "Institution-Get-Deleted-Institution-Administrator", "event": [ { "listen": "test", "script": { - "id": "cb2c5ce0-6f86-42c4-88d7-62f8e2a8890c", + "id": "acea2ffc-b922-4419-9c86-ca3bc46f7f4c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -3783,191 +3727,169 @@ } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" } - }, + ], "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "1" + "Institution", + "{{createdInstitutionId}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ { - "name": "User-DeleteUser-Guest", + "name": "File-CreateFile-Administrator", "event": [ { "listen": "test", "script": { - "id": "d0364b6b-4067-406b-befd-96e05aa61ad5", + "id": "9d2bf23d-9435-425f-b93f-8a4997590adc", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"adminFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "" ], "type": "text/javascript" } } ], "request": { - "method": "DELETE", - "header": [], + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, "url": { - "raw": "{{apiUrl}}/api/User/1", + "raw": "{{apiUrl}}/api/File", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "1" + "File" ] } }, "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "57414607-817a-43a5-a6bd-54a952152a37", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "920efd77-1ce3-44ff-8f6d-f49c6c0dbf28", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "FollowUser", - "item": [ - { - "name": "User-FollowUser-Guest", + "name": "Files-GetAll-Adminstrator", "event": [ { "listen": "test", "script": { - "id": "510c9066-7980-4994-bfd3-8698fd7b22aa", + "id": "82140328-f779-4942-8daf-bab1f01b46c4", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "" + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" ], "type": "text/javascript" } } ], "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "", - "disabled": true + "value": "{{administratorUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "raw": "{{apiUrl}}/api/File", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "follow", - "{{userIdToFollow}}" + "File" ] } }, "response": [] }, { - "name": "User-UnFollowUser-Guest", + "name": "File-Delete-Administrator", "event": [ { "listen": "test", "script": { - "id": "50eedab9-e8d3-44e3-a010-b2c7d2132cc8", + "id": "0883fbc6-a275-42fd-89a8-41ed724501fe", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", "});" ], "type": "text/javascript" @@ -3975,37 +3897,23 @@ } ], "request": { - "auth": { - "type": "noauth" - }, "method": "DELETE", "header": [ { "key": "IdentityId", - "type": "text", - "value": "", - "disabled": true + "value": "{{administratorUserIdentityId}}", + "type": "text" } ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "raw": "{{apiUrl}}/api/File/{{adminFileId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "follow", - "{{userIdToFollow}}" + "File", + "{{adminFileId}}" ] } }, @@ -4014,48 +3922,73 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Guest", + "item": [ { - "name": "Project", + "name": "Preparation", "item": [ { - "name": "Project-CreateProject-Guest", + "name": "Project-CreateProject", "event": [ { "listen": "test", "script": { - "id": "951be4a5-fbeb-475a-b991-c1cbc1dede6e", + "id": "98d512e4-d1ea-4ab9-9d55-87a025504365", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", "});", "", - "" + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" ], "type": "text/javascript" } } ], "request": { - "auth": { - "type": "noauth" - }, "method": "POST", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], "body": { "mode": "raw", "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", @@ -4079,104 +4012,260 @@ "response": [] }, { - "name": "Project-GetAllProjects-Guest", + "name": "Highlight-CreateHighlight", "event": [ { "listen": "test", "script": { - "id": "0cf0b488-2303-4274-af33-460618ae463c", + "id": "32861ffc-9cd9-46e0-a56a-cae528a79391", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", "", "var jsonData = pm.response.json();", "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", + "pm.environment.set(\"highlightId\", jsonData.id);", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "pm.test(\"Project name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" } - } - ], - "request": { - "auth": { - "type": "noauth" }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Guest", - "event": [ { - "listen": "test", + "listen": "prerequest", "script": { - "id": "a4229563-7e8f-4961-af05-dd214c69cd07", + "id": "c8fec1cc-1197-443e-9945-13b020a95076", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed", + "event": [ + { + "listen": "test", + "script": { + "id": "426a7504-a1a4-4cef-8f18-b393eb64de18", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + } + ], + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "e3b3c861-ff01-4482-9ebe-6a4a7fd9ba43", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "767fa6ba-7fb7-4b72-8026-ebc5b51592ba", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "80972692-4def-488f-8fb0-8c0f2fa731d1", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "pm.test(\"Project name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "ceae0db4-e797-47ca-bfca-bce2adad3f37", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -4190,29 +4279,31 @@ "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "User", + "1" ] } }, "response": [] }, { - "name": "Project-UpdateProject-Guest", + "name": "User-UpdateUser-Guest", "event": [ { "listen": "test", "script": { - "id": "870762f7-579b-4abd-a6ed-b79bdf383a09", + "id": "1ad7ea82-fe3d-4ae6-9e7b-293753f70bcb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", @@ -4222,9 +4313,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -4239,7 +4330,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", "options": { "raw": { "language": "json" @@ -4247,13 +4338,13 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Project/1", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", + "User", "1" ] } @@ -4261,12 +4352,12 @@ "response": [] }, { - "name": "Project-DeleteProject-Guest", + "name": "User-DeleteUser-Guest", "event": [ { "listen": "test", "script": { - "id": "5a934f50-4e08-48de-bc5f-dc5a7c4cfe21", + "id": "f30b8751-a4ef-419f-971c-7a07030477c9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4294,13 +4385,13 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{apiUrl}}/api/Project/1", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", + "User", "1" ] } @@ -4315,7 +4406,7 @@ { "listen": "prerequest", "script": { - "id": "773d24e8-3018-44fa-8d83-48f5c0cf879f", + "id": "d63608d7-4e52-4917-97a8-996ff4974201", "type": "text/javascript", "exec": [ "" @@ -4325,7 +4416,7 @@ { "listen": "test", "script": { - "id": "63e4aa40-f44a-4bb5-b382-da57096ab706", + "id": "738c6c62-f7c6-4131-85d2-3326a228d468", "type": "text/javascript", "exec": [ "" @@ -4337,15 +4428,15 @@ "_postman_isSubFolder": true }, { - "name": "FollowProject", + "name": "FollowUser", "item": [ { - "name": "Project-FollowProject-Guest", + "name": "User-FollowUser-Guest", "event": [ { "listen": "test", "script": { - "id": "5cc895c0-f7e1-4457-bca6-b7ab5da63567", + "id": "c6db9e74-45b8-4d16-9a89-da3f48509bea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4387,27 +4478,27 @@ } }, "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "project", + "User", "follow", - "{{projectIdToFollow}}" + "{{userIdToFollow}}" ] } }, "response": [] }, { - "name": "Project-UnFollowProject-Guest", + "name": "User-UnFollowUser-Guest", "event": [ { "listen": "test", "script": { - "id": "e78f5c03-75b0-4a9f-ac4f-568b37003cd3", + "id": "a457e7e6-48de-4ea5-a2d1-c0af355b61ef", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4446,15 +4537,15 @@ } }, "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "project", + "User", "follow", - "{{projectIdToFollow}}" + "{{userIdToFollow}}" ] } }, @@ -4465,15 +4556,15 @@ "_postman_isSubFolder": true }, { - "name": "Highlight", + "name": "Project", "item": [ { - "name": "Highlight-CreateHighlight-Guest", + "name": "Project-CreateProject-Guest", "event": [ { "listen": "test", "script": { - "id": "10a28a0f-4832-4880-87d4-fdb6283f3be0", + "id": "a7fa363e-9797-4918-843c-320f423dd533", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4492,16 +4583,7 @@ " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "0cd4eb53-60ed-43d4-ab71-aa716b58581a", - "exec": [ + "", "" ], "type": "text/javascript" @@ -4509,11 +4591,14 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -4521,29 +4606,42 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Project" ] } }, "response": [] }, { - "name": "Highlight-GetAllActiveHighlights-Guest", + "name": "Project-GetAllProjects-Guest", "event": [ { "listen": "test", "script": { - "id": "32dbd963-a7a8-442e-a8ae-fce481363a0e", + "id": "2e416405-aec0-4e5c-a203-3c94e2a23ac2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", "var jsonData = pm.response.json();", "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -4556,6 +4654,15 @@ " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -4563,37 +4670,37 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Project" ] } }, "response": [] }, { - "name": "Highlight-GetHighlight-Guest", + "name": "Project-GetProject-Guest", "event": [ { "listen": "test", "script": { - "id": "46b4252b-d05a-4406-8e29-6f3f9131b1a1", + "id": "da4e44e7-8517-4115-8d44-a1449607a5e3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -4608,8 +4715,8 @@ " pm.response.to.be.json;", "});", "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", + "pm.test(\"Project name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -4617,64 +4724,18 @@ } ], "request": { + "auth": { + "type": "noauth" + }, "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-ByProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "id": "6c7e11ec-988b-4cce-bde0-4d6f65bd87d4", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", "Project", "{{projectId}}" ] @@ -4683,17 +4744,15 @@ "response": [] }, { - "name": "Highlight-UpdateHighlight-Guest", + "name": "Project-UpdateProject-Guest", "event": [ { "listen": "test", "script": { - "id": "275208d6-55cb-4fa6-aef0-acf699f44cbd", + "id": "aa000514-a3fa-429e-8473-5ff9246df48b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", @@ -4706,29 +4765,21 @@ " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "a33e4758-716e-4fb8-9cd9-a5ea66a85421", - "exec": [ - "" + "});" ], "type": "text/javascript" } } ], "request": { + "auth": { + "type": "noauth" + }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -4736,26 +4787,26 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Project/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Project", + "1" ] } }, "response": [] }, { - "name": "Highlight-DeleteHighlight-Guest", + "name": "Project-DeleteProject-Guest", "event": [ { "listen": "test", "script": { - "id": "ac7c46e9-0367-4c19-8969-349f5d6cb822", + "id": "397cf71d-3c84-4d92-a338-83db53525403", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4783,14 +4834,14 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Project/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Project", + "1" ] } }, @@ -4804,7 +4855,7 @@ { "listen": "prerequest", "script": { - "id": "a0db9188-0cf6-4761-81ce-335222566114", + "id": "8ea632fa-e181-4ede-941d-38863705aa10", "type": "text/javascript", "exec": [ "" @@ -4814,7 +4865,7 @@ { "listen": "test", "script": { - "id": "938a8168-eac8-4f3f-8303-bef273fa9dc8", + "id": "b9cce8e6-c912-44ee-aa48-ac32b67279c0", "type": "text/javascript", "exec": [ "" @@ -4826,15 +4877,15 @@ "_postman_isSubFolder": true }, { - "name": "Embed", + "name": "FollowProject", "item": [ { - "name": "Embed-CreateEmbed-Guest", + "name": "Project-FollowProject-Guest", "event": [ { "listen": "test", "script": { - "id": "dce43e5e-bc20-438f-8f6a-13d4b794bea1", + "id": "43a28d31-8025-40fc-96c2-1f5b052d673a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -4847,23 +4898,28 @@ "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" + "" ], "type": "text/javascript" } } ], "request": { + "auth": { + "type": "noauth" + }, "method": "POST", - "header": [], + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -4871,42 +4927,36 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "project", + "follow", + "{{projectIdToFollow}}" ] } }, "response": [] }, { - "name": "Embed-GetAllEmbeds-Guest", + "name": "Project-UnFollowProject-Guest", "event": [ { "listen": "test", "script": { - "id": "ef59dae2-be04-41e3-861e-d6c0de1b4df7", + "id": "e76446d8-52bb-417f-a095-375f781669cb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -4914,35 +4964,63 @@ } ], "request": { - "method": "GET", - "header": [], + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "project", + "follow", + "{{projectIdToFollow}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Highlight", + "item": [ { - "name": "Embed-GetEmbed-Guest", + "name": "Highlight-CreateHighlight-Guest", "event": [ { "listen": "test", "script": { - "id": "6a89a408-4b17-40e8-a99e-e9c7b5020051", + "id": "5241ae1c-e65e-4531-ac0a-5ab7d75618c6", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -4950,46 +5028,64 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "9168535c-5423-484f-be2e-48d68e48c838", + "exec": [ + "" ], "type": "text/javascript" } } ], "request": { - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "Highlight" ] } }, "response": [] }, { - "name": "Embed-DeleteEmbed-Guest", + "name": "Highlight-GetAllActiveHighlights-Guest", "event": [ { "listen": "test", "script": { - "id": "aea2d332-3aa8-4332-8626-119585650fa1", + "id": "f30de79f-182b-4f95-9d16-0273610a128e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -4997,9 +5093,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -5007,68 +5103,39 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "Highlight" ] } }, "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "d8cd3cc2-e687-4c82-9d32-b0ba288e1342", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "24962589-cd19-460f-b735-a4ef5d10c02e", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Role", - "item": [ - { - "name": "Role-CreateRole-Guest", + "name": "Highlight-GetHighlight-Guest", "event": [ { "listen": "test", "script": { - "id": "0e57dd13-7312-4492-b258-dd28b79cc7dc", + "id": "575271a6-370c-4ca1-8872-b8886961d542", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -5076,48 +5143,43 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", - "" + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "Role-GetAllRoles-Guest", + "name": "Highlight-GetHighlight-ByProject-Guest", "event": [ { "listen": "test", "script": { - "id": "73036bf2-8aef-4c37-9b81-b1e0d29c14cc", + "id": "a39e9bbf-98f9-4265-935e-0dcd023108e8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5146,25 +5208,27 @@ "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "Highlight", + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "Scope-GetAllScopes-Guest", + "name": "Highlight-UpdateHighlight-Guest", "event": [ { "listen": "test", "script": { - "id": "7a231724-c7b8-430b-a8d5-af6c537e85d0", + "id": "67e6b806-8ddd-4e71-959f-665642be7674", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5187,32 +5251,51 @@ ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "id": "f4cdd8e9-e6f2-43cf-9e02-3e5191e40ded", + "exec": [ + "" + ], + "type": "text/javascript" + } } ], "request": { - "method": "GET", + "method": "PUT", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "Scopes" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "Role-GetRole-Guest", + "name": "Highlight-DeleteHighlight-Guest", "event": [ { "listen": "test", "script": { - "id": "5f367f44-4423-4377-b979-488a2e4decac", + "id": "f3ae3ce2-e797-4860-bb1c-8bc5b5a7b26f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5227,40 +5310,71 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "GET", + "method": "DELETE", "header": [], "url": { - "raw": "{{apiUrl}}/api/Role/1", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "1" + "Highlight", + "{{highlightId}}" ] } }, "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0cd715b5-0928-49d4-adb7-f3ade79723fe", + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "Role-UpdateRole-Guest", + "listen": "test", + "script": { + "id": "e887c31a-3420-40fd-848d-f926ba576904", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Guest", "event": [ { "listen": "test", "script": { - "id": "ad043126-77de-4c1e-a216-fa5334605a43", + "id": "b92edfe1-1374-443f-b3c4-57f2caa86f01", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5275,22 +5389,21 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "PUT", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", "options": { "raw": { "language": "json" @@ -5298,26 +5411,25 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role/1", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "1" + "Embed" ] } }, "response": [] }, { - "name": "Role-SetRole-Guest", + "name": "Embed-GetAllEmbeds-Guest", "event": [ { "listen": "test", "script": { - "id": "63dfa67f-445b-41ef-baca-f055197fdb4f", + "id": "6caaba6f-b52a-48fc-83e2-a23b1ceb1a0d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5332,96 +5444,43 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "PUT", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId=1", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "1", - "description": "Id of the role that you want to update the user with" - } + "Embed" ] } }, "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "id": "45c9c6ca-e7bd-4057-8b6c-92f50be232c0", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "f62d613b-7bd0-4b40-930d-b4b6febca54c", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Search", - "item": [ - { - "name": "Search-SearchInternal-Guest", + "name": "Embed-GetEmbed-Guest", "event": [ { "listen": "test", "script": { - "id": "01e6f9b3-a6b7-4587-b099-18bbc5becfda", + "id": "9317d1a0-c453-44af-a674-dae19c676a87", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", + "var jsonData = pm.response.json();", + "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -5441,21 +5500,64 @@ } ], "request": { - "auth": { - "type": "noauth" - }, "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Search/internal/1", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Search", - "internal", - "1" + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "5c1dc9cd-1dc4-46d3-ba19-4d4458131384", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" ] } }, @@ -5469,7 +5571,7 @@ { "listen": "prerequest", "script": { - "id": "096c8a0a-35c7-4abb-9f45-dc2c853cef10", + "id": "0bb783f3-8b43-42f1-a99b-922f26d2e6b0", "type": "text/javascript", "exec": [ "" @@ -5479,7 +5581,7 @@ { "listen": "test", "script": { - "id": "c060a22e-dae1-495a-bd6e-91dc0b3393d0", + "id": "fb6905db-617b-4900-b07d-85d405f5d4a4", "type": "text/javascript", "exec": [ "" @@ -5491,15 +5593,71 @@ "_postman_isSubFolder": true }, { - "name": "Wizard", + "name": "Role", "item": [ { - "name": "Wizard-GetWizard-Guest", + "name": "Role-CreateRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "9d7c9287-2dee-4a33-a455-33bf7a990208", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-Guest", "event": [ { "listen": "test", "script": { - "id": "78effdf9-a66c-4439-96ce-09540b6c1187", + "id": "f071c5fb-4c85-40d1-b7ad-26590cb0f04f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -5528,34 +5686,4750 @@ "method": "GET", "header": [], "url": { - "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "raw": "{{apiUrl}}/api/Role", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Wizard" + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "2d3d93d2-4cd3-43ec-be94-19a34c0595b4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" ], - "query": [ - { - "key": "sourceURI", - "value": "{{wizardSourceUri}}", - "description": "This is the URI that the wizard will use to fetch the source." - } + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "4ae269d6-9e83-4eee-b2a6-1cc13fbb41d1", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "a6906323-2531-472a-a613-608f89e05f6d", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "df6e9ed9-4e12-4752-a76b-6772989222f9", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId=1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "1", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "3dc039e8-dd95-4fe5-9623-f2d49259b595", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "4786f803-26f2-4025-a927-cf907210fa3f", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "08276a29-1db6-4749-a13b-0763a0629e01", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "191ab3dc-e4eb-4705-bb09-31a6c70153f6", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "a2dd911f-4216-444f-bcbd-e686376c33d1", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Wizard", + "item": [ + { + "name": "Wizard-GetWizard-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "ecc91463-427e-4dc6-a38b-a193946482ae", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Wizard" + ], + "query": [ + { + "key": "sourceURI", + "value": "{{wizardSourceUri}}", + "description": "This is the URI that the wizard will use to fetch the source." + } + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "ab26f3a0-48cf-47e4-955e-920de683419a", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "4ed61567-50ae-4531-9741-9fcffa533858", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "5db5686b-a102-4139-9c20-7ef0a7e93c5b", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "837cb2cf-f6b1-4fa5-b59a-518f1332a8dd", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "fe783a1d-eef2-4e37-9736-8a86b1156237", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{institutionName}}\",\r\n \"description\": \"postmantest_initial_description\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "f3151c4a-661d-408b-aec1-445809ddf149", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c8ad2df0-51e9-4072-a4ee-65ebefdac1ad", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "9a0173d3-07fb-4b58-b372-dbcf5954c369", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "b91addfe-3646-41cc-b0bd-a21da7f71343", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "e9b905fe-a66f-40b9-b99a-27f25d765e73", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "File-Delete-Guest", + "event": [ + { + "listen": "test", + "script": { + "id": "0bc0a11b-0c47-4ae6-8249-7345833ededd", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "1" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "80b95096-4c32-4ad3-ad02-fa6220287ba8", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "f2ef95f0-9210-49eb-ad26-e20bc2cc07f0", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Registered", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "User-CreateUser", + "event": [ + { + "listen": "test", + "script": { + "id": "8811e69e-0b35-4a09-93f6-d69ef893f370", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"identityId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject", + "event": [ + { + "listen": "test", + "script": { + "id": "39e74194-44f5-4b47-87d0-32407322f7b7", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "id": "e1eb2b73-80f5-401c-83df-7935d9407e4f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "b730d69e-01d3-4449-8127-772682945871", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed", + "event": [ + { + "listen": "test", + "script": { + "id": "b7db516e-fbfe-44a3-8ca9-34f39102fb66", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Role-CreateRole", + "event": [ + { + "listen": "test", + "script": { + "id": "4273164b-08e1-4a2b-a9fe-421d5a7ba8ec", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var scopeName = pm.environment.get(\"scopeName\");", + "var roleName = pm.environment.get(\"roleName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"roleId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", + " pm.expect(jsonData.name).to.eql(roleName);", + "});", + "", + "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", + " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + } + ], + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "2a6230ff-1c53-4c07-b189-e029cab018c6", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "0a7b6994-ada4-434c-b10c-960b718277c6", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "128c71ca-1cd8-4675-b92e-140b97f39deb", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "ab25fb25-7ce1-4f00-b1aa-e52d31cf6e55", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "c1f0e6b5-929c-40d9-baf9-bffa5890f71a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"registeredUserId\", jsonData.id);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "22173fd5-9416-4276-b06d-181e0c1ccdef", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{registeredUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "12145fe5-0b98-4229-b42a-abc7d3c44242", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "377ce9fd-c4eb-4259-a88b-0e361756b44f", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "5662b015-20ca-409d-a3c4-e113271fdd51", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "fed9172f-ff4d-47be-b30f-4ffeff4ee69b", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "var userId = pm.environment.get(\"userIdToFollow\");", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "945c06d6-999b-47f5-a980-7bc1399a6412", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "b21cfbc2-0fac-42d2-8cec-acf5e20988e2", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "f73ac086-ca6b-4f23-a114-f06de99ceec7", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "3e3c69cb-0223-44c0-86e7-8318b064dfa8", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var registeredUserId = pm.environment.get(\"registeredUserId\");", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", + " pm.expect(jsonData.user.id).to.eql(registeredUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "3f1bff2a-7e9d-4547-af87-be9d9c9e6163", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "0e336e5d-4bbe-4320-8f1a-d79eb3059bf4", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "8e7079c3-23b0-4552-9b08-dd7b4e17cd9f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "d3e8b335-d5f9-4157-96ce-d04d47adf85e", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "cefad3b3-01a4-4a42-a3d5-1e2018dce02a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "FollowProject", + "item": [ + { + "name": "Project-FollowProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "948f8245-7185-44c3-aeab-c5e9ec08786b", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectId = pm.environment.get(\"projectIdToFollow\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "142108d1-913e-4f42-9ba5-8f32a6b93b89", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "2b0b42e3-378e-47a1-a886-609b124fd482", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "36ef27ad-305a-486d-b076-8579caaa8ca5", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "473933cf-0011-48d0-b723-b6bcaefb854b", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "ed0064d3-c5b3-4d11-b7dc-74251971f5aa", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "51723417-1065-4a81-bb80-168b971137d2", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "0dee7349-8d76-4e2c-8d6e-c6f00441c938", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "47c4b114-97fd-4a1d-9384-d4992ca0ad85", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "81abc07a-ea84-49bf-aaf0-5153f00fe778", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "6f2cd63f-898a-4ef8-b9a7-9d95f601a98b", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectId = pm.environment.get(\"adminProjectId\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "6b7f2153-caa0-46d2-bafb-5eb973fd4fd9", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "9b859aa1-6599-48fc-b1f8-00d1239e43a0", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "e7629aab-9e24-4cfc-80d3-d32b469ad1fa", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "5a37ee16-a483-4e55-a677-59e04d5c5e7a", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "bcae004a-1d80-4975-9295-6ca29c3b71de", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "29979d46-bda5-414c-9cc1-0100430b1bb3", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "38c4c139-4c15-4051-a9a2-618acf6183b2", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "5187a261-0902-4459-8b9a-2622b3b47bc7", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "081c88c0-e7aa-44ad-87c4-f2141acac627", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "6badbdac-75cd-4d55-8417-50af85245321", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "{{projectName}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Wizard", + "item": [ + { + "name": "Wizard-GetWizard-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "01c5c14a-bff7-4dff-b271-f052cc2c8a52", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Wizard" + ], + "query": [ + { + "key": "sourceURI", + "value": "{{wizardSourceUri}}", + "description": "This is the URI that the wizard will use to fetch the source." + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "a5167204-af6a-4d05-b665-b1b108895488", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "1d1f2b5c-7620-4c53-8eec-e287b3c0fb2e", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "e1be96e5-dcfb-4692-a3bb-c8104acec4de", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "6c12a67a-4b5d-49f9-93ad-848e17f5a897", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "1d62abb5-ec15-4413-93fd-4b1ba48c08fa", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "77b9fb84-08d6-40f3-9a79-c263e0338f29", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Cleanup", + "item": [ + { + "name": "Embed-DeleteEmbed-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "61f9e1af-28eb-4ca9-a01c-d1cc6296a4d5", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "5686e89f-34ee-48fd-b4cb-723396f9b628", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{adminEmbedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "df8065b4-e878-4345-8a48-98edb34f8b0d", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "f7ef2b02-924f-4e3d-913c-f50742ae5b20", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "fcced135-50a7-4691-9382-632c82cb82c0", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Role-DeleteRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "77fa93d2-a96b-480f-9e4f-3d7efcbe1983", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "14292b23-fa91-41cf-9bea-104e73f91826", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "df8bd5f3-cda1-4879-a177-6c69501bb45d", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"registeredFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "2cd4dc4e-1d87-4105-b291-3869cbe02fd7", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "var jsonData = pm.response.json();\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "id": "97323e4e-6a2e-4db5-9294-da472e69380f", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{registeredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{registeredFileId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Data Officer", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "Institution-CreateInstitution", + "event": [ + { + "listen": "test", + "script": { + "id": "dcf0d3e3-18b1-4aab-9b1e-af10724dd607", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var institutionName = pm.environment.get(\"institutionName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdInstitutionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution" + ] + } + }, + "response": [] + }, + { + "name": "User-CreateUserWithoutInstitution", + "event": [ + { + "listen": "test", + "script": { + "id": "57eb4cce-ddcb-46e0-8cc7-ff8c3cbdf908", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"identityId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-CreateUserWithInstitution", + "event": [ + { + "listen": "test", + "script": { + "id": "e2e87bf5-2859-4e83-a9d6-10c20810c7e9", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserWithInstitutionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\",\n \"institutionId\": {{institutionIdFromUser}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject-DifferentInstitution", + "event": [ + { + "listen": "test", + "script": { + "id": "129e6cb3-8b03-4329-a8e6-029421c1d288", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject-SameInstitution", + "event": [ + { + "listen": "test", + "script": { + "id": "1410364d-f4e2-4a33-bb65-5ed22f3b66c8", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectIdWithInstitution\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "\"9996\"" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "id": "08ecb609-259f-4f28-b2c7-2501cdf9f2dc", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "id": "a7b1fde6-4ecb-4e6c-abeb-5cceba84fcdf", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-DifferentInstitution", + "event": [ + { + "listen": "test", + "script": { + "id": "e496a914-283c-46dd-aa5b-668bd4b86e20", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-SameInstitution", + "event": [ + { + "listen": "test", + "script": { + "id": "ec4a9efa-7f49-4838-896f-a327248b49f3", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuidWithInstitution\", jsonData.guid);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "\"9996\"" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectIdWithInstitution}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Role-CreateRole", + "event": [ + { + "listen": "test", + "script": { + "id": "c77344bc-d351-4196-baac-714fedb7205c", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var scopeName = pm.environment.get(\"scopeName\");", + "var roleName = pm.environment.get(\"roleName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"roleId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", + " pm.expect(jsonData.name).to.eql(roleName);", + "});", + "", + "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", + " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" ] } }, "response": [] } ], - "auth": { - "type": "noauth" - }, + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", "event": [ { "listen": "prerequest", "script": { - "id": "048601b5-68c6-408c-bc0e-67a03e1e0be3", + "id": "e19a4cbd-f898-425e-80dd-aa8820193249", "type": "text/javascript", "exec": [ "" @@ -5565,7 +10439,7 @@ { "listen": "test", "script": { - "id": "577a1710-eebb-49fc-8fe4-d38944b7a50d", + "id": "52031bed-2f2e-4c5d-b8db-20d0847c89b8", "type": "text/javascript", "exec": [ "" @@ -5575,71 +10449,33 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "3c5906bc-b907-4870-84f0-3a7b3f1852a9", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "07217920-cb4e-4889-9905-12f406160ce3", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Registered", - "item": [ - { - "name": "Preparation", + "name": "User", "item": [ { - "name": "User-CreateUser", + "name": "User-CreateUser-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "dd15797f-2330-4934-bfd7-54fdc6d043b5", + "id": "bab77718-ca44-40e3-af42-31568880c9f3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = pm.environment.get(\"userName\");", - "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"identityId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", "});" ], "type": "text/javascript" @@ -5652,12 +10488,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\",\n \"institutionId\": {{createdInstitutionId}}\n}", "options": { "raw": { "language": "json" @@ -5678,47 +10514,29 @@ "response": [] }, { - "name": "Project-CreateProject", + "name": "User-GetUser-Other-DifferentInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "727b0ae4-e04c-4739-babe-c58e461660df", + "id": "7ca75454-424a-4a51-b20a-04d4e6b199cc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"projectId\", jsonData.id);", - "pm.environment.set(\"adminProjectId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", "});" ], "type": "text/javascript" @@ -5726,57 +10544,46 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "Highlight-CreateHighlight", + "name": "User-GetUser-Other-SameInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "b689b19d-2a06-4b6e-ab90-f3f7690697f7", + "id": "98de3371-740a-4409-afa0-4c6a3f0b567a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", @@ -5787,82 +10594,118 @@ ], "type": "text/javascript" } - }, + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserWithInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Self-DataOfficer", + "event": [ { - "listen": "prerequest", + "listen": "test", "script": { - "id": "50d8da57-5f00-4c88-81b2-b0b215b8fb6a", + "id": "a1f39468-66a2-4b5a-8b40-858d04c3c08d", "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var aliceIdentityId = parseInt(pm.environment.get(\"dataOfficerUserIdentityId\"));", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"dataOfficerUserId\", jsonData.id);", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "User" ] } }, "response": [] }, { - "name": "Embed-CreateEmbed", + "name": "User-UpdateUser-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "edf5bb9f-c695-4b76-adca-d6f1f68c4acb", + "id": "e613c0c0-091f-4a68-a8fa-dd91cc63e445", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", "});" ], "type": "text/javascript" @@ -5870,17 +10713,17 @@ } ], "request": { - "method": "POST", + "method": "PUT", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"institutionId\": 1\r\n}", "options": { "raw": { "language": "json" @@ -5888,54 +10731,43 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "User", + "{{dataOfficerUserId}}" ] } }, "response": [] }, { - "name": "Role-CreateRole", + "name": "User-UpdateUser-Other-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "4e8a2885-9bbb-4941-bda1-28bf66d4b6ba", + "id": "ed1c3c9a-7296-4cd2-995b-ba044972502c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var scopeName = pm.environment.get(\"scopeName\");", - "var roleName = pm.environment.get(\"roleName\");", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"roleId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", - " pm.expect(jsonData.name).to.eql(roleName);", - "});", - "", - "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", - " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -5943,17 +10775,17 @@ } ], "request": { - "method": "POST", + "method": "PUT", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", "options": { "raw": { "language": "json" @@ -5961,25 +10793,26 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "User", + "{{createdUserId}}" ] } }, "response": [] } ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "description": "Requests executed as the Alice user with the registered role.", "event": [ { "listen": "prerequest", "script": { - "id": "8d6ef504-b083-4ddc-9008-a0513b500a93", + "id": "235f3947-4be1-40a0-82a8-0795732d23c1", "type": "text/javascript", "exec": [ "" @@ -5989,7 +10822,7 @@ { "listen": "test", "script": { - "id": "5c184acc-c077-4abb-9b44-8d79723a756f", + "id": "110dc3f0-2cfe-49ed-aaf2-b5718dee0a14", "type": "text/javascript", "exec": [ "" @@ -6001,31 +10834,37 @@ "_postman_isSubFolder": true }, { - "name": "User", + "name": "Project", "item": [ { - "name": "User-CreateUser-Registered", + "name": "Project-CreateProject-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "7e32e9f6-8321-4feb-9006-a428168f65b3", + "id": "d346c41e-1969-47e3-b221-76794caac379", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var jsonData = pm.response.json();", + "var registeredUserId = pm.environment.get(\"dataOfficerUserId\");", + "var projectName = pm.environment.get(\"projectName\");", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", + "var jsonData = pm.response.json();", + "pm.environment.set(\"projectId\", jsonData.id);", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", + " pm.expect(jsonData.user.id).to.eql(registeredUserId);", "});" ], "type": "text/javascript" @@ -6038,12 +10877,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -6051,42 +10890,63 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "Project" ] } }, "response": [] }, { - "name": "User-GetUser-Other-Registered", + "name": "Project-GetAllProjects-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "6b57b1b4-a737-4087-a895-8059b848f8fb", + "id": "8f11526c-3670-4d2b-8ea9-e35ebf2bb290", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", + "var foundAt;", "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -6099,53 +10959,101 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Project", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Project" ] } }, "response": [] }, { - "name": "User-GetUser-Self-Registered", + "name": "Project-GetProject-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "ea4d537b-26ec-453e-8458-c4a2dd456bc8", + "id": "caa49d41-4816-4778-9534-85bb3a7c5315", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", + "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", - "pm.environment.set(\"registeredUserId\", jsonData.id);", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Other-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "id": "b9617594-f5ee-40e9-96b0-9c4dce513800", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6158,32 +11066,33 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/User", + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User" + "Project", + "{{adminProjectId}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Self-Registered", + "name": "Project-UpdateProject-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "bceec06e-4a44-4ad3-9815-8105a6e0ab62", + "id": "a498f5c5-b86a-47dd-89c5-de0fd545fba9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "var projectName = pm.environment.get(\"projectNameUpdated\");", "", "var jsonData = pm.response.json();", "", @@ -6201,8 +11110,8 @@ " pm.response.to.be.json;", "});", "", - "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", "});" ], "type": "text/javascript" @@ -6215,12 +11124,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -6228,31 +11137,29 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{registeredUserId}}" + "Project", + "{{projectId}}" ] } }, "response": [] }, { - "name": "User-UpdateUser-Other-Registered", + "name": "Project-UpdateProject-Other-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "e2c03a2b-a43d-4712-9cbf-e93bac36e2be", + "id": "4ddc4e3f-6d88-41c5-bdb1-687b7aa2042e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", @@ -6262,9 +11169,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6277,12 +11184,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -6290,64 +11197,43 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "Project", + "{{adminProjectId}}" ] } }, "response": [] } ], - "description": "Requests executed as the Alice user with the registered role.", - "event": [ - { - "listen": "prerequest", - "script": { - "id": "72a0a0df-4917-46bd-a4bb-42af148256a2", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "4d9a3da8-0a66-4f0b-af84-bffcbe37f175", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { - "name": "FollowUser", + "name": "Embed", "item": [ { - "name": "User-FollowUser-Registered", + "name": "Embed-CreateEmbed-Self-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "673152d7-df9f-4483-8ff8-518caf3bb160", + "id": "8f6f1077-d3f8-40a7-8487-9111218a0a99", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", - "var userId = pm.environment.get(\"userIdToFollow\");", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", @@ -6358,10 +11244,6 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userId, function () {", - " pm.expect(jsonData.id).to.eql(userId);", "});" ], "type": "text/javascript" @@ -6374,12 +11256,12 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", "options": { "raw": { "language": "json" @@ -6387,36 +11269,42 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "follow", - "{{userIdToFollow}}" + "Embed" ] } }, "response": [] }, { - "name": "User-UnFollowUser-Registered", + "name": "Embed-CreateEmbed-Other-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "50cd2fb3-7580-4c45-8133-8ea300bef295", + "id": "7ec0b28c-f329-4df9-85ba-e09ef9bd8919", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6424,17 +11312,17 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "", + "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", "options": { "raw": { "language": "json" @@ -6442,78 +11330,42 @@ } }, "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "follow", - "{{userIdToFollow}}" + "Embed" ] } }, "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "5b97f0a8-863e-4286-a67d-aacfbd152449", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "b17e2239-db09-48ba-b1a6-e5b6ecd6bfe3", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Project", - "item": [ - { - "name": "Project-CreateProject-Registered", + "name": "Embed-GetAllEmbeds-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "e88a64ec-13f1-4674-83b7-8e4be490ef12", + "id": "dfebf407-c55b-4f66-bfbf-8e84748079be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var registeredUserId = pm.environment.get(\"registeredUserId\");", - "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", - "pm.environment.set(\"projectId\", jsonData.id);", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", - " pm.expect(jsonData.user.id).to.eql(registeredUserId);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6521,60 +11373,40 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/Embed", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "Embed" ] } }, "response": [] }, { - "name": "Project-GetAllProjects-Registered", + "name": "Embed-GetEmbed-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "f0bb89ae-e8c0-4719-9ad7-924d561bb576", + "id": "c1258fd9-cfe9-4d63-9e1c-65625d8ec384", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", "", "var jsonData = pm.response.json();", "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -6589,13 +11421,8 @@ " pm.response.to.be.json;", "});", "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", "});" ], "type": "text/javascript" @@ -6608,37 +11435,44 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Project", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project" + "Embed", + "{{embedGuid}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Highlight", + "item": [ { - "name": "Project-GetProject-Self-Registered", + "name": "Highlight-CreateHighlight-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "02fc3765-e2a5-47a8-9d2c-3a4309a550b0", + "id": "9d730cec-a1b6-4a69-a300-c334bf33b675", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectName\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6646,51 +11480,85 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "id": "f829b804-9cb4-445b-8b51-3354f6649de8", + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } } ], "request": { - "method": "GET", + "method": "POST", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "Highlight" ] } }, "response": [] }, { - "name": "Project-GetProject-Other-Registered", + "name": "Highlight-GetAllActiveHighlights-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "85addaf8-323e-48b9-ab17-01e7ce6ac06b", + "id": "02538c24-a9ec-480a-b52c-615e06475863", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var projectId = pm.environment.get(\"adminProjectId\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -6703,6 +11571,11 @@ " pm.response.to.be.ok;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", "});" ], "type": "text/javascript" @@ -6715,36 +11588,39 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "raw": "{{apiUrl}}/api/Highlight", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{adminProjectId}}" + "Highlight" ] } }, "response": [] }, { - "name": "Project-UpdateProject-Self-Registered", + "name": "Highlight-GetHighlight-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "40349407-e8ef-4492-9bfd-e9fcbccb5155", + "id": "bf402078-d7ab-49a7-9535-e9a4219f2b8a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectName = pm.environment.get(\"projectNameUpdated\");", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", "", "var jsonData = pm.response.json();", "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -6754,13 +11630,13 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", "});" ], "type": "text/javascript" @@ -6768,49 +11644,42 @@ } ], "request": { - "method": "PUT", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "Highlight", + "{{highlightId}}" ] } }, "response": [] }, { - "name": "Project-UpdateProject-Other-Registered", + "name": "Highlight-GetHighlight-ByProject-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "af35e368-f1c9-43b3-a99e-b1af5700a51a", + "id": "5c2c85b0-ea5b-4ce8-a052-b325dc78c4c4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -6818,83 +11687,64 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});" + "});", + "" ], "type": "text/javascript" } } ], "request": { - "method": "PUT", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", + "Highlight", "Project", - "{{adminProjectId}}" + "{{projectId}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "FollowProject", - "item": [ + }, { - "name": "Project-FollowProject-Registered", + "name": "Highlight-UpdateHighlight-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "b3e31ee0-54fc-434f-95d7-9f0fb2d6cfc0", + "id": "aaae7f2a-03e7-451c-b73b-2d93c88b4579", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectId = pm.environment.get(\"projectIdToFollow\");", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", - "pm.test(\"Check if created Username matches: \" + projectId, function () {", - " pm.expect(jsonData.id).to.eql(projectId);", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6902,17 +11752,17 @@ } ], "request": { - "method": "POST", + "method": "PUT", "header": [ { "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" } ], "body": { "mode": "raw", - "raw": "", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", "options": { "raw": { "language": "json" @@ -6920,36 +11770,50 @@ } }, "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "project", - "follow", - "{{projectIdToFollow}}" + "Highlight", + "{{highlightId}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Role", + "item": [ { - "name": "Project-UnFollowProject-Registered", + "name": "Role-CreateRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "59159987-9feb-4117-97fc-a56880c7d6e2", + "id": "32e0ebcd-aeff-44fc-a7cd-7b791badf0c0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -6957,17 +11821,17 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", "options": { "raw": { "language": "json" @@ -6975,76 +11839,42 @@ } }, "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "raw": "{{apiUrl}}/api/Role", "host": [ "{{apiUrl}}" ], "path": [ "api", - "project", - "follow", - "{{projectIdToFollow}}" + "Role" ] } }, "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "5643d783-c75a-4760-b909-f2657780f2dc", - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "id": "ad9466f3-3a63-4785-a446-73bb34c48718", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Embed", - "item": [ - { - "name": "Embed-CreateEmbed-Self-Registered", + "name": "Role-GetAllRoles-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "5ce8c755-666f-49d3-a898-81e6bde11c2b", + "id": "e896e493-a917-47f5-b4a6-3183895049a0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", "});" ], "type": "text/javascript" @@ -7052,50 +11882,41 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Role", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Role" ] } }, "response": [] }, { - "name": "Embed-CreateEmbed-Other-Registered", + "name": "Scope-GetAllScopes-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "fbbbbb00-310d-4ff9-88a0-e3e8f3f2d65e", + "id": "5f8c16f5-2e21-413e-9c47-b0dedd54d108", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7103,7 +11924,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7113,43 +11934,35 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Role/Scopes", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Role", + "Scopes" ] } }, "response": [] }, { - "name": "Embed-GetAllEmbeds-Registered", + "name": "Role-GetRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "33678519-5ea9-4f8c-afba-8f182114d5c1", + "id": "681c8ceb-0edd-4d49-94da-1627ec61ab1c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7179,37 +11992,37 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Embed", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed" + "Role", + "{{roleId}}" ] } }, "response": [] }, { - "name": "Embed-GetEmbed-Registered", + "name": "Role-UpdateRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "9bc03102-af12-4557-adf7-817a6a5b7003", + "id": "58c38360-23e5-4fef-81cf-ae9d291cbcbe", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7217,13 +12030,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", - " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -7231,42 +12040,44 @@ } ], "request": { - "method": "GET", + "method": "PUT", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "Role", + "{{roleId}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Highlight", - "item": [ + }, { - "name": "Highlight-CreateHighlight-Registered", + "name": "Role-SetRole-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "df430e96-892a-4254-a331-9e062333d574", + "id": "88376374-a30d-45d6-b237-7f085d465771", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7288,35 +12099,20 @@ ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "id": "384f0d0f-1ba6-4c13-b62d-957aca4e94fa", - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } } ], "request": { - "method": "POST", + "method": "PUT", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "body": { "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", "options": { "raw": { "language": "json" @@ -7324,41 +12120,47 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Search", + "item": [ { - "name": "Highlight-GetAllActiveHighlights-Registered", + "name": "Search-SearchInternal-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "adc61dc4-8f24-4ea3-b3fb-05489bf507fa", + "id": "38d81ac7-6862-4593-bc2c-94f9eb06e82e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var projectId = pm.environment.get(\"adminProjectId\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findItem(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", @@ -7369,14 +12171,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", - " foundAt = findItem(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -7389,39 +12186,43 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Highlight", + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight" + "Search", + "internal", + "{{projectName}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Wizard", + "item": [ { - "name": "Highlight-GetHighlight-Registered", + "name": "Wizard-GetWizard-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "83f38279-52f5-470d-ba46-46a54092c6d4", + "id": "f18b98aa-49a9-44fa-830e-a80e873e279e", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", "", "var jsonData = pm.response.json();", "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", @@ -7432,12 +12233,8 @@ "", "pm.test(\"Response must be valid and have a json body\", function () {", " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -7450,92 +12247,108 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "Wizard" + ], + "query": [ + { + "key": "sourceURI", + "value": "{{wizardSourceUri}}", + "description": "This is the URI that the wizard will use to fetch the source." + } ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Institution", + "item": [ { - "name": "Highlight-GetHighlight-ByProject-Registered", + "name": "Institution-CreateInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "7bf26e55-6cd2-4f01-8a04-8cb722ceaa4f", + "id": "3c4c49ea-085c-4a6d-966e-eb1f63964237", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});", - "" + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } } - ], + }, "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/User", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "Project", - "{{projectId}}" + "User" ] } }, "response": [] }, { - "name": "Highlight-UpdateHighlight-Registered", + "name": "Institution-GetInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "9927ea3e-941f-423c-896a-de89743d2d36", + "id": "94d74f73-ee6d-4256-aec5-31ed021dea55", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7543,7 +12356,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7553,58 +12366,39 @@ } ], "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } + "auth": { + "type": "noauth" }, + "method": "GET", + "header": [], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "User", + "1" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Role", - "item": [ + }, { - "name": "Role-CreateRole-Registered", + "name": "Institution-UpdateInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "288043e3-d53e-4fdc-ac44-bdaaa4c6dd49", + "id": "1a3aa559-d044-4d50-bd15-2e2acc35a4de", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7612,7 +12406,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7622,17 +12416,14 @@ } ], "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", "options": { "raw": { "language": "json" @@ -7640,32 +12431,33 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "User", + "1" ] } }, "response": [] }, { - "name": "Role-GetAllRoles-Registered", + "name": "Instituiton-DeleteInstitution-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "6bb006ec-9ce5-4fcd-a077-e7817c1f4356", + "id": "705b9cc7-2eb4-418b-a151-e788e4c45fc4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7673,7 +12465,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7683,41 +12475,66 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], + "method": "DELETE", + "header": [], "url": { - "raw": "{{apiUrl}}/api/Role", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role" + "User", + "1" ] } }, "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "c7e15787-ee99-4d27-ad3f-8d56700ac1b5", + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "Scope-GetAllScopes-Registered", + "listen": "test", + "script": { + "id": "6aad879c-6390-42ca-852b-213562a0a728", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Cleanup", + "item": [ + { + "name": "Embed-DeleteEmbed-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "dae306dc-feb5-49ce-8723-ee77279921c9", + "id": "5a640c2a-7dd4-4b68-9aae-b7652057163c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7725,9 +12542,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", "});" ], "type": "text/javascript" @@ -7735,42 +12550,40 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "Scopes" + "Embed", + "{{embedGuid}}" ] } }, "response": [] }, { - "name": "Role-GetRole-Registered", + "name": "Embed-DeleteEmbed-Other-DifferentInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "2f0ad802-6fad-4f49-a64c-b23ec49bbcff", + "id": "5f990887-0987-43dd-8096-a034ae59dae9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7778,7 +12591,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -7788,42 +12601,40 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "Embed", + "{{adminEmbedGuid}}" ] } }, "response": [] }, { - "name": "Role-UpdateRole-Registered", + "name": "Embed-DeleteEmbed-Other-SameInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "df71e55a-bb2b-455c-a00f-a6d2dd8ebaea", + "id": "b54c6e62-d74d-4d42-a85b-0904aa1f04e0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -7831,59 +12642,46 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.ok;", "});" ], "type": "text/javascript" } } ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" } - }, + ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/Embed/{{embedGuidWithInstitution}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "Embed", + "{{embedGuidWithInstitution}}" ] } }, "response": [] }, { - "name": "Role-SetRole-Registered", + "name": "Highlight-DeleteHighlight-Other-Registered", "event": [ { "listen": "test", "script": { - "id": "cb960fa3-1b29-4a0a-950a-8151dfa8e1cd", + "id": "19357fc3-f24d-4d99-8313-338154e4244f", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "var jsonData = pm.response.json();", - "", "pm.test(\"Status code is 403\", function () {", " pm.response.to.have.status(403);", "});", @@ -7903,63 +12701,35 @@ } ], "request": { - "method": "PUT", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], - "body": { - "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "{{roleId}}", - "description": "Id of the role that you want to update the user with" - } + "Highlight", + "{{highlightId}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Search", - "item": [ + }, { - "name": "Search-SearchInternal-Registered", + "name": "Project-DeleteProject-Self-Registered", "event": [ { "listen": "test", "script": { - "id": "ac74296d-5be3-43eb-871e-0d390181236b", + "id": "19d60c7e-c000-483a-84ba-bb650b7d7fc2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -7969,12 +12739,6 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -7982,50 +12746,40 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{administratorUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "raw": "{{apiUrl}}/api/Project/{{projectId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Search", - "internal", - "{{projectName}}" + "Project", + "{{projectId}}" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Wizard", - "item": [ + }, { - "name": "Wizard-GetWizard-Registered", + "name": "Project-DeleteProject-Other-OtherInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "f82a2402-e7c0-432e-af4c-64e48fabe5aa", + "id": "60c3fe14-317c-4e32-993a-7d7afb8aa5f2", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", - "", - "var jsonData = pm.response.json();", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -8033,9 +12787,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -8043,48 +12797,35 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "raw": "{{apiUrl}}/api/Project/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Wizard" - ], - "query": [ - { - "key": "sourceURI", - "value": "{{wizardSourceUri}}", - "description": "This is the URI that the wizard will use to fetch the source." - } + "Project", + "1" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Cleanup", - "item": [ + }, { - "name": "Embed-DeleteEmbed-Self-Registered", + "name": "Project-DeleteProject-Other-SameInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "05cb1235-fe28-40f8-92d5-dd5098c0bd56", + "id": "e682dbda-95b1-43f6-96d4-4347284cbf78", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8110,35 +12851,35 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "raw": "{{apiUrl}}/api/Project/{{projectIdWithInstitution}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{embedGuid}}" + "Project", + "{{projectIdWithInstitution}}" ] } }, "response": [] }, { - "name": "Embed-DeleteEmbed-Other-Registered", + "name": "Role-DeleteRole-Registered", "event": [ { "listen": "test", "script": { - "id": "39fa2a82-41ce-4f17-88a4-ceb5f6c5f775", + "id": "0968e8e0-48bd-49fc-a3f5-49906c94c222", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -8146,7 +12887,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", + " pm.response.to.be.forbidden;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -8161,35 +12902,35 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", + "raw": "{{apiUrl}}/api/Role/{{roleId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Embed", - "{{adminEmbedGuid}}" + "Role", + "{{roleId}}" ] } }, "response": [] }, { - "name": "Highlight-DeleteHighlight-Other-Registered", + "name": "User-DeleteUser-Other-DifferentInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "3b13799c-0c2a-4534-9363-96b12ee2c2db", + "id": "9518cd00-1992-468e-aa5e-da02087f4ef1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -8197,7 +12938,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -8212,30 +12953,30 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Highlight", - "{{highlightId}}" + "User", + "{{createdUserId}}" ] } }, "response": [] }, { - "name": "Project-DeleteProject-Self-Registered", + "name": "User-DeleteUser-Other-SameInstitution-Registered", "event": [ { "listen": "test", "script": { - "id": "dd95cd3d-d533-42b7-877b-b11ef09b6576", + "id": "a90093a7-fe99-44fa-831e-fe04fe249cd3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8245,6 +12986,10 @@ "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", "});" ], "type": "text/javascript" @@ -8257,45 +13002,53 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "{{projectId}}" + "User", + "{{createdUserWithInstitutionId}}" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ { - "name": "Project-DeleteProject-Other-Registered", + "name": "Post-File-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "3a0901f6-e333-48fe-872d-c6ed2335bbc3", + "id": "2c68e0de-ca83-4624-95b5-f12c00b0d807", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"dataOfficerFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" @@ -8303,50 +13056,58 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [ { "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" } ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, "url": { - "raw": "{{apiUrl}}/api/Project/1", + "raw": "{{apiUrl}}/api/File", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Project", - "1" + "File" ] } }, "response": [] }, { - "name": "Role-DeleteRole-Registered", + "name": "Get-Files-DataOfficer", "event": [ { "listen": "test", "script": { - "id": "4564e06f-55c1-425c-a5fa-6ae571205af2", + "id": "1f2c40fa-e088-4c85-b339-18ff8baff6f0", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" @@ -8354,50 +13115,47 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [ { "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" } ], "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "raw": "{{apiUrl}}/api/File", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "{{roleId}}" + "File" ] } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "id": "82bf4972-998a-4846-b142-6e83b85e5a0f", - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + }, + "response": [] + }, + { + "name": "Delete-File-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "id": "b2c41ae5-5910-47fa-8b4e-b3c1fa8f83b6", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", "});" ], "type": "text/javascript" @@ -8410,18 +13168,18 @@ { "key": "IdentityId", "type": "text", - "value": "{{registeredUserIdentityId}}" + "value": "{{dataOfficerUserIdentityId}}" } ], "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "raw": "{{apiUrl}}/api/File/{{dataOfficerFileId}}", "host": [ "{{apiUrl}}" ], "path": [ "api", - "User", - "{{createdUserId}}" + "File", + "{{dataOfficerFileId}}" ] } }, @@ -8447,7 +13205,7 @@ { "listen": "test", "script": { - "id": "27373880-24bb-49fb-8816-ff0b6dae359a", + "id": "f927f858-519e-486b-842a-94c1ca334970", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var userName = pm.environment.get(\"userName\");", @@ -8516,7 +13274,7 @@ { "listen": "test", "script": { - "id": "bbf0e491-91c1-4352-99e4-1525ff579b56", + "id": "3d05ad35-d5c9-464b-a014-3f3b6566975a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", @@ -8595,7 +13353,7 @@ { "listen": "test", "script": { - "id": "6ccdc966-58bd-4c5f-aabb-136d02178d47", + "id": "b2cd33b4-22e2-442a-8f49-d9ce4dd012f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -8624,7 +13382,7 @@ { "listen": "prerequest", "script": { - "id": "b7af45e3-6179-47b8-beb4-4e90c9614d64", + "id": "e0ce0a8b-33b9-4f9f-9e0b-37037c7697d0", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -8674,7 +13432,7 @@ { "listen": "test", "script": { - "id": "b16e33f6-67ad-4082-9c3d-8802eeac67f3", + "id": "49354fd9-103b-444a-bf38-e5a36f390bc2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8738,7 +13496,7 @@ { "listen": "test", "script": { - "id": "3dfa4eab-ded7-4599-8b35-254c4ed2eb01", + "id": "1b31beff-8471-4311-bd77-1382cf0ae219", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var scopeName = pm.environment.get(\"scopeName\");", @@ -8811,7 +13569,7 @@ { "listen": "prerequest", "script": { - "id": "3ee798d5-14b8-4b26-aa22-b0807512e59e", + "id": "1808525c-e0ec-4661-9fa4-fd72bbed6e07", "type": "text/javascript", "exec": [ "" @@ -8821,7 +13579,7 @@ { "listen": "test", "script": { - "id": "dd91bec7-2d40-46bd-8199-934eb260b9c6", + "id": "fce1c145-eafc-489e-bc66-3ae3ba1ef56c", "type": "text/javascript", "exec": [ "" @@ -8841,7 +13599,7 @@ { "listen": "test", "script": { - "id": "2d9ed119-05d4-4d6a-a15a-6195cada35ab", + "id": "0d123a94-2e4d-4160-bc83-93117449f19a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var jsonData = pm.response.json();", @@ -8901,7 +13659,7 @@ { "listen": "test", "script": { - "id": "cfb1847a-3db4-4258-8421-e161c98ea0f4", + "id": "b73f144a-d8ab-4f6e-ab17-65c33b0ccbbc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -8954,7 +13712,7 @@ { "listen": "test", "script": { - "id": "d81a0107-669a-4376-a671-e5049c779df7", + "id": "1df879c2-d74b-4071-b235-4b500ac6cf90", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", @@ -9012,7 +13770,7 @@ { "listen": "test", "script": { - "id": "1787afa4-393b-47d3-b609-0e8762c18351", + "id": "32d1083f-7c13-4955-a762-ff91de2b5482", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", @@ -9079,7 +13837,7 @@ { "listen": "test", "script": { - "id": "982c814e-565d-441f-86d0-398d6d69d2b6", + "id": "b7375117-4969-4258-98ca-3d38993a1ea1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9141,7 +13899,7 @@ { "listen": "prerequest", "script": { - "id": "a029ff15-234d-4d0f-8127-8b90864109b7", + "id": "bd86f3fa-1869-4506-9271-032e5beb86c0", "type": "text/javascript", "exec": [ "" @@ -9151,7 +13909,7 @@ { "listen": "test", "script": { - "id": "70cd6988-51b3-4d6f-a1ed-f90734e07f25", + "id": "031d15e7-4c42-4423-8a3b-d24ef58acb66", "type": "text/javascript", "exec": [ "" @@ -9171,7 +13929,7 @@ { "listen": "test", "script": { - "id": "49aeef34-b26b-497f-b1d7-0686d07bcdc5", + "id": "41234e6d-db53-430a-b2e5-a67408a919dd", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9239,7 +13997,7 @@ { "listen": "test", "script": { - "id": "3406766d-f94d-414f-9ba0-126061520169", + "id": "d97f6f60-425e-4bdb-8dbe-c68243bff1b0", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9293,7 +14051,7 @@ { "listen": "prerequest", "script": { - "id": "8c21096d-b838-418e-bcc7-a7467be6840d", + "id": "eb602c6a-af0c-4847-bfc0-1123fad230c3", "type": "text/javascript", "exec": [ "" @@ -9303,7 +14061,7 @@ { "listen": "test", "script": { - "id": "3b9c2a42-c83d-4e58-91bc-4fadac673df7", + "id": "51fbd4ca-0d41-4d0d-9808-41909503c732", "type": "text/javascript", "exec": [ "" @@ -9323,7 +14081,7 @@ { "listen": "test", "script": { - "id": "e4c91aed-6ef6-4b00-aad1-c7dca50c4462", + "id": "20589cd0-91ca-4ebd-8977-7ff42b31e264", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var PrUserId = pm.environment.get(\"PrUserId\");", @@ -9389,7 +14147,7 @@ { "listen": "test", "script": { - "id": "d21b4453-3530-4ba7-a134-ec8fd361114e", + "id": "bbd47f05-6230-4f87-9140-f708876dd8e7", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9462,7 +14220,7 @@ { "listen": "test", "script": { - "id": "e79f9b5d-b5b2-42f0-92f4-f4d9464de27f", + "id": "acb0ba40-19e3-431b-bde9-21fea9256768", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectName\");", @@ -9520,7 +14278,7 @@ { "listen": "test", "script": { - "id": "6b1fb601-1095-4beb-947d-181fd5532bf3", + "id": "99bb0cfd-7f7d-46e8-9d38-dcfe2effb6e1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "pm.test(\"Status code is 200\", function () {", @@ -9570,7 +14328,7 @@ { "listen": "test", "script": { - "id": "a344705d-a8fc-4e63-b800-79913f332572", + "id": "f5b8bca3-9e3b-42df-96c0-ac35d8244787", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectName = pm.environment.get(\"projectNameUpdated\");", @@ -9637,7 +14395,7 @@ { "listen": "test", "script": { - "id": "08d2965a-4788-40dc-a89b-c912861e25ab", + "id": "1d65edd4-9b46-45c6-b98b-d7e0cc0e5d05", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9704,7 +14462,7 @@ { "listen": "test", "script": { - "id": "6325a124-1349-488b-b311-2877755413f0", + "id": "6f257967-c75c-4e71-8de4-831b562bea0a", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9772,7 +14530,7 @@ { "listen": "test", "script": { - "id": "a63fb9a1-6bb0-443a-b493-0102771d1221", + "id": "d22a1d0c-ea33-4747-9849-4b134d90957c", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9826,7 +14584,7 @@ { "listen": "prerequest", "script": { - "id": "a7236e59-4edc-4971-8ba9-6ef1fbf4efb0", + "id": "529b045a-9255-4e7f-bbf1-75053ce441c4", "type": "text/javascript", "exec": [ "" @@ -9836,7 +14594,7 @@ { "listen": "test", "script": { - "id": "859900a6-1848-4050-ac11-832cd2121f7e", + "id": "818a50ec-d9ec-459b-94a3-97e34be5c682", "type": "text/javascript", "exec": [ "" @@ -9856,7 +14614,7 @@ { "listen": "test", "script": { - "id": "af3ca3d9-a581-4a4c-b9f8-72b4649c12f4", + "id": "b70bd7b8-ae4a-4865-99ef-524ea8e3e4f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9920,7 +14678,7 @@ { "listen": "test", "script": { - "id": "a15c6bd7-92dd-45dc-ab36-5a486e5dda3d", + "id": "c0a09e35-67ac-4ece-a64a-48cd4c94e314", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -9984,7 +14742,7 @@ { "listen": "test", "script": { - "id": "f5ce86b9-b2ad-4ac1-901c-1530228368cd", + "id": "88edd5e3-c52b-416c-91bf-24ebcffd63ea", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10036,7 +14794,7 @@ { "listen": "test", "script": { - "id": "908772af-ad49-4b8a-8f8d-fc86bf7d955c", + "id": "59945704-9be0-4f32-ab55-bfd173e582d3", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", @@ -10094,7 +14852,7 @@ { "listen": "test", "script": { - "id": "c649e329-4782-4fca-ab91-3c685b097794", + "id": "c7b6ff14-943f-490a-a650-84a190ab0631", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", @@ -10159,7 +14917,7 @@ { "listen": "test", "script": { - "id": "d13954a7-b32e-4ed0-aee6-b08da85a5223", + "id": "8e8d8b22-1978-4af1-8803-585b838e6055", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10187,7 +14945,7 @@ { "listen": "prerequest", "script": { - "id": "2ebe216f-b0a4-4163-a6b4-9f2732d8af30", + "id": "394dda06-ed0c-4c58-b900-2f5df509822b", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10237,7 +14995,7 @@ { "listen": "test", "script": { - "id": "0aa214d5-8400-4197-aead-a72621464993", + "id": "f68a06c2-9cee-4203-887e-9819a9926e0d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10299,7 +15057,7 @@ { "listen": "test", "script": { - "id": "23298988-0413-4fe9-a621-6090d8936ae6", + "id": "e6e8aa43-ceb5-4775-8529-666dc4e6eb49", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10386,7 +15144,7 @@ { "listen": "test", "script": { - "id": "f5e98ca8-095f-4fdd-ab82-307931b6d777", + "id": "480d9199-f69d-48c8-9217-85f6ba8cd22b", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10412,7 +15170,7 @@ { "listen": "prerequest", "script": { - "id": "0cfada2c-d574-4e4b-aaa7-613855748b1b", + "id": "35f12f56-b03a-4ccf-bf53-a2504dfcdcbf", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10459,7 +15217,7 @@ { "listen": "test", "script": { - "id": "ddb8910d-7ea7-4f07-bbee-58d4343e5f8b", + "id": "0207913c-7b19-4d03-aa57-0a39a6d36294", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10486,7 +15244,7 @@ { "listen": "prerequest", "script": { - "id": "35489972-0a0a-4502-9af9-0065f5988d36", + "id": "dfbbe389-543a-4808-9333-6653021d2ab5", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", @@ -10536,7 +15294,7 @@ { "listen": "test", "script": { - "id": "636d5863-ecd5-456c-a663-58ba1abb2332", + "id": "6bb9a263-e33d-48ac-b85b-4077e2755707", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10598,7 +15356,7 @@ { "listen": "test", "script": { - "id": "07338c85-d955-4431-9214-06fc9ea07b0f", + "id": "c28b4102-53ac-4a0f-aa01-210aecc32c7e", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var identityId = parseInt(pm.environment.get(\"identityId\"));", @@ -10685,7 +15443,7 @@ { "listen": "test", "script": { - "id": "9f4f7486-02fc-47aa-a948-1fbc084dda0f", + "id": "7d52865f-0fc1-44b8-a61a-6df1e9cd1dbc", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10711,7 +15469,7 @@ { "listen": "prerequest", "script": { - "id": "d4ea9afb-1fd2-4896-946c-330260e07b36", + "id": "18cc8c21-b0fd-49b0-995a-7faf4e70c67b", "exec": [ "var current_timestamp = new Date();\r", "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" @@ -10758,7 +15516,7 @@ { "listen": "test", "script": { - "id": "11552ad9-308d-47a0-a05d-f65dff70e0f1", + "id": "82a37b79-409d-46c3-b0b5-05a117245891", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "var projectId = pm.environment.get(\"adminProjectId\");", @@ -10834,7 +15592,7 @@ { "listen": "test", "script": { - "id": "238a11a2-111c-40d1-975e-ffdfebca7f9e", + "id": "4180dcc7-3bb9-41d1-8076-e72be16fd968", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10895,7 +15653,7 @@ { "listen": "test", "script": { - "id": "bca9202d-ed5f-41e7-b842-6b5dea3c59ee", + "id": "c2a8863e-686d-4609-bd78-2a4edb763fc1", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -10947,7 +15705,7 @@ { "listen": "test", "script": { - "id": "59686009-aad0-4fb5-9a70-66ae0b25ebfe", + "id": "ba5b3e3b-dc0a-4919-bba3-d83bb2a002d5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11000,7 +15758,7 @@ { "listen": "test", "script": { - "id": "93300883-47d3-4d1a-8506-374f0bf6e196", + "id": "724c7391-6557-40d7-a60c-db5b326a5ff2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11053,7 +15811,7 @@ { "listen": "test", "script": { - "id": "f7bd5846-e127-4274-a87f-ca033482bc5f", + "id": "c4137b79-dd57-4929-9dd5-bfe3d9c6e4d2", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11115,7 +15873,7 @@ { "listen": "test", "script": { - "id": "25a28073-1f67-4f96-bb70-e0a82bed6063", + "id": "f80b23a2-6d7b-46ab-be00-56c714d82219", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11158,50 +15916,285 @@ } }, "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "6e4b8c68-371a-4463-a787-cbb13992e4b2", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "{{projectName}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Wizard", + "item": [ + { + "name": "Wizard-GetWizard-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "5b8287af-8e87-42f1-a08e-396da9f744f7", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Wizard" + ], + "query": [ + { + "key": "sourceURI", + "value": "{{wizardSourceUri}}", + "description": "This is the URI that the wizard will use to fetch the source." + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "409190af-3216-4aaf-b54f-70b3d24163d8", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "2aeb06e0-d118-499c-aa38-7e1a4fbc8958", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "{{roleId}}", - "description": "Id of the role that you want to update the user with" - } + "User", + "1" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Search", - "item": [ + }, { - "name": "Search-SearchInternal-PR", + "name": "Institution-UpdateInstitution-PR", "event": [ { "listen": "test", "script": { - "id": "229d7cc1-041e-43e8-b626-d624f98980cd", + "id": "ec343bf6-8349-476e-a8b1-411cf8dd48f4", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -11209,7 +16202,7 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", + " pm.response.to.be.unauthorized;", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});" @@ -11219,50 +16212,48 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } } - ], + }, "url": { - "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Search", - "internal", - "{{projectName}}" + "User", + "1" ] } }, "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Wizard", - "item": [ + }, { - "name": "Wizard-GetWizard-PR", + "name": "Instituiton-DeleteInstitution-PR", "event": [ { "listen": "test", "script": { - "id": "b042e4e0-aaae-4fde-bd15-7cd358c14f7b", + "id": "4201f90d-ee5b-4abf-814d-a542c5a3f97d", "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\")) + 1000;", + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", "var jsonData = pm.response.json();", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", "});", "", "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", @@ -11270,9 +16261,9 @@ "});", "", "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", "});" ], "type": "text/javascript" @@ -11280,35 +16271,48 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], + "method": "DELETE", + "header": [], "url": { - "raw": "{{apiUrl}}/api/Wizard?sourceURI={{wizardSourceUri}}", + "raw": "{{apiUrl}}/api/User/1", "host": [ "{{apiUrl}}" ], "path": [ "api", - "Wizard" - ], - "query": [ - { - "key": "sourceURI", - "value": "{{wizardSourceUri}}", - "description": "This is the URI that the wizard will use to fetch the source." - } + "User", + "1" ] } }, "response": [] } ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "dcfcd6d0-bc4c-41e8-9072-599827b2d3e4", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "01d5c21c-5fe2-4e7d-b2d3-682f09dd2b44", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, @@ -11321,7 +16325,7 @@ { "listen": "test", "script": { - "id": "82a1b043-02fa-443f-9f74-7720e195c5b5", + "id": "26c102be-dee1-4f33-9ef5-4f89484b46c8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11370,7 +16374,7 @@ { "listen": "test", "script": { - "id": "009e543f-b3c8-4cfc-ba6a-5892fd162e3f", + "id": "eba106c9-6daf-4b03-a181-a26b1362e582", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11419,7 +16423,7 @@ { "listen": "test", "script": { - "id": "11068050-84f6-4310-b52a-c3e041009c4e", + "id": "99aba27c-6ceb-4675-b3c5-4edb3bf571a9", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11464,7 +16468,7 @@ { "listen": "test", "script": { - "id": "6b443f79-8f5c-4bce-aad0-db2ba133e667", + "id": "4b5fda0d-c260-444a-9229-ed986a25e8be", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11509,7 +16513,7 @@ { "listen": "test", "script": { - "id": "f5e2a604-f0ea-4eb6-9582-eceeb1be6313", + "id": "831527e2-c283-4d48-9573-58036e42e103", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11554,7 +16558,7 @@ { "listen": "test", "script": { - "id": "40c75c41-8aab-4578-99fb-e0974f80163b", + "id": "4138f2a6-5586-4a27-994a-a250709a7ca8", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11607,7 +16611,7 @@ { "listen": "test", "script": { - "id": "41cc8151-025e-494b-b11f-5461bc6d27eb", + "id": "76cd265d-10ec-49ee-bf5e-5e33496f5c8d", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11660,7 +16664,7 @@ { "listen": "test", "script": { - "id": "4656e996-95ea-48ee-a82e-1ce83ce751aa", + "id": "cdfb894a-4e16-4f9d-a7de-5b9ec8e9bacb", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", "", @@ -11710,6 +16714,174 @@ ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "6a32bb1e-7169-4742-905a-83de0b0dc81d", + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"prFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "4cce74e5-ba49-4d99-a7bc-66b990e0ff5d", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-PR", + "event": [ + { + "listen": "test", + "script": { + "id": "edc0511c-14fe-41f2-a06f-93ff359d79cd", + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{prFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{prFileId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, @@ -11727,7 +16899,7 @@ { "listen": "test", "script": { - "id": "ee5ba265-fb38-489c-be9b-a967db1b5b42", + "id": "c01581c3-1921-4b25-ac57-a4f1e341f7d5", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -11772,7 +16944,7 @@ { "listen": "test", "script": { - "id": "e6b60a71-3c90-4069-9284-7de0be6a83b4", + "id": "692b8fdf-21c9-496b-b1e2-9dda5340d0ae", "exec": [ "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", "\r", @@ -11839,7 +17011,7 @@ { "listen": "prerequest", "script": { - "id": "cc75fbc6-d531-49ca-9e28-f694cfce821f", + "id": "e59ac521-837e-4213-9b31-cfbd2e2ad964", "type": "text/javascript", "exec": [ "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", @@ -11883,7 +17055,7 @@ { "listen": "test", "script": { - "id": "a9317531-005e-48bf-81bb-172dcf97abe8", + "id": "efa4720c-8448-4f08-86f6-156f834dcbdd", "type": "text/javascript", "exec": [ "" @@ -11891,12 +17063,5 @@ } } ], - "variable": [ - { - "id": "f7e8fb98-dff6-4403-a75a-f17a701a2b53", - "key": "userIdToFollow", - "value": "25" - } - ], "protocolProfileBehavior": {} } \ No newline at end of file From ecfb2660438b3c0638264e0bc7fb67e5db6c9b8b Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Thu, 5 Nov 2020 13:12:57 +0100 Subject: [PATCH 149/157] Highlight Resource Result was missing the start & end date Frontend needed this information to edit / delete highlights. --- API/Resources/HighlightResourceResult.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/API/Resources/HighlightResourceResult.cs b/API/Resources/HighlightResourceResult.cs index 01f8ed0b..dec9d7cf 100644 --- a/API/Resources/HighlightResourceResult.cs +++ b/API/Resources/HighlightResourceResult.cs @@ -16,6 +16,7 @@ */ using Models; +using System; namespace API.Resources { @@ -42,6 +43,16 @@ public class HighlightResourceResult /// This gets or sets the project of this highlight /// public ProjectHighlightResourceResult Project { get; set; } + + /// + /// This gets or sets the start date that the highlight should start + /// + public DateTime? StartDate { get; set; } + + /// + /// This gets or sets the end date that highlight should end + /// + public DateTime? EndDate { get; set; } } } From 20eef0f650f4fe4070a4a2395aca04925b305aca Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Thu, 5 Nov 2020 13:15:19 +0100 Subject: [PATCH 150/157] Updated Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d36efca..1c2e24f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed issue where swagger authorization was not working when running in docker-compose - [#200](https://github.com/DigitalExcellence/dex-backend/issues/200) - Fixed issue with search functionality being too extensive. Now matching whole strings only - [#202](https://github.com/DigitalExcellence/dex-backend/issues/202) +- Fixed issue where highlights were not returning the end date & start date - [#296](https://github.com/DigitalExcellence/dex-backend/issues/296) ### Security From 7aeae11cb85ec77d416396e90038f333dcffd08a Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 6 Nov 2020 11:13:05 +0100 Subject: [PATCH 151/157] potential fix for project icon path --- .github/workflows/staging-deployment.yml | 2 +- API/HelperClasses/FileUploader.cs | 6 +++--- API/Startup.cs | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/staging-deployment.yml b/.github/workflows/staging-deployment.yml index e6d2502d..e77dfa1a 100644 --- a/.github/workflows/staging-deployment.yml +++ b/.github/workflows/staging-deployment.yml @@ -2,7 +2,7 @@ name: Staging Deployment on: push: - branches: [ develop ] + branches: [ bugfix/298-project-icon-not-loading ] jobs: build: diff --git a/API/HelperClasses/FileUploader.cs b/API/HelperClasses/FileUploader.cs index 19c4dde3..43901a06 100644 --- a/API/HelperClasses/FileUploader.cs +++ b/API/HelperClasses/FileUploader.cs @@ -59,7 +59,7 @@ public async Task CopyFileToDirectory(IFormFile file, string fileName) { if(System.IO.File.Exists(uploadPath + fileName)) throw new FileExistException(fileName); await using Stream sourceStream = file.OpenReadStream(); - await using FileStream destinationStream = System.IO.File.Create(uploadPath + fileName); + await using FileStream destinationStream = System.IO.File.Create(Path.Combine(uploadPath, fileName)); await sourceStream.CopyToAsync(destinationStream); return fileName; @@ -77,8 +77,8 @@ public async Task CopyFileToDirectory(IFormFile file, string fileName) /// Bool which tells if file is deleted successfully or not public void DeleteFileFromDirectory(File file) { - if(System.IO.File.Exists(uploadPath + file.Name)) { - System.IO.File.Delete(uploadPath + file.Name); + if(System.IO.File.Exists(Path.Combine(uploadPath, file.Name))) { + System.IO.File.Delete(Path.Combine(uploadPath, file.Name)); return; } diff --git a/API/Startup.cs b/API/Startup.cs index e2315e3f..2f5e191d 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -227,7 +227,13 @@ public void ConfigureServices(IServiceCollection services) /// The env. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { - Defaults.Path.filePath = env.WebRootPath + "\\Resources\\"; + + if(string.IsNullOrWhiteSpace(env.WebRootPath)) + { + env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); + Log.Information("Webrootpath: " + env.WebRootPath); + Defaults.Path.filePath = Path.Combine(env.WebRootPath, "Resources"); + } UpdateDatabase(app, env); if(env.IsDevelopment()) From 4b9cf41d41297fafe99511e0be6a1ac87964e65a Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 6 Nov 2020 12:11:27 +0100 Subject: [PATCH 152/157] Fix issue where all static resources from API (wwwroot) were not copied over --- API/Dockerfile.dev | 1 + 1 file changed, 1 insertion(+) diff --git a/API/Dockerfile.dev b/API/Dockerfile.dev index 9c6b827e..56708aaa 100644 --- a/API/Dockerfile.dev +++ b/API/Dockerfile.dev @@ -20,6 +20,7 @@ FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 WORKDIR /app COPY --from=build-env /app/API/bin/Debug/netcoreapp3.1 . +COPY --from=build-env /app/API/wwwroot ./wwwroot COPY --from=build-env /app/dex-api.pfx . ENTRYPOINT ["dotnet", "1_API.dll", "--environment=Development"] \ No newline at end of file From 240b3116b84b6684b23c19b94d6e3e2abaf18869 Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 6 Nov 2020 12:12:57 +0100 Subject: [PATCH 153/157] changed FilePathRoot so it should work in Docker environment --- API/HelperClasses/FileUploader.cs | 2 +- API/Startup.cs | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/API/HelperClasses/FileUploader.cs b/API/HelperClasses/FileUploader.cs index 43901a06..474314ec 100644 --- a/API/HelperClasses/FileUploader.cs +++ b/API/HelperClasses/FileUploader.cs @@ -57,7 +57,7 @@ public async Task CopyFileToDirectory(IFormFile file, string fileName) { try { - if(System.IO.File.Exists(uploadPath + fileName)) throw new FileExistException(fileName); + if(System.IO.File.Exists(Path.Combine(uploadPath + fileName))) throw new FileExistException(fileName); await using Stream sourceStream = file.OpenReadStream(); await using FileStream destinationStream = System.IO.File.Create(Path.Combine(uploadPath, fileName)); await sourceStream.CopyToAsync(destinationStream); diff --git a/API/Startup.cs b/API/Startup.cs index 2f5e191d..68d7c290 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -227,13 +227,9 @@ public void ConfigureServices(IServiceCollection services) /// The env. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); + Defaults.Path.filePath = Path.Combine(env.WebRootPath, "Resources"); - if(string.IsNullOrWhiteSpace(env.WebRootPath)) - { - env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); - Log.Information("Webrootpath: " + env.WebRootPath); - Defaults.Path.filePath = Path.Combine(env.WebRootPath, "Resources"); - } UpdateDatabase(app, env); if(env.IsDevelopment()) From f17fcc5b9894039dafe849a61fc6ae3a724a5d67 Mon Sep 17 00:00:00 2001 From: Niray Date: Fri, 6 Nov 2020 13:40:06 +0100 Subject: [PATCH 154/157] changed image upload directory. It's easier to have seperate static files like /Uploads/Images instead of wwwroot/Resources because of constraints with Docker. --- API/1_API.csproj | 10 +++++++++- API/Dockerfile.dev | 2 +- API/Startup.cs | 10 ++++++++-- API/{wwwroot/Resources => Uploads}/.gitkeep | 0 4 files changed, 18 insertions(+), 4 deletions(-) rename API/{wwwroot/Resources => Uploads}/.gitkeep (100%) diff --git a/API/1_API.csproj b/API/1_API.csproj index b7958826..e3b6c476 100644 --- a/API/1_API.csproj +++ b/API/1_API.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -15,6 +15,10 @@ + + + + @@ -43,5 +47,9 @@ + + + + \ No newline at end of file diff --git a/API/Dockerfile.dev b/API/Dockerfile.dev index 56708aaa..cc5185d5 100644 --- a/API/Dockerfile.dev +++ b/API/Dockerfile.dev @@ -20,7 +20,7 @@ FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 WORKDIR /app COPY --from=build-env /app/API/bin/Debug/netcoreapp3.1 . -COPY --from=build-env /app/API/wwwroot ./wwwroot +COPY --from=build-env /app/API/Uploads/Images ./Uploads/Images COPY --from=build-env /app/dex-api.pfx . ENTRYPOINT ["dotnet", "1_API.dll", "--environment=Development"] \ No newline at end of file diff --git a/API/Startup.cs b/API/Startup.cs index 68d7c290..115b6ef5 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -227,8 +227,8 @@ public void ConfigureServices(IServiceCollection services) /// The env. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { - env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); - Defaults.Path.filePath = Path.Combine(env.WebRootPath, "Resources"); + env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "Uploads"); + Defaults.Path.filePath = Path.Combine(env.WebRootPath, "Images"); UpdateDatabase(app, env); @@ -257,6 +257,12 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseProblemDetails(); app.UseStaticFiles(); + app.UseStaticFiles(new StaticFileOptions() + { + FileProvider = new PhysicalFileProvider( + Path.Combine(env.ContentRootPath, "Uploads", "Images")), + RequestPath = "/Uploads/Images" + }); app.UseRouting(); app.UseCors(c => diff --git a/API/wwwroot/Resources/.gitkeep b/API/Uploads/.gitkeep similarity index 100% rename from API/wwwroot/Resources/.gitkeep rename to API/Uploads/.gitkeep From fe9f3cf3bb86af6973a58f1668d42343ab7ad54d Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 6 Nov 2020 14:59:38 +0100 Subject: [PATCH 155/157] Update .gitignore and add .gitkeep --- .gitignore | 4 ++-- API/1_API.csproj | 10 +++++----- API/Uploads/{ => Images}/.gitkeep | 0 3 files changed, 7 insertions(+), 7 deletions(-) rename API/Uploads/{ => Images}/.gitkeep (100%) diff --git a/.gitignore b/.gitignore index 4f389a83..468a602e 100644 --- a/.gitignore +++ b/.gitignore @@ -334,5 +334,5 @@ profile IdentityServer/tempkey.rsa -/API/wwwroot/Resources/* -!/API/wwwroot/Resources/.gitkeep +/API/Uploads/Images/* +!/API/Uploads/Images/.gitkeep diff --git a/API/1_API.csproj b/API/1_API.csproj index e3b6c476..283fc6a8 100644 --- a/API/1_API.csproj +++ b/API/1_API.csproj @@ -16,7 +16,11 @@ - + + + + + @@ -47,9 +51,5 @@ - - - - \ No newline at end of file diff --git a/API/Uploads/.gitkeep b/API/Uploads/Images/.gitkeep similarity index 100% rename from API/Uploads/.gitkeep rename to API/Uploads/Images/.gitkeep From 2a24c70856b644feae9f02dc392a1ddbed7d8e44 Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 6 Nov 2020 15:02:58 +0100 Subject: [PATCH 156/157] Updated Changelog for v0.8.0 --- CHANGELOG.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c2e24f2..9d5bd9d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Added a fileuploader which gives the opportunity to upload files and icons - [#217](https://github.com/DigitalExcellence/dex-backend/issues/217) -- Add Postman tests to pipeline [#189](https://github.com/DigitalExcellence/dex-backend/issues/189) -- Added function to follow users and let users follow projects [#228](https://github.com/DigitalExcellence/dex-backend/pull/258) -- Added a new dex user that can be used to add projects manually - [#270](https://github.com/DigitalExcellence/dex-backend/issues/270) -- Added data officer role and CRUD functionalities for institutions - [#265](https://github.com/DigitalExcellence/dex-backend/issues/265) - ### Changed ### Deprecated @@ -25,12 +19,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +### Security + + + +## Release v.0.8.0-beta - 06-11-2020 + + + +### Added + +- Added a fileuploader which gives the opportunity to upload files and icons - [#217](https://github.com/DigitalExcellence/dex-backend/issues/217) +- Add Postman tests to pipeline - [#189](https://github.com/DigitalExcellence/dex-backend/issues/189) +- Added function to follow users and let users follow projects - [#228](https://github.com/DigitalExcellence/dex-backend/pull/258) +- Added a new dex user that can be used to add projects manually - [#270](https://github.com/DigitalExcellence/dex-backend/issues/270) +- Added data officer role and CRUD functionalities for institutions - [#265](https://github.com/DigitalExcellence/dex-backend/issues/265) + +### Fixed + - Fixed issue where swagger authorization was not working when running in docker-compose - [#200](https://github.com/DigitalExcellence/dex-backend/issues/200) - Fixed issue with search functionality being too extensive. Now matching whole strings only - [#202](https://github.com/DigitalExcellence/dex-backend/issues/202) - Fixed issue where highlights were not returning the end date & start date - [#296](https://github.com/DigitalExcellence/dex-backend/issues/296) -### Security - ## Release v.0.7.0-beta - 09-10-2020 From 75d3852f4459c9c73354ff209aeac94997e089bd Mon Sep 17 00:00:00 2001 From: Brend Smits Date: Fri, 6 Nov 2020 15:05:32 +0100 Subject: [PATCH 157/157] Update workflow file to only trigger on develop --- .github/workflows/staging-deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/staging-deployment.yml b/.github/workflows/staging-deployment.yml index e77dfa1a..60f97b37 100644 --- a/.github/workflows/staging-deployment.yml +++ b/.github/workflows/staging-deployment.yml @@ -2,7 +2,7 @@ name: Staging Deployment on: push: - branches: [ bugfix/298-project-icon-not-loading ] + branches: [ develop ] jobs: build: @@ -27,4 +27,4 @@ jobs: docker-compose down docker-compose pull sleep 10s - docker-compose up -d \ No newline at end of file + docker-compose up -d