Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion exercise.wwwapi/DTOs/GetObjects/PostsSuccessDTO.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using exercise.wwwapi.Models;
using exercise.wwwapi.Models.UserInfo;
using System.Text.Json.Serialization;

namespace exercise.wwwapi.DTOs.GetObjects
Expand Down
1 change: 0 additions & 1 deletion exercise.wwwapi/DTOs/GetObjects/UsersSuccessDTO.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text.Json.Serialization;
using exercise.wwwapi.Models.UserInfo;

namespace exercise.wwwapi.DTOs.GetUsers;

Expand Down
3 changes: 1 addition & 2 deletions exercise.wwwapi/DTOs/Notes/NoteDTO.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using exercise.wwwapi.Models.UserInfo;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

Expand Down
8 changes: 2 additions & 6 deletions exercise.wwwapi/DTOs/Posts/GetPosts/AuthorDTO.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using exercise.wwwapi.Models;
using exercise.wwwapi.Models.UserInfo;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
Expand All @@ -9,8 +8,6 @@ namespace exercise.wwwapi.DTOs.Posts.GetPosts
public class AuthorDTO
{
public int Id { get; set; }

//public ProfileDTO Profile { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }

Expand All @@ -21,9 +18,8 @@ public AuthorDTO()
public AuthorDTO(User model)
{
Id = model.Id;
//Profile = new ProfileDTO(model.Profile);
firstName = model.Profile.FirstName;
lastName = model.Profile.LastName;
firstName = model.FirstName;
lastName = model.LastName;
}
}
}
4 changes: 2 additions & 2 deletions exercise.wwwapi/DTOs/Posts/GetPosts/CommentDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public CommentDTO(Comment model)
UserId = model.UserId;
Body = model.Body;
CreatedAt = model.CreatedAt;
firstName = model.User.Profile.FirstName;
lastName = model.User.Profile.LastName;
firstName = model.User.FirstName;
lastName = model.User.LastName;
}
}
}
4 changes: 2 additions & 2 deletions exercise.wwwapi/DTOs/Posts/GetPosts/PostDTOVol2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public PostDTOVol2(Post model)
AuthorId = model.AuthorId;
Body = model.Body;
CreatedAt = model.CreatedAt;
Firstname = model.Author.Profile.FirstName;
Lastname = model.Author.Profile.LastName;
Firstname = model.Author.FirstName;
Lastname = model.Author.LastName;
Comments = model.Comments.Select(c => new CommentDTO(c)).ToList();
Likes = model.Likes.Select(l => new LikeDTO(l)).ToList();
}
Expand Down
20 changes: 0 additions & 20 deletions exercise.wwwapi/DTOs/Posts/GetPosts/ProfileDTO.cs

This file was deleted.

5 changes: 4 additions & 1 deletion exercise.wwwapi/DTOs/Register/RegisterRequestDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public class RegisterRequestDTO

[JsonPropertyName("lastName")]
public string? LastName { get; set; }


[JsonPropertyName("mobile")]
public string? Mobile { get; set; }

[JsonPropertyName("bio")]
public string? Bio { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions exercise.wwwapi/DTOs/UpdateUser/UpdateUserRequestDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class UpdateUserRequestDTO
[JsonPropertyName("username")]
public string? Username { get; set; }

[JsonPropertyName("phone")]
public string? Phone { get; set; }
[JsonPropertyName("mobile")]
public string? Mobile { get; set; }

[JsonPropertyName("cohortId")]
public int? CohortId { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions exercise.wwwapi/DTOs/UpdateUser/UpdateUserSuccessDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class UpdateUserSuccessDTO
[JsonPropertyName("github")]
public string? Github { get; set; }

[JsonPropertyName("phone")]
public string? Phone { get; set; }
[JsonPropertyName("Mobile")]
public string? Mobile { get; set; }

[JsonPropertyName("cohortId")]
public int? CohortId { get; set; }
Expand Down
13 changes: 2 additions & 11 deletions exercise.wwwapi/DTOs/UserDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,12 @@ public class UserDTO
[JsonPropertyName("username")]
public string? Username { get; set; }

[JsonPropertyName("phone")]
public string? Phone { get; set; }

[JsonPropertyName("startDate")]
public DateTime? StartDate { get; set; }

[JsonPropertyName("endDate")]
public DateTime? EndDate { get; set; }
[JsonPropertyName("mobile")]
public string? Mobile { get; set; }

[JsonPropertyName("specialism")]
public Specialism? Specialism { get; set; }

[JsonPropertyName("cohortId")]
public int? CohortId { get; set; }

[JsonPropertyName("notes")]
public ICollection<NoteDTO> Notes { get; set; }
[JsonPropertyName("role")]
Expand Down
1 change: 0 additions & 1 deletion exercise.wwwapi/Data/ModelSeeder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using exercise.wwwapi.Enums;
using exercise.wwwapi.Models;
using exercise.wwwapi.Models.UserInfo;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.EntityFrameworkCore;

Expand Down
1 change: 0 additions & 1 deletion exercise.wwwapi/Endpoints/NoteEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using exercise.wwwapi.Factories;
using exercise.wwwapi.Helpers;
using exercise.wwwapi.Models;
using exercise.wwwapi.Models.UserInfo;
using exercise.wwwapi.Repository;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
Expand Down
4 changes: 2 additions & 2 deletions exercise.wwwapi/Endpoints/PostEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static async Task<IResult> GetAllPosts(IRepository<Post> postRepository,
ClaimsPrincipal user)
{
var results = (await postRepository.GetAllAsync(
p => p.Author.Profile,
p => p.Author,
p => p.Comments
)).ToList();

Expand All @@ -113,7 +113,7 @@ private static async Task<IResult> GetAllPostsVol2(IRepository<Post> postReposit
ClaimsPrincipal user)
{
var results = (await postRepository.GetAllAsync(
p => p.Author.Profile,
p => p.Author,
p => p.Comments,
p => p.Likes
)).ToList();
Expand Down
2 changes: 1 addition & 1 deletion exercise.wwwapi/Endpoints/SecureApi.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using exercise.wwwapi.Helpers;
using exercise.wwwapi.Models;
using exercise.wwwapi.Repository;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
using exercise.wwwapi.Models.UserInfo;

namespace exercise.wwwapi.EndPoints;

Expand Down
Loading