From 9689e932008671f76fac5e6951a4a85f187f0ccc Mon Sep 17 00:00:00 2001 From: artembell Date: Mon, 1 Aug 2016 20:45:57 +0300 Subject: [PATCH 01/15] Added tokens --- WebApp/App_Start/Startup.Auth.cs | 27 ++++-- WebApp/Models/IdentityModels.cs | 4 +- WebApp/Provider/ApplicationOAuthProvider.cs | 99 +++++++++++++++++++++ WebApp/WebApp.csproj | 1 + 4 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 WebApp/Provider/ApplicationOAuthProvider.cs diff --git a/WebApp/App_Start/Startup.Auth.cs b/WebApp/App_Start/Startup.Auth.cs index 4b60699..77f3ddb 100644 --- a/WebApp/App_Start/Startup.Auth.cs +++ b/WebApp/App_Start/Startup.Auth.cs @@ -1,16 +1,18 @@ using System; using Microsoft.AspNet.Identity; -using Microsoft.AspNet.Identity.Owin; using Microsoft.Owin; -using Microsoft.Owin.Security.Cookies; -using Microsoft.Owin.Security.Google; using Owin; using WebApp.Models; +using Microsoft.Owin.Security.OAuth; namespace WebApp { public partial class Startup { + + public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; } + + public static string PublicClientId { get; private set; } // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 public void ConfigureAuth(IAppBuilder app) { @@ -22,7 +24,7 @@ public void ConfigureAuth(IAppBuilder app) // Enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily store information about a user logging in with a third party login provider // Configure the sign in cookie - app.UseCookieAuthentication(new CookieAuthenticationOptions + /*app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), @@ -35,7 +37,22 @@ public void ConfigureAuth(IAppBuilder app) regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } }); - app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); + app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);*/ + + // Configure the application for OAuth based flow + PublicClientId = "self"; + OAuthOptions = new OAuthAuthorizationServerOptions + { + TokenEndpointPath = new PathString("/Token"), + Provider = new ApplicationOAuthProvider(PublicClientId), + AuthorizeEndpointPath = new PathString("/api/Account/Login"), + AccessTokenExpireTimeSpan = TimeSpan.FromDays(14), + // In production mode set AllowInsecureHttp = false + AllowInsecureHttp = true + }; + + // Enable the application to use bearer tokens to authenticate users + app.UseOAuthBearerTokens(OAuthOptions); // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process. app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5)); diff --git a/WebApp/Models/IdentityModels.cs b/WebApp/Models/IdentityModels.cs index 48e9151..081cc6e 100644 --- a/WebApp/Models/IdentityModels.cs +++ b/WebApp/Models/IdentityModels.cs @@ -10,10 +10,10 @@ namespace WebApp.Models // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. public class ApplicationUser : IdentityUser { - public async Task GenerateUserIdentityAsync(UserManager manager) + public async Task GenerateUserIdentityAsync(UserManager manager, string authenticationType) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType - var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); + var userIdentity = await manager.CreateIdentityAsync(this, authenticationType); // Add custom user claims here return userIdentity; } diff --git a/WebApp/Provider/ApplicationOAuthProvider.cs b/WebApp/Provider/ApplicationOAuthProvider.cs new file mode 100644 index 0000000..13878f6 --- /dev/null +++ b/WebApp/Provider/ApplicationOAuthProvider.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Claims; +using System.Threading.Tasks; +using Microsoft.AspNet.Identity; +using Microsoft.AspNet.Identity.EntityFramework; +using Microsoft.AspNet.Identity.Owin; +using Microsoft.Owin.Security; +using Microsoft.Owin.Security.Cookies; +using Microsoft.Owin.Security.OAuth; +using WebApp; +using WebApp.Models; + +namespace WebApplication3.Providers +{ + public class ApplicationOAuthProvider : OAuthAuthorizationServerProvider + { + private readonly string _publicClientId; + + public ApplicationOAuthProvider(string publicClientId) + { + if (publicClientId == null) + { + throw new ArgumentNullException("publicClientId"); + } + + _publicClientId = publicClientId; + } + + public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) + { + var userManager = context.OwinContext.GetUserManager(); + + ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password); + + if (user == null) + { + context.SetError("invalid_grant", "The user name or password is incorrect."); + return; + } + + ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(userManager, + OAuthDefaults.AuthenticationType); + ClaimsIdentity cookiesIdentity = await user.GenerateUserIdentityAsync(userManager, + CookieAuthenticationDefaults.AuthenticationType); + + AuthenticationProperties properties = CreateProperties(user.UserName); + AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties); + context.Validated(ticket); + context.Request.Context.Authentication.SignIn(cookiesIdentity); + } + + public override Task TokenEndpoint(OAuthTokenEndpointContext context) + { + foreach (KeyValuePair property in context.Properties.Dictionary) + { + context.AdditionalResponseParameters.Add(property.Key, property.Value); + } + + return Task.FromResult(null); + } + + public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context) + { + // Resource owner password credentials does not provide a client ID. + if (context.ClientId == null) + { + context.Validated(); + } + + return Task.FromResult(null); + } + + public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context) + { + if (context.ClientId == _publicClientId) + { + Uri expectedRootUri = new Uri(context.Request.Uri, "/"); + + if (expectedRootUri.AbsoluteUri == context.RedirectUri) + { + context.Validated(); + } + } + + return Task.FromResult(null); + } + + public static AuthenticationProperties CreateProperties(string userName) + { + IDictionary data = new Dictionary + { + { "userName", userName } + }; + return new AuthenticationProperties(data); + } + } +} \ No newline at end of file diff --git a/WebApp/WebApp.csproj b/WebApp/WebApp.csproj index b257792..c94efd8 100644 --- a/WebApp/WebApp.csproj +++ b/WebApp/WebApp.csproj @@ -204,6 +204,7 @@ True Settings.settings + From fa229379f39da0018b48437f6e28616a8aeb2db1 Mon Sep 17 00:00:00 2001 From: artembell Date: Wed, 3 Aug 2016 14:48:00 +0300 Subject: [PATCH 02/15] Deleted tokens and fixed travis.yaml --- WebApp/App_Start/Startup.Auth.cs | 10 - WebApp/Controllers/ProjectController.cs | 2 +- WebApp/Provider/ApplicationOAuthProvider.cs | 99 ----- WebApp/WebApp.csproj | 1 - travis.yaml | 406 +------------------- 5 files changed, 3 insertions(+), 515 deletions(-) delete mode 100644 WebApp/Provider/ApplicationOAuthProvider.cs diff --git a/WebApp/App_Start/Startup.Auth.cs b/WebApp/App_Start/Startup.Auth.cs index 77f3ddb..7dfbae3 100644 --- a/WebApp/App_Start/Startup.Auth.cs +++ b/WebApp/App_Start/Startup.Auth.cs @@ -40,16 +40,6 @@ public void ConfigureAuth(IAppBuilder app) app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);*/ // Configure the application for OAuth based flow - PublicClientId = "self"; - OAuthOptions = new OAuthAuthorizationServerOptions - { - TokenEndpointPath = new PathString("/Token"), - Provider = new ApplicationOAuthProvider(PublicClientId), - AuthorizeEndpointPath = new PathString("/api/Account/Login"), - AccessTokenExpireTimeSpan = TimeSpan.FromDays(14), - // In production mode set AllowInsecureHttp = false - AllowInsecureHttp = true - }; // Enable the application to use bearer tokens to authenticate users app.UseOAuthBearerTokens(OAuthOptions); diff --git a/WebApp/Controllers/ProjectController.cs b/WebApp/Controllers/ProjectController.cs index ab8c6f0..2bb3aa8 100644 --- a/WebApp/Controllers/ProjectController.cs +++ b/WebApp/Controllers/ProjectController.cs @@ -217,7 +217,7 @@ public JsonResult GetImagesFormProject(String sidRoot) return Json(movies, JsonRequestBehavior.AllowGet); } [HttpGet, Route("Project/id{sidRoot}/Project")] - public JsonResult GetPtojectsFormProject(String sidRoot) + public JsonResult GetProjectsFormProject(String sidRoot) { var idRoot = new ObjectId(); if (!ObjectId.TryParse(sidRoot, out idRoot)) diff --git a/WebApp/Provider/ApplicationOAuthProvider.cs b/WebApp/Provider/ApplicationOAuthProvider.cs deleted file mode 100644 index 13878f6..0000000 --- a/WebApp/Provider/ApplicationOAuthProvider.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Threading.Tasks; -using Microsoft.AspNet.Identity; -using Microsoft.AspNet.Identity.EntityFramework; -using Microsoft.AspNet.Identity.Owin; -using Microsoft.Owin.Security; -using Microsoft.Owin.Security.Cookies; -using Microsoft.Owin.Security.OAuth; -using WebApp; -using WebApp.Models; - -namespace WebApplication3.Providers -{ - public class ApplicationOAuthProvider : OAuthAuthorizationServerProvider - { - private readonly string _publicClientId; - - public ApplicationOAuthProvider(string publicClientId) - { - if (publicClientId == null) - { - throw new ArgumentNullException("publicClientId"); - } - - _publicClientId = publicClientId; - } - - public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) - { - var userManager = context.OwinContext.GetUserManager(); - - ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password); - - if (user == null) - { - context.SetError("invalid_grant", "The user name or password is incorrect."); - return; - } - - ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(userManager, - OAuthDefaults.AuthenticationType); - ClaimsIdentity cookiesIdentity = await user.GenerateUserIdentityAsync(userManager, - CookieAuthenticationDefaults.AuthenticationType); - - AuthenticationProperties properties = CreateProperties(user.UserName); - AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties); - context.Validated(ticket); - context.Request.Context.Authentication.SignIn(cookiesIdentity); - } - - public override Task TokenEndpoint(OAuthTokenEndpointContext context) - { - foreach (KeyValuePair property in context.Properties.Dictionary) - { - context.AdditionalResponseParameters.Add(property.Key, property.Value); - } - - return Task.FromResult(null); - } - - public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context) - { - // Resource owner password credentials does not provide a client ID. - if (context.ClientId == null) - { - context.Validated(); - } - - return Task.FromResult(null); - } - - public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context) - { - if (context.ClientId == _publicClientId) - { - Uri expectedRootUri = new Uri(context.Request.Uri, "/"); - - if (expectedRootUri.AbsoluteUri == context.RedirectUri) - { - context.Validated(); - } - } - - return Task.FromResult(null); - } - - public static AuthenticationProperties CreateProperties(string userName) - { - IDictionary data = new Dictionary - { - { "userName", userName } - }; - return new AuthenticationProperties(data); - } - } -} \ No newline at end of file diff --git a/WebApp/WebApp.csproj b/WebApp/WebApp.csproj index c94efd8..b257792 100644 --- a/WebApp/WebApp.csproj +++ b/WebApp/WebApp.csproj @@ -204,7 +204,6 @@ True Settings.settings - diff --git a/travis.yaml b/travis.yaml index 487c329..745b50c 100644 --- a/travis.yaml +++ b/travis.yaml @@ -1,404 +1,2 @@ -# this is an example of the Uber API -# as a demonstration of an API spec in YAML -swagger: '2.0' -info: - title: Uber API - description: Move your app forward with the Uber API - version: "1.0.0" -# the domain of the service -host: api.uber.com -# array of all schemes that your API supports -schemes: - - https -# will be prefixed to all paths -basePath: /v1 -produces: - - application/json -paths: - - - - /Comment: - get: - summary: All comments - description: Returns all comments - responses: - 200: - description: Array of comments - schema: - type: array - items: - $ref: '#/definitions/CommentWithoutObjectId' - - /Comment/GetById: - get: - summary: One comment - description: Gets comment by id - parameters: - - name: id - in: query - required: true - type: string - description: Comment id - responses: - 200: - description: Comment - schema: - $ref: '#/definitions/CommentWithoutObjectId' - - /Comment/AddComment: - post: - summary: Posted - description: Adds comment to comment - parameters: - - name: text - in: query - required: true - type: string - description: Comment text - - name: name - in: query - required: true - type: string - description: Comment name - responses: - 200: - description: Comment added successfully - schema: - type: string - #items: - #$ref: '#/definitions/Comment' - - ############ - - /Image: - get: - summary: All images - description: Returns all images - responses: - 200: - description: Array of images - schema: - type: array - items: - $ref: '#/definitions/ImageWithoutObjectId' - - /Image/GetById: - get: - summary: One image - description: Gets image by id - parameters: - - name: id - required: true - in: query - type: string - description: Image id - responses: - 200: - description: Image - schema: - $ref: '#/definitions/ImageWithoutObjectId' - - /Image/AddImage: - post: - summary: Posted - description: Adds image - parameters: - - name: name - in: query - required: true - type: string - description: Image name - - name: url - in: query - required: true - type: string - description: Image Url - responses: - 200: - description: Image added successfully - schema: - type: string - #items: - #$ref: '#/definitions/Image' - - /Image/AddCommentToImage: - post: - summary: Posted - description: Adds comment to image - parameters: - - name: scommentId - in: query - required: true - type: string - description: Comment id - - name: simageId - required: true - in: query - type: string - description: Image id - responses: - 200: - description: Comment added to image successfully - schema: - type: string - #$ref: '#/definitions/Image' - - ############ - - /Project: - get: - summary: All projects - description: Returns all projects - responses: - 200: - description: Array of projects - schema: - type: array - items: - $ref: '#/definitions/ProjectWithoutObjectId' - - /Project/GetById: - get: - summary: One Project - description: Gets project by id - parameters: - - name: id - in: query - required: true - type: string - description: Project id - responses: - 200: - description: Project - schema: - $ref: '#/definitions/ProjectWithoutObjectId' - #fix method an go on - /Project/AddProject: - post: - summary: Posted - description: Adds project to root library - parameters: - - name: name - in: query - required: true - type: string - description: Project name - responses: - 200: - description: Project added to root library successfully - schema: - type: string - #$ref: '#/definitions/Comment' - - /Project/AddProjectToProject: - post: - summary: Posted - description: Adds new project to root project - parameters: - - name: sidNew - in: query - required: true - type: string - description: New project id - - name: sidRoot - in: query - required: true - type: string - description: Root project id - responses: - 200: - description: Project added to root project successfully - schema: - type: string - #$ref: '#/definitions/Project' - - /Project/AddImageToProject: - post: - summary: Posted - description: Adds image to project - parameters: - - name: simageId - in: query - required: true - type: string - description: Image id - - name: sprojectId - in: query - required: true - type: string - description: Project id - responses: - 200: - description: Image added to project successfully - schema: - type: string - #$ref: '#/definitions/Project' - - /Project/AddCommentToProject: - post: - summary: Posted - description: Adds comment to project - parameters: - - name: scommentId - in: query - required: true - type: string - description: Comment id - - name: sprojectId - in: query - required: true - type: string - description: Project id - responses: - 200: - description: Comment added to project successfully - schema: - type: string - #$ref: '#/definitions/Project' - - - ############ - - -definitions: - - Error: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - fields: - type: string - - BaseEntity: - required: - - Name - - Author - - Version - - Id - - CreationelData - properties: - Name: - type: string - Author: - type: string - Version: - type: integer - #format: uint - Id: - type: string - CreationelData: - type: string - - Comment: - type: object - description: Comment! - allOf: - - $ref: '#/definitions/BaseEntity' - - properties: - Text: - type: string - description: Comment content - - CommentWithoutObjectId: - type: object - description: CommentWithoutObkectId - properties: - Name: - type: string - Author: - type: string - Version: - type: integer - #format: uint - Id: - type: string - CreationelData: - type: string - Text: - type: string - - Image: - type: object - description: Image! - allOf: - - $ref: '#/definitions/BaseEntity' - - properties: - Comments: - type: array - items: - $ref: '#/definitions/Comment' - description: List of comments - - ImageWithoutObjectId: - type: object - description: ImageWithoutObjectId - properties: - Name: - type: string - Author: - type: string - Version: - type: integer - #format: uint - Id: - type: string - CreationelData: - type: string - Comments: - type: array - items: - $ref: '#/definitions/Comment' - description: List of comments - - - Project: - type: object - description: Project! - allOf: - - $ref: '#/definitions/BaseEntity' - - properties: - Comments: - type: array - items: - $ref: '#/definitions/Comment' - Images: - type: array - items: - $ref: '#/definitions/Image' - Projects: - type: array - items: - $ref: '#/definitions/Project' - - ProjectWithoutObjectId: - type: object - description: ProjectWithoutObjectId - properties: - Name: - type: string - Author: - type: string - Version: - type: integer - #format: uint - Id: - type: string - CreationelData: - type: string - Comments: - type: array - items: - $ref: '#/definitions/Comment' - Images: - type: array - items: - $ref: '#/definitions/Image' - Projects: - type: array - items: - $ref: '#/definitions/Project' \ No newline at end of file +language: csharp +solution: Ease-L.sln \ No newline at end of file From cc28866435490c4dc6d00b2f536bed9a8bc82beb Mon Sep 17 00:00:00 2001 From: artembell Date: Wed, 3 Aug 2016 14:48:53 +0300 Subject: [PATCH 03/15] Updated swagger.yaml --- swagger.yaml | 729 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 729 insertions(+) create mode 100644 swagger.yaml diff --git a/swagger.yaml b/swagger.yaml new file mode 100644 index 0000000..925dbbc --- /dev/null +++ b/swagger.yaml @@ -0,0 +1,729 @@ +# this is an example of the Uber API +# as a demonstration of an API spec in YAML +swagger: '2.0' +info: + title: Ease-L + description: Making project + version: "1.0.0" +# the domain of the service +host: api.uber.com +# array of all schemes that your API supports +schemes: + - https +# will be prefixed to all paths +basePath: /v1 +produces: + - application/json +paths: + + + + /Comment: + get: + summary: All comments + description: Returns all comments + responses: + 200: + description: Array of comments + schema: + type: array + items: + $ref: '#/definitions/CommentWithoutObjectId' + + /Comment/GetById: + get: + summary: One comment + description: Gets comment by id + parameters: + - name: id + in: query + required: true + type: string + description: Comment id + responses: + 200: + description: Comment + schema: + $ref: '#/definitions/CommentWithoutObjectId' + 400: + description: Bad request + schema: + type: string + + + + /Comment/AddComment: + post: + summary: Posted + description: Adds comment to comment + parameters: + - name: text + in: query + required: true + type: string + description: Comment text + - name: name + in: query + required: true + type: string + description: Comment name + responses: + 200: + description: Comment added successfully + schema: + type: string + + + /Comment/UpdateById: + post: + summary: Posted + description: Updates comment by id + parameters: + - name: id + in: query + required: true + type: string + description: Comment id + - name: name + in: query + required: true + type: string + description: Comment name + - name: text + in: query + required: true + type: string + description: Comment text + responses: + 200: + description: Updated comment + schema: + $ref: '#/definitions/CommentWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + ############ + + /Image: + get: + summary: All images + description: Returns all images + responses: + 200: + description: Array of images + schema: + type: array + items: + $ref: '#/definitions/ImageWithoutObjectId' + + /Image/GetById: + get: + summary: One image + description: Gets image by id + parameters: + - name: id + required: true + in: query + type: string + description: Image id + responses: + 200: + description: Image + schema: + $ref: '#/definitions/ImageWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + /Image/AddImage: + post: + summary: Posted + description: Adds image + parameters: + - name: name + in: query + required: true + type: string + description: Image name + - name: url + in: query + required: true + type: string + description: Image Url + responses: + 200: + description: Image added successfully + schema: + type: string + #items: + #$ref: '#/definitions/Image' + + /Image/AddCommentToImage: + post: + summary: Posted + description: Adds comment to image + parameters: + - name: name + in: query + required: true + type: string + description: Comment name + - name: simageId + required: true + in: query + type: string + description: Image id + - name: text + in: query + required: true + type: string + description: Comment text + responses: + 200: + description: Comment added to image successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Image/DeleteCommentFromImage: + delete: + summary: Comment deleted from image + description: Deletes comment from image + parameters: + - name: idImage + in: query + required: true + type: string + description: Image id + - name: idComment + in: query + required: true + type: string + description: Comment id + responses: + 200: + description: Comment deleted from image successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Image/GetCommentFromImage: + get: + summary: One comment + description: Gets comment by id + parameters: + - name: simageId + required: true + in: query + type: string + description: Image id + responses: + 200: + description: Comments + schema: + type: array + items: + $ref: '#/definitions/CommentWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + /Image/UpdateById: + put: + summary: Updated image + description: Updates image by id + parameters: + - name: id + required: true + in: query + type: string + description: Image id + - name: name + required: true + in: query + type: string + description: Image name + - name: url + required: true + in: query + type: string + description: Image url + responses: + 200: + description: Comments + schema: + $ref: '#/definitions/ImageWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + /Image/DownloadImage2: + post: + summary: Dowloaded + description: Dowloads image(byte[]) + parameters: + - name: uploadImage + in: query + required: true + type: string + format: byte + description: Upload image + responses: + 200: + description: Image downloaded successfully + schema: + type: string + + + + + ############ + + /Project: + get: + summary: All projects + description: Returns all projects + responses: + 200: + description: Array of projects + schema: + type: array + items: + $ref: '#/definitions/ProjectWithoutObjectId' + + /Project/GetById: + get: + summary: One Project + description: Gets project by id + parameters: + - name: id + in: query + required: true + type: string + description: Project id + responses: + 200: + description: Project + schema: + $ref: '#/definitions/ProjectWithoutObjectId' + #fix method an go on + /Project/AddProject: + post: + summary: Posted + description: Adds project to root library + parameters: + - name: name + in: query + required: true + type: string + description: Project name + responses: + 200: + description: Project added to root library successfully + schema: + type: string + #$ref: '#/definitions/Comment' + + /Project/AddProjectToProject: + post: + summary: Posted + description: Adds new project to root project + parameters: + - name: name + in: query + required: true + type: string + description: New project name + - name: sidRoot + in: query + required: true + type: string + description: Root project id + responses: + 200: + description: Project added to root project successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Project/AddImageToProject: + post: + summary: Posted + description: Adds image to project + parameters: + - name: url + in: query + required: true + type: string + description: Image url + - name: name + required: true + in: query + type: string + description: Image name + - name: sprojectId + in: query + required: true + type: string + description: Project id + responses: + 200: + description: Image added to project successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Project/AddCommentToProject: + post: + summary: Posted + description: Adds comment to project + parameters: + - name: text + in: query + required: true + type: string + description: Comment text + - name: name + required: true + in: query + type: string + description: Comment name + - name: sprojectId + in: query + required: true + type: string + description: Project id + responses: + 200: + description: Comment added to project successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Project/DeleteById: + delete: + summary: Project deleted + description: Deletes project + parameters: + - name: id + in: query + required: true + type: string + description: Project id + responses: + 200: + description: Project deleted successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Project/DeleteCommentFromProject: + delete: + summary: Comment deleted from project + description: Deletes comment from project + parameters: + - name: projectId + in: query + required: true + type: string + description: Project id + - name: commentId + in: query + required: true + type: string + description: Comment id + responses: + 200: + description: Comment deleted from project successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Project/DeleteImageFromProject: + delete: + summary: Image deleted from project + description: Deletes image from project + parameters: + - name: projectId + in: query + required: true + type: string + description: Project id + - name: imageId + in: query + required: true + type: string + description: Image id + responses: + 200: + description: Image deleted from project successfully + schema: + type: string + 400: + description: Bad id + schema: + type: string + + /Project/GetCommentsFromProject: + get: + summary: All comments from project + description: Gets all comments from project + parameters: + - name: sidRoot + in: query + required: true + type: string + description: Project id + responses: + 200: + description: All comments from project + schema: + type: array + items: + $ref: '#/definitions/CommentWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + /Project/GetImagesFromProject: + get: + summary: All images from project + description: Gets all images from project + parameters: + - name: sidRoot + in: query + required: true + type: string + description: Project id + responses: + 200: + description: All images from project + schema: + type: array + items: + $ref: '#/definitions/ImageWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + /Project/GetProjectsFromProject: + get: + summary: All projects from project + description: Gets all projects from project + parameters: + - name: sidRoot + in: query + required: true + type: string + description: Project id + responses: + 200: + description: All projects from project + schema: + type: array + items: + $ref: '#/definitions/ProjectWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + /Project/UpdateById: + put: + summary: Updated project + description: Updates project by id + parameters: + - name: id + required: true + in: query + type: string + description: Project id + - name: name + required: true + in: query + type: string + description: Project name + responses: + 200: + description: Projects + schema: + $ref: '#/definitions/ProjectWithoutObjectId' + 400: + description: Bad id + schema: + type: string + + + + ############ + + +definitions: + + Error: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + fields: + type: string + + BaseEntity: + required: + - Name + - Author + - Version + - Id + - CreationelData + properties: + Name: + type: string + Author: + type: string + Version: + type: integer + #format: uint + Id: + type: string + CreationelData: + type: string + + Comment: + type: object + description: Comment! + allOf: + - $ref: '#/definitions/BaseEntity' + - properties: + Text: + type: string + description: Comment content + + CommentWithoutObjectId: + type: object + description: CommentWithoutObkectId + properties: + Name: + type: string + Author: + type: string + Version: + type: integer + #format: uint + Id: + type: string + CreationelData: + type: string + Text: + type: string + + Image: + type: object + description: Image! + allOf: + - $ref: '#/definitions/BaseEntity' + - properties: + Comments: + type: array + items: + $ref: '#/definitions/Comment' + description: List of comments + + ImageWithoutObjectId: + type: object + description: ImageWithoutObjectId + properties: + Name: + type: string + Author: + type: string + Version: + type: integer + #format: uint + Id: + type: string + CreationelData: + type: string + Comments: + type: array + items: + $ref: '#/definitions/Comment' + description: List of comments + + + Project: + type: object + description: Project! + allOf: + - $ref: '#/definitions/BaseEntity' + - properties: + Comments: + type: array + items: + $ref: '#/definitions/Comment' + Images: + type: array + items: + $ref: '#/definitions/Image' + Projects: + type: array + items: + $ref: '#/definitions/Project' + + ProjectWithoutObjectId: + type: object + description: ProjectWithoutObjectId + properties: + Name: + type: string + Author: + type: string + Version: + type: integer + #format: uint + Id: + type: string + CreationelData: + type: string + Comments: + type: array + items: + $ref: '#/definitions/Comment' + Images: + type: array + items: + $ref: '#/definitions/Image' + Projects: + type: array + items: + $ref: '#/definitions/Project' \ No newline at end of file From d87585d17637c5415e9d1c0febf0e6b045c87c05 Mon Sep 17 00:00:00 2001 From: artembell Date: Wed, 3 Aug 2016 17:04:07 +0300 Subject: [PATCH 04/15] Renamed to .travis.yaml --- travis.yaml => .travis.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename travis.yaml => .travis.yaml (100%) diff --git a/travis.yaml b/.travis.yaml similarity index 100% rename from travis.yaml rename to .travis.yaml From 888db0a4967d8a045373683b3e809148ad7f2ffe Mon Sep 17 00:00:00 2001 From: artembell Date: Thu, 4 Aug 2016 16:28:51 +0300 Subject: [PATCH 05/15] An empty appveyor.yaml --- .travis.yaml | 2 -- appveyor.yaml | 0 2 files changed, 2 deletions(-) delete mode 100644 .travis.yaml create mode 100644 appveyor.yaml diff --git a/.travis.yaml b/.travis.yaml deleted file mode 100644 index 745b50c..0000000 --- a/.travis.yaml +++ /dev/null @@ -1,2 +0,0 @@ -language: csharp -solution: Ease-L.sln \ No newline at end of file diff --git a/appveyor.yaml b/appveyor.yaml new file mode 100644 index 0000000..e69de29 From 4c664c72b5e7b0c9f2f432519644cd8044b2bfe5 Mon Sep 17 00:00:00 2001 From: artembell Date: Thu, 4 Aug 2016 16:53:10 +0300 Subject: [PATCH 06/15] Filled appveyor,yaml --- appveyor.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/appveyor.yaml b/appveyor.yaml index e69de29..9f08961 100644 --- a/appveyor.yaml +++ b/appveyor.yaml @@ -0,0 +1,10 @@ +configuration: Release + +# restore NuGet packages before running MSBuild +before_build: + - nuget restore + +# package Web Application project for Web Deploy +build: + verbosity: minimal + publish_wap: true From 3b40b4d2880bb4336c59d78379d54d959327d542 Mon Sep 17 00:00:00 2001 From: artembell Date: Mon, 8 Aug 2016 15:19:28 +0300 Subject: [PATCH 07/15] cmd --- WebApp/Web.config | 2 +- WebApp/packages.config | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/WebApp/Web.config b/WebApp/Web.config index 00779b1..53bd337 100644 --- a/WebApp/Web.config +++ b/WebApp/Web.config @@ -12,7 +12,7 @@ - + diff --git a/WebApp/packages.config b/WebApp/packages.config index 426df07..b821dbc 100644 --- a/WebApp/packages.config +++ b/WebApp/packages.config @@ -31,6 +31,7 @@ + From 2180e596d161f07a06ee7be2a39981eae8fe6b7f Mon Sep 17 00:00:00 2001 From: artembell Date: Mon, 8 Aug 2016 17:13:40 +0300 Subject: [PATCH 08/15] Added install reference --- appveyor.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yaml b/appveyor.yaml index 9f08961..a030c58 100644 --- a/appveyor.yaml +++ b/appveyor.yaml @@ -3,6 +3,9 @@ configuration: Release # restore NuGet packages before running MSBuild before_build: - nuget restore + +install: + - nuget restore # package Web Application project for Web Deploy build: From f0870391a94293b39103525a2e926ee00808a64a Mon Sep 17 00:00:00 2001 From: artembell Date: Tue, 9 Aug 2016 12:23:38 +0300 Subject: [PATCH 09/15] sln --- appveyor.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/appveyor.yaml b/appveyor.yaml index a030c58..6ec703f 100644 --- a/appveyor.yaml +++ b/appveyor.yaml @@ -2,10 +2,7 @@ configuration: Release # restore NuGet packages before running MSBuild before_build: - - nuget restore - -install: - - nuget restore + - nuget restore Ease-L.sln # package Web Application project for Web Deploy build: From 5ace6aa300e9aa52f1cc5a6e28c3981c6238783d Mon Sep 17 00:00:00 2001 From: artembell Date: Tue, 9 Aug 2016 13:05:18 +0300 Subject: [PATCH 10/15] Reinstalled packages --- DB/DB.csproj | 1 - WebApp/App_Start/IdentityConfig.cs | 1 + WebApp/Models/IdentityModels.cs | 8 +++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DB/DB.csproj b/DB/DB.csproj index e9675af..8d90a0a 100644 --- a/DB/DB.csproj +++ b/DB/DB.csproj @@ -73,7 +73,6 @@ -