Skip to content

Commit

Permalink
fixed namespaces in entity and files using them
Browse files Browse the repository at this point in the history
  • Loading branch information
Schoogle committed Nov 21, 2023
1 parent a9cf22b commit 01c85d7
Show file tree
Hide file tree
Showing 43 changed files with 101 additions and 116 deletions.
2 changes: 1 addition & 1 deletion GirafEntities/Authentication/DTOs/LoginDTO.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace GirafRest.Models.DTOs.AccountDTOs
namespace GirafEntities.Authentication.DTOs
{
/// <summary>
/// DTO Used for Login
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Authentication/DTOs/RegisterDTO.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using GirafEntities.User;

namespace GirafRest.Models.DTOs.AccountDTOs
namespace GirafEntities.Authentication.DTOs
{
/// <summary>
/// DTO Used for registrering/Signup
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Authentication/JwtConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GirafRest.Services
namespace GirafEntities.Authentication
{
/// <summary>
/// Instance of JwtConfig holding serverside configuration for building JWT Tokens
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/DTOs/ResourceIdDTO.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GirafRest.Models.DTOs
namespace GirafEntities.DTOs
{
/// <summary>
/// Simple DTO for a Resource ID
Expand Down
1 change: 1 addition & 0 deletions GirafEntities/GirafEntities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />
</ItemGroup>

</Project>
5 changes: 2 additions & 3 deletions GirafEntities/Samples/SampleData.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using GirafRest.Data.Samples;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace GirafRest.Data
namespace GirafEntities.Samples
{
public class SampleData
{
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Samples/SampleDepartment.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GirafRest.Data.Samples
namespace GirafEntities.Samples
{
public class SampleDepartment
{
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Samples/SampleGirafUser.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace GirafRest.Data.Samples
namespace GirafEntities.Samples
{
public class SampleGirafUser
{
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Samples/SamplePictogram.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GirafRest.Data.Samples
namespace GirafEntities.Samples
{
public class SamplePictogram
{
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Samples/SampleWeek.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GirafRest.Data.Samples
namespace GirafEntities.Samples
{
public class SampleWeek
{
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Samples/SampleWeekDay.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using GirafRest.Models;
using System.Collections.Generic;

namespace GirafRest.Data.Samples
namespace GirafEntities.Samples
{
public class SampleWeekday
{
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Samples/SampleWeekTemplate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GirafRest.Data.Samples
namespace GirafEntities.Samples
{
public class SampleWeekTemplate
{
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Settings/ChangePasswordDTO.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace GirafRest.Models.DTOs.AccountDTOs
namespace GirafEntities.Settings
{
/// <summary>
/// DTO Used for changing password
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/Settings/ResetPasswordDTO.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace GirafRest.Models.DTOs.AccountDTOs
namespace GirafEntities.Settings
{
/// <summary>
/// This class defines the structure of the expected json when a user wishes to reset his password.
Expand Down
49 changes: 24 additions & 25 deletions GirafEntities/Settings/Setting.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using GirafRest.Models.DTOs;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace GirafRest.Models
namespace GirafEntities.Settings
{
/// <summary>
/// The LauncherOptions, which is the various settings the users can add to customize the Launcher App.
Expand Down Expand Up @@ -50,7 +49,7 @@ public class Setting
/// </summary>
[Required]
public Theme Theme { get; set; }

/// <summary>
/// Defines the number of days to display in portrait mode for a user in a weekplan
/// </summary>
Expand Down Expand Up @@ -79,12 +78,12 @@ public class Setting
/// Flag to indicate whether citizen should see one or more days or only activities
/// </summary>
public bool ShowOnlyActivities { get; set; }

/// <summary>
/// Defines the number of activities to display for a user in a weekschedule
/// </summary>
public int? NrOfActivitiesToDisplay { get; set; }

/// <summary>
/// Flag for indicating whether or not greyscale is enabled
/// </summary>
Expand Down Expand Up @@ -122,24 +121,24 @@ public class Setting
/// <param name="newOptions">The DTO containing new settings</param>
public void UpdateFrom(SettingDTO newOptions)
{
this.Orientation = newOptions?.Orientation ?? this.Orientation;
this.CompleteMark = newOptions?.CompleteMark ?? this.CompleteMark;
this.CancelMark = newOptions?.CancelMark ?? this.CancelMark;
this.DefaultTimer = newOptions?.DefaultTimer ?? this.DefaultTimer;
this.TimerSeconds = newOptions?.TimerSeconds ?? this.TimerSeconds;
this.ActivitiesCount = newOptions?.ActivitiesCount ?? this.ActivitiesCount;
this.Theme = newOptions?.Theme ?? this.Theme;
this.NrOfDaysToDisplayPortrait = newOptions?.NrOfDaysToDisplayPortrait ?? this.NrOfDaysToDisplayPortrait;
this.DisplayDaysRelativePortrait = newOptions?.DisplayDaysRelativePortrait ?? this.DisplayDaysRelativePortrait;
this.NrOfDaysToDisplayLandscape = newOptions?.NrOfDaysToDisplayLandscape ?? this.NrOfDaysToDisplayLandscape;
this.DisplayDaysRelativeLandscape = newOptions?.DisplayDaysRelativeLandscape ?? this.DisplayDaysRelativeLandscape;
this.GreyScale = newOptions?.GreyScale ?? this.GreyScale;
this.LockTimerControl = newOptions?.LockTimerControl ?? this.LockTimerControl;
this.PictogramText = newOptions?.PictogramText ?? this.PictogramText;
this.ShowPopup = newOptions?.ShowPopup ?? this.ShowPopup;
this.NrOfActivitiesToDisplay = newOptions?.NrOfActivitiesToDisplay ?? this.NrOfActivitiesToDisplay;
this.ShowOnlyActivities = newOptions?.ShowOnlyActivities ?? this.ShowOnlyActivities;
this.ShowSettingsForCitizen = newOptions?.ShowSettingsForCitizen ?? this.ShowSettingsForCitizen;
Orientation = newOptions?.Orientation ?? Orientation;
CompleteMark = newOptions?.CompleteMark ?? CompleteMark;
CancelMark = newOptions?.CancelMark ?? CancelMark;
DefaultTimer = newOptions?.DefaultTimer ?? DefaultTimer;
TimerSeconds = newOptions?.TimerSeconds ?? TimerSeconds;
ActivitiesCount = newOptions?.ActivitiesCount ?? ActivitiesCount;
Theme = newOptions?.Theme ?? Theme;
NrOfDaysToDisplayPortrait = newOptions?.NrOfDaysToDisplayPortrait ?? NrOfDaysToDisplayPortrait;
DisplayDaysRelativePortrait = newOptions?.DisplayDaysRelativePortrait ?? DisplayDaysRelativePortrait;
NrOfDaysToDisplayLandscape = newOptions?.NrOfDaysToDisplayLandscape ?? NrOfDaysToDisplayLandscape;
DisplayDaysRelativeLandscape = newOptions?.DisplayDaysRelativeLandscape ?? DisplayDaysRelativeLandscape;
GreyScale = newOptions?.GreyScale ?? GreyScale;
LockTimerControl = newOptions?.LockTimerControl ?? LockTimerControl;
PictogramText = newOptions?.PictogramText ?? PictogramText;
ShowPopup = newOptions?.ShowPopup ?? ShowPopup;
NrOfActivitiesToDisplay = newOptions?.NrOfActivitiesToDisplay ?? NrOfActivitiesToDisplay;
ShowOnlyActivities = newOptions?.ShowOnlyActivities ?? ShowOnlyActivities;
ShowSettingsForCitizen = newOptions?.ShowSettingsForCitizen ?? ShowSettingsForCitizen;
if (newOptions.WeekDayColors != null)
updateWeekDayColors(newOptions.WeekDayColors);
}
Expand All @@ -150,7 +149,7 @@ private void updateWeekDayColors(List<WeekDayColorDTO> weekDayColors)
{
foreach (var weekDayColor in weekDayColors)
{
var weekDayColorToUpdate = this.WeekDayColors.FirstOrDefault(wdc => wdc.Day == weekDayColor.Day);
var weekDayColorToUpdate = WeekDayColors.FirstOrDefault(wdc => wdc.Day == weekDayColor.Day);
if (weekDayColorToUpdate != null)
{
weekDayColorToUpdate.HexColor = weekDayColor.HexColor;
Expand All @@ -164,7 +163,7 @@ private void updateWeekDayColors(List<WeekDayColorDTO> weekDayColors)
/// </summary>
public void InitialiseWeekDayColors()
{
this.WeekDayColors = new List<WeekDayColor>(){
WeekDayColors = new List<WeekDayColor>(){
new WeekDayColor(){Day = Days.Monday, HexColor = "#08a045", SettingId = Key},
new WeekDayColor(){Day = Days.Tuesday, HexColor = "#540d6e", SettingId = Key},
new WeekDayColor(){Day = Days.Wednesday, HexColor = "#f77f00", SettingId = Key},
Expand Down
40 changes: 20 additions & 20 deletions GirafEntities/Settings/SettingDTO.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace GirafRest.Models.DTOs
namespace GirafEntities.Settings
{
/// <summary>
/// Screen orientation
Expand Down Expand Up @@ -195,25 +195,25 @@ public class SettingDTO
/// <param name="options">The launcher options in need of transfer</param>
public SettingDTO(Setting options)
{
this.Orientation = options.Orientation;
this.CompleteMark = options.CompleteMark;
this.CancelMark = options.CancelMark;
this.DefaultTimer = options.DefaultTimer;
this.TimerSeconds = options.TimerSeconds;
this.ActivitiesCount = options.ActivitiesCount;
this.Theme = options.Theme;
this.NrOfDaysToDisplayPortrait = options.NrOfDaysToDisplayPortrait;
this.DisplayDaysRelativePortrait = options.DisplayDaysRelativePortrait;
this.NrOfDaysToDisplayLandscape = options.NrOfDaysToDisplayLandscape;
this.DisplayDaysRelativeLandscape = options.DisplayDaysRelativeLandscape;
this.ShowOnlyActivities = options.ShowOnlyActivities;
this.NrOfActivitiesToDisplay = options.NrOfActivitiesToDisplay;
this.GreyScale = options.GreyScale;
this.LockTimerControl = options.LockTimerControl;
this.PictogramText = options.PictogramText;
this.ShowSettingsForCitizen = options.ShowSettingsForCitizen;
this.WeekDayColors = SetWeekDayColorsFromModel(options.WeekDayColors);
this.ShowPopup = options.ShowPopup;
Orientation = options.Orientation;
CompleteMark = options.CompleteMark;
CancelMark = options.CancelMark;
DefaultTimer = options.DefaultTimer;
TimerSeconds = options.TimerSeconds;
ActivitiesCount = options.ActivitiesCount;
Theme = options.Theme;
NrOfDaysToDisplayPortrait = options.NrOfDaysToDisplayPortrait;
DisplayDaysRelativePortrait = options.DisplayDaysRelativePortrait;
NrOfDaysToDisplayLandscape = options.NrOfDaysToDisplayLandscape;
DisplayDaysRelativeLandscape = options.DisplayDaysRelativeLandscape;
ShowOnlyActivities = options.ShowOnlyActivities;
NrOfActivitiesToDisplay = options.NrOfActivitiesToDisplay;
GreyScale = options.GreyScale;
LockTimerControl = options.LockTimerControl;
PictogramText = options.PictogramText;
ShowSettingsForCitizen = options.ShowSettingsForCitizen;
WeekDayColors = SetWeekDayColorsFromModel(options.WeekDayColors);
ShowPopup = options.ShowPopup;
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions GirafEntities/User/DTOs/DepartmentDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
using System.Linq;
using GirafEntities.User;

namespace GirafRest.Models.DTOs
namespace GirafEntities.User.DTOs
{
/// <summary>
/// DTO for <see cref="Department"/>
Expand Down
6 changes: 3 additions & 3 deletions GirafEntities/User/DTOs/DepartmentNameDTO.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GirafRest
namespace GirafEntities.User.DTOs
{
/// <summary>
/// DTO for Department Name
Expand All @@ -19,8 +19,8 @@ public class DepartmentNameDTO
/// </summary>
public DepartmentNameDTO(long id, string name)
{
this.ID = id;
this.Name = name;
ID = id;
Name = name;
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions GirafEntities/User/DTOs/DisplayNameDTO.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using GirafEntities.User;

namespace GirafRest.Models.DTOs
namespace GirafEntities.User.DTOs
{
/// <summary>
/// DTO for DisplayName, used to avoid sending entire GirafUserDTO to avoid sending unnecessary information
Expand Down Expand Up @@ -54,7 +54,7 @@ public int CompareTo(DisplayNameDTO other)
}
else
{
return this.DisplayName.CompareTo(other.DisplayName);
return DisplayName.CompareTo(other.DisplayName);
}

}
Expand All @@ -68,7 +68,7 @@ public override bool Equals(object obj)
return false;

DisplayNameDTO dto = (DisplayNameDTO)obj;
return this.DisplayName == dto.DisplayName && this.UserRole == dto.UserRole && this.UserId == dto.UserId;
return DisplayName == dto.DisplayName && UserRole == dto.UserRole && UserId == dto.UserId;
}
}
}
2 changes: 1 addition & 1 deletion GirafEntities/User/DTOs/GirafUserDTO.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using GirafEntities.User;

namespace GirafRest.Models.DTOs
namespace GirafEntities.User.DTOs
{
/// <summary>
/// Defines the structure of GirafUsers when serializing and deserializing data. Data transfer objects (DTOs)
Expand Down
7 changes: 3 additions & 4 deletions GirafEntities/User/Department.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using GirafRest.Models.DTOs;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using GirafEntities.User;
using GirafEntities.User.DTOs;

namespace GirafRest.Models
namespace GirafEntities.User
{
/// <summary>
/// Departments group users and thus have a list of users. They may own resources, that are available
Expand Down Expand Up @@ -56,7 +55,7 @@ public Department()
/// <param name="depDTO">The DTO containing all data on the new department.</param>
public Department(DepartmentDTO depDTO) : this()
{
this.Name = depDTO.Name;
Name = depDTO.Name;
}
}
}
10 changes: 5 additions & 5 deletions GirafEntities/User/DepartmentResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace GirafRest.Models
namespace GirafEntities.User
{
/// <summary>
/// Defines a many-to-many relationship between <see cref="Department"/> and <see cref="Pictogram"/> (ressource)
Expand Down Expand Up @@ -45,10 +45,10 @@ public class DepartmentResource
/// <param name="pictogram">The involved pictogram.</param>
public DepartmentResource(Department dep, Pictogram pictogram)
{
this.OtherKey = dep.Key;
this.Other = dep;
this.PictogramKey = pictogram.Id;
this.Pictogram = pictogram;
OtherKey = dep.Key;
Other = dep;
PictogramKey = pictogram.Id;
Pictogram = pictogram;

pictogram.LastEdit = DateTime.Now;
Other.Resources.Add(this);
Expand Down
2 changes: 1 addition & 1 deletion GirafEntities/User/GirafUser.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using GirafRest.Models;
using GirafEntities.Settings;
using Microsoft.AspNetCore.Identity;

namespace GirafEntities.User
Expand Down
10 changes: 4 additions & 6 deletions GirafEntities/User/GuardianRelation.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using GirafRest.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using GirafEntities.User;

namespace GirafRest.Models
namespace GirafEntities.User

{
/// <summary>
Expand Down Expand Up @@ -46,8 +44,8 @@ public class GuardianRelation
/// </summary>
public GuardianRelation(GirafUser guardian, GirafUser citizen)
{
this.Citizen = citizen;
this.Guardian = guardian;
Citizen = citizen;
Guardian = guardian;
}

/// <summary>
Expand Down
Loading

0 comments on commit 01c85d7

Please sign in to comment.