Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Retrieval endpoints return Likes #336

Merged
merged 11 commits into from
Dec 7, 2020
2 changes: 2 additions & 0 deletions API/Configuration/MappingProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using API.Resources;
using AutoMapper;
using Models;
using System.Collections.Generic;

namespace API.Configuration
{
Expand Down Expand Up @@ -78,6 +79,7 @@ public MappingProfile()

CreateMap<ProjectResource, Project>();
CreateMap<Project, ProjectResourceResult>();
CreateMap<ProjectLike, ProjectLikesResourceResult>();
CreateMap<Project, ProjectHighlightResourceResult>();

CreateMap<CollaboratorResource, Collaborator>();
Expand Down
535 changes: 271 additions & 264 deletions API/Controllers/ProjectController.cs

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions API/Resources/ProjectLikesResourceResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace API.Resources
{
/// <summary>
/// The view model result of UserProjectLike
/// </summary>
public class ProjectLikesResourceResult
{
/// <summary>
/// Gets or sets the id of the user who liked the project.
/// </summary>
/// <value>
/// The User identifier
/// </value>
public int UserId { get; set; }
/// <summary>
/// Gets or sets the date of when the user has liked the project.
/// </summary>
public DateTime Date { get; set; }
}
}
31 changes: 18 additions & 13 deletions API/Resources/ProjectResourceResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,72 +15,77 @@
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*/

using Models;
using System;
using System.Collections.Generic;

namespace API.Resources
{
/// <summary>
/// The view model result of project
/// The view model result of project.
/// </summary>
public class ProjectResourceResult
{
/// <summary>
/// Get or Set Id of a Project Resource Reuslt
/// Get or Set Id of a Project Resource Result.
/// </summary>
public int Id { get; set; }

/// <summary>
/// This gets or sets the user
/// This gets or sets the user.
/// </summary>
public LimitedUserResourceResult User { get; set; }

/// <summary>
/// This gets or sets the userId
/// This gets or sets the userId.
/// </summary>
public int UserId { get; set; }

/// <summary>
/// This gets or sets the Name
/// This gets or sets the Name.
/// </summary>
public string Name { get; set; }

/// <summary>
/// This gets or sets the Description
/// This gets or sets the Description.
/// </summary>
public string Description { get; set; }

/// <summary>
/// This gets or sets the Short Description
/// This gets or sets the Short Description.
/// </summary>
public string ShortDescription { get; set; }

/// <summary>
/// This gets or sets the Uri
/// This gets or sets the Uri.
/// </summary>
public string Uri { get; set; }

/// <summary>
/// This gets or sets the collaborators
/// This gets or sets the collaborators.
/// </summary>
public ICollection<CollaboratorResourceResult> Collaborators { get; set; }

/// <summary>
/// This gets or sets the Created time of the project
/// This gets or sets the Created time of the project.
/// </summary>
public DateTime Created { get; set; }

/// <summary>
/// This gets or sets the Updated time of the project
/// This gets or sets the Updated time of the project.
/// </summary>
public DateTime Updated { get; set; }
/// <summary>
/// This gets or set the file of the project
/// This gets or set the file of the project.
/// </summary>
public FileResourceResult ProjectIcon { get; set; }
/// <summary>
/// This gets or sets the call to action
/// This gets or sets the call to action.
/// </summary>
public CallToActionResourceResult CallToAction { get; set; }
/// <summary>
/// This gets or sets the likes of the project.
/// </summary>
public List<ProjectLikesResourceResult> Likes { get; set; }
}
}
5 changes: 5 additions & 0 deletions API/Resources/ProjectResultResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*/

using Models;
using System;
using System.Collections.Generic;

Expand Down Expand Up @@ -69,6 +70,10 @@ public class ProjectResultResource
/// This gets or sets the call to action of the project.
/// </summary>
public CallToActionResourceResult CallToAction { get; set; }
/// <summary>
/// This gets or sets the likes of the project.
/// </summary>
public List<ProjectLikesResourceResult> Likes { get; set; }
}

}
39 changes: 0 additions & 39 deletions API/Resources/UserProjectLikeResource.cs

This file was deleted.

12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Automatically link users to their institution - [#295](https://github.com/DigitalExcellence/dex-backend/issues/295)
- Added call to actions for projects and call to action options - [312](https://github.com/DigitalExcellence/dex-backend/issues/312)
- Collaborators are now included on the project overview page - [#317](https://github.com/DigitalExcellence/dex-backend/issues/317)
- Added new endpoint for ability to like and unlike projects - [#229](https://github.com/DigitalExcellence/dex-backend/issues/229)
- Automatically link users to their institution. - [#295](https://github.com/DigitalExcellence/dex-backend/issues/295)
- Added call to actions for projects and call to action options. - [312](https://github.com/DigitalExcellence/dex-backend/issues/312)
- Collaborators are now included on the project overview page. - [#317](https://github.com/DigitalExcellence/dex-backend/issues/317)
- Added new endpoint for ability to like and unlike projects. - [#229](https://github.com/DigitalExcellence/dex-backend/issues/229)
- Project retrieval endpoints now include likes. - [#329](https://github.com/DigitalExcellence/dex-backend/issues/329)


### Changed
Expand All @@ -25,9 +26,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed issue where unused project icons where left in the database & File System - [#271](https://github.com/DigitalExcellence/dex-backend/issues/271)
- Fixed issue where unused project icons where left in the database & File System. - [#271](https://github.com/DigitalExcellence/dex-backend/issues/271)
- Refactored Postman CLI files to make them work from Postman folder. - [#304](https://github.com/DigitalExcellence/dex-backend/issues/304)
- Fixed issue where searching for a project did not include the project icon. - [#307](https://github.com/DigitalExcellence/dex-backend/issues/307)
- Fixes issue where retrieving projects performed badly due to large amount of collaborators. - [#331](https://github.com/DigitalExcellence/dex-backend/issues/331)

### Security

Expand Down
Loading