From 75865e904f84788e989b732786058834c8ca46a2 Mon Sep 17 00:00:00 2001 From: raczu Date: Thu, 21 Mar 2024 18:12:58 +0100 Subject: [PATCH 1/9] chore: add issue and pull request templates --- .github/ISSUE_TEMPLATE/bug.yml | 22 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature-request.yml | 19 +++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 19 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 00000000..92ebeedd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,22 @@ +name: 🐛 Bug Report +description: Report a reproducable bug. +title: "" +labels: ["type: bug"] +body: + - type: textarea + attributes: + label: What is the current behaviour? + description: A concise description of what you're experiencing. + validations: + required: true + + - type: textarea + attributes: + label: What is the expected behaviour? + description: A concise description of what you expected to happen. + + - type: textarea + attributes: + label: How to reproduce it? + description: Steps to reproduce this behaviour. + diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 00000000..4d4eb631 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,19 @@ +name: ✨ Feature request +description: Suggest an idea to improve our solution. +title: "<title>" +labels: ["type: feature request"] +body: + - type: textarea + attributes: + label: What new thing should be implemented? + description: A concise description of what you're expecting. + validations: + required: true + + - type: textarea + attributes: + label: What is your acceptance criteria? + description: Necessary functionalities to meet your requirements. + validations: + required: true + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..c1aa4ae4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ +<!--- + Do not forget to add appropriate labels describing what + the PR is about. + + scope: (backend | ci/cd | database | docs | frontend | mobile) + type: (cleanup/refactor | feature | fix) +---> + +## Description +<!--- A concise description of your changes ---> + +## Motivation +<!--- Why is this change required? What problem does it solve? ---> + +## Related issue and/or ticket +<!--- + Reference to an existing issue on GitHub and/or a unique + ticket identifer from youtrack (RSN-*) +---> From b66bdb4a54f97af7b072d9ce735cb2d8d2a359d3 Mon Sep 17 00:00:00 2001 From: mkoper02 <maciej.koperdowski@gmail.com> Date: Sun, 24 Mar 2024 00:25:30 +0100 Subject: [PATCH 2/9] backend: created basic DTO classes --- Server/ReasnAPI/ReasnAPI/Models/.gitkeep | 0 Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs | 11 +++++++++++ Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs | 10 ++++++++++ Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs | 14 ++++++++++++++ Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs | 9 +++++++++ Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs | 8 ++++++++ .../ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs | 12 ++++++++++++ .../ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs | 9 +++++++++ Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs | 8 ++++++++ Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs | 13 +++++++++++++ 10 files changed, 94 insertions(+) delete mode 100644 Server/ReasnAPI/ReasnAPI/Models/.gitkeep create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs diff --git a/Server/ReasnAPI/ReasnAPI/Models/.gitkeep b/Server/ReasnAPI/ReasnAPI/Models/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs new file mode 100644 index 00000000..825b4497 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs @@ -0,0 +1,11 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class AddressDto { + public string Country { get; set; } + public string City { get; set; } + public string Street { get; set; } + public string State { get; set; } + public string ZipCode { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs new file mode 100644 index 00000000..6d687892 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs @@ -0,0 +1,10 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class CommentDto { + public int EventId { get; set; } + public string Content { get; set; } + public DateTime Created { get; set; } + public int UserId { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs new file mode 100644 index 00000000..15837066 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs @@ -0,0 +1,14 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class EventDto { + public string Name { get; set; } + public int AddressId { get; set; } + public string Description { get; set; } + public int OrganizerId { get; set; } + public DateTime StartAt { get; set; } + public DateTime EndAt { get; set; } + public string Slug { get; set; } + public int StatusId { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs new file mode 100644 index 00000000..89bd7e20 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs @@ -0,0 +1,9 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class ImageDto { + public byte[] ImageData { get; set; } + public int ObjectId { get; set; } + public int ObjectTypeId { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs new file mode 100644 index 00000000..a79961ea --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs @@ -0,0 +1,8 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class IntrestDto { + public string Name { get; set; } + public int Level { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs new file mode 100644 index 00000000..20086c8c --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ReasnAPI.Models.DTO { + public class ParameterDto { + public string? Key { get; set; } + public string? Value { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs new file mode 100644 index 00000000..6946b650 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs @@ -0,0 +1,9 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class ParticipantDto { + public int EventId { get; set; } + public int UserId { get; set; } + public int StatudId { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs new file mode 100644 index 00000000..5efbf46e --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs @@ -0,0 +1,8 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class StatusDto { + public string Name { get; set; } + public int ObjectTypeId { get; set; } + } +} \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs new file mode 100644 index 00000000..f8de62cb --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs @@ -0,0 +1,13 @@ +using System; + +namespace ReasnAPI.Models.DTO { + public class UserDto { + public string Username { get; set; } + public string Name { get; set; } + public string Surname { get; set; } + public string Email { get; set; } + public string Phone { get; set; } + public int RoleId { get; set; } + public AddressDto Address { get; set; } + } +} \ No newline at end of file From 982d3e331fdbbb5f376d21cfd419a9bddcce5b8f Mon Sep 17 00:00:00 2001 From: mkoper02 <maciej.koperdowski@gmail.com> Date: Sun, 24 Mar 2024 13:02:43 +0100 Subject: [PATCH 3/9] Added nullable and non-nullable properties to parameters --- Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs | 10 +++++----- Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs | 6 +++--- Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs | 4 ++-- Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs | 8 ++------ Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs | 12 ++++++------ 8 files changed, 21 insertions(+), 25 deletions(-) diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs index 825b4497..a9e86b0f 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs @@ -2,10 +2,10 @@ namespace ReasnAPI.Models.DTO { public class AddressDto { - public string Country { get; set; } - public string City { get; set; } - public string Street { get; set; } - public string State { get; set; } - public string ZipCode { get; set; } + public string Country { get; set; } = null!; + public string City { get; set; } = null!; + public string Street { get; set; } = null!; + public string? State { get; set; } + public string? ZipCode { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs index 6d687892..b4e60123 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs @@ -3,7 +3,7 @@ namespace ReasnAPI.Models.DTO { public class CommentDto { public int EventId { get; set; } - public string Content { get; set; } + public string Content { get; set; } = null!; public DateTime Created { get; set; } public int UserId { get; set; } } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs index 15837066..cb0d3bc9 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs @@ -2,13 +2,13 @@ namespace ReasnAPI.Models.DTO { public class EventDto { - public string Name { get; set; } + public string Name { get; set; } = null!; public int AddressId { get; set; } - public string Description { get; set; } + public string Description { get; set; } = null!; public int OrganizerId { get; set; } public DateTime StartAt { get; set; } public DateTime EndAt { get; set; } - public string Slug { get; set; } + public string? Slug { get; set; } public int StatusId { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs index 89bd7e20..bf580d0a 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs @@ -1,8 +1,8 @@ using System; namespace ReasnAPI.Models.DTO { - public class ImageDto { - public byte[] ImageData { get; set; } + public class ImageDto { + public byte[] ImageData { get; set; } = null!; public int ObjectId { get; set; } public int ObjectTypeId { get; set; } } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs index a79961ea..cd25a4fe 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs @@ -2,7 +2,7 @@ namespace ReasnAPI.Models.DTO { public class IntrestDto { - public string Name { get; set; } + public string Name { get; set; } = null!; public int Level { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs index 20086c8c..ad9d7ade 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs @@ -1,12 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace ReasnAPI.Models.DTO { public class ParameterDto { - public string? Key { get; set; } - public string? Value { get; set; } + public string Key { get; set; } = null!; + public string Value { get; set; } = null!; } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs index 5efbf46e..61d9d02b 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs @@ -2,7 +2,7 @@ namespace ReasnAPI.Models.DTO { public class StatusDto { - public string Name { get; set; } + public string Name { get; set; } = null!; public int ObjectTypeId { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs index f8de62cb..a3f15fed 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs @@ -2,12 +2,12 @@ namespace ReasnAPI.Models.DTO { public class UserDto { - public string Username { get; set; } - public string Name { get; set; } - public string Surname { get; set; } - public string Email { get; set; } - public string Phone { get; set; } + public string Username { get; set; } = null!; + public string Name { get; set; } = null!; + public string Surname { get; set; } = null!; + public string Email { get; set; } = null!; + public string? Phone { get; set; } public int RoleId { get; set; } - public AddressDto Address { get; set; } + public AddressDto? Address { get; set; } } } \ No newline at end of file From 4d47a257a6efb4cd834adb66c7331bd63ab4e54b Mon Sep 17 00:00:00 2001 From: mkoper02 <maciej.koperdowski@gmail.com> Date: Sun, 24 Mar 2024 18:57:01 +0100 Subject: [PATCH 4/9] Changes based on PR for DTOs - fixed spelling and added new parameters --- Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs | 2 ++ Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs index b4e60123..b80159e7 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs @@ -4,7 +4,7 @@ namespace ReasnAPI.Models.DTO { public class CommentDto { public int EventId { get; set; } public string Content { get; set; } = null!; - public DateTime Created { get; set; } + public DateTime CreatedAt { get; set; } public int UserId { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs index cb0d3bc9..d7824f01 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs @@ -8,6 +8,8 @@ public class EventDto { public int OrganizerId { get; set; } public DateTime StartAt { get; set; } public DateTime EndAt { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime UpdatedAt { get; set; } public string? Slug { get; set; } public int StatusId { get; set; } } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs index 6946b650..67e2e994 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs @@ -4,6 +4,6 @@ namespace ReasnAPI.Models.DTO { public class ParticipantDto { public int EventId { get; set; } public int UserId { get; set; } - public int StatudId { get; set; } + public int StatusId { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs index a3f15fed..09002da9 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs @@ -8,6 +8,7 @@ public class UserDto { public string Email { get; set; } = null!; public string? Phone { get; set; } public int RoleId { get; set; } - public AddressDto? Address { get; set; } + public int AddressId { get; set; } + public List<IntrestDto>? Intrests { get; set; } } } \ No newline at end of file From de1eaa79e992e961b1d6e40cf3eea3eabee46d68 Mon Sep 17 00:00:00 2001 From: mkoper02 <maciej.koperdowski@gmail.com> Date: Sun, 24 Mar 2024 21:39:40 +0100 Subject: [PATCH 5/9] New DTOs, changed properties and new parameters --- Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs | 1 + Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs | 5 +++++ Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs | 5 +++++ 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs index a9e86b0f..5a435787 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs @@ -5,7 +5,7 @@ public class AddressDto { public string Country { get; set; } = null!; public string City { get; set; } = null!; public string Street { get; set; } = null!; - public string? State { get; set; } + public string State { get; set; } = null!; public string? ZipCode { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs index d7824f01..6d3c238d 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs @@ -12,5 +12,6 @@ public class EventDto { public DateTime UpdatedAt { get; set; } public string? Slug { get; set; } public int StatusId { get; set; } + public List<TagDto>? Tags { get; set; } } } \ No newline at end of file diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs new file mode 100644 index 00000000..fe97f58e --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs @@ -0,0 +1,5 @@ +namespace ReasnAPI.Models.DTO { + public class RoleDto { + public string Name { get; set; } = null!; + } +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs new file mode 100644 index 00000000..0ec2effb --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs @@ -0,0 +1,5 @@ +namespace ReasnAPI.Models.DTO { + public class TagDto { + public string Name { get; set; } = null!; + } +} From 88f765c9ae81042693d72d9eb4361854457f80aa Mon Sep 17 00:00:00 2001 From: mkoper02 <maciej.koperdowski@gmail.com> Date: Mon, 25 Mar 2024 11:17:33 +0100 Subject: [PATCH 6/9] Changed namespace to plural form --- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/AddressDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/CommentDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/EventDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/ImageDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/IntrestDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/ParameterDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/ParticipantDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/RoleDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/StatusDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/TagDto.cs | 2 +- Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/UserDto.cs | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/AddressDto.cs (90%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/CommentDto.cs (87%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/EventDto.cs (94%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/ImageDto.cs (85%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/IntrestDto.cs (81%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/ParameterDto.cs (82%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/ParticipantDto.cs (84%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/RoleDto.cs (70%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/StatusDto.cs (81%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/TagDto.cs (70%) rename Server/ReasnAPI/ReasnAPI/Models/{DTO => DTOs}/UserDto.cs (93%) diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/AddressDto.cs similarity index 90% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/AddressDto.cs index 5a435787..223eacdd 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/AddressDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/AddressDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class AddressDto { public string Country { get; set; } = null!; public string City { get; set; } = null!; diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/CommentDto.cs similarity index 87% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/CommentDto.cs index b80159e7..b552bfe7 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/CommentDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/CommentDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class CommentDto { public int EventId { get; set; } public string Content { get; set; } = null!; diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/EventDto.cs similarity index 94% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/EventDto.cs index 6d3c238d..d35c8120 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/EventDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/EventDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class EventDto { public string Name { get; set; } = null!; public int AddressId { get; set; } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/ImageDto.cs similarity index 85% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/ImageDto.cs index bf580d0a..d19282b9 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/ImageDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/ImageDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class ImageDto { public byte[] ImageData { get; set; } = null!; public int ObjectId { get; set; } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/IntrestDto.cs similarity index 81% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/IntrestDto.cs index cd25a4fe..5eb19a65 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/IntrestDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/IntrestDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class IntrestDto { public string Name { get; set; } = null!; public int Level { get; set; } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/ParameterDto.cs similarity index 82% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/ParameterDto.cs index ad9d7ade..4f953bdb 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParameterDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/ParameterDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class ParameterDto { public string Key { get; set; } = null!; public string Value { get; set; } = null!; diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/ParticipantDto.cs similarity index 84% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/ParticipantDto.cs index 67e2e994..c951ff50 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/ParticipantDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/ParticipantDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class ParticipantDto { public int EventId { get; set; } public int UserId { get; set; } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/RoleDto.cs similarity index 70% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/RoleDto.cs index fe97f58e..b1267f14 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/RoleDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/RoleDto.cs @@ -1,4 +1,4 @@ -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class RoleDto { public string Name { get; set; } = null!; } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/StatusDto.cs similarity index 81% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/StatusDto.cs index 61d9d02b..42e1cb57 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/StatusDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/StatusDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class StatusDto { public string Name { get; set; } = null!; public int ObjectTypeId { get; set; } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/TagDto.cs similarity index 70% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/TagDto.cs index 0ec2effb..cf6c939b 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/TagDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/TagDto.cs @@ -1,4 +1,4 @@ -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class TagDto { public string Name { get; set; } = null!; } diff --git a/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs b/Server/ReasnAPI/ReasnAPI/Models/DTOs/UserDto.cs similarity index 93% rename from Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs rename to Server/ReasnAPI/ReasnAPI/Models/DTOs/UserDto.cs index 09002da9..2ea5e75f 100644 --- a/Server/ReasnAPI/ReasnAPI/Models/DTO/UserDto.cs +++ b/Server/ReasnAPI/ReasnAPI/Models/DTOs/UserDto.cs @@ -1,6 +1,6 @@ using System; -namespace ReasnAPI.Models.DTO { +namespace ReasnAPI.Models.DTOs { public class UserDto { public string Username { get; set; } = null!; public string Name { get; set; } = null!; From 346432cb02cb1e9beb775d3a4eb3fb86e9dfed80 Mon Sep 17 00:00:00 2001 From: Owczarek Kamil <bilimig@wp.pl> Date: Wed, 27 Mar 2024 00:31:40 +0100 Subject: [PATCH 7/9] Scaffolded database --- .../ReasnAPI/Models/Database/Address.cs | 23 ++ .../ReasnAPI/Models/Database/Comment.cs | 21 + .../ReasnAPI/Models/Database/Event.cs | 39 ++ .../Models/Database/EventParameter.cs | 15 + .../ReasnAPI/Models/Database/EventTag.cs | 15 + .../ReasnAPI/Models/Database/Image.cs | 17 + .../ReasnAPI/Models/Database/Interest.cs | 13 + .../ReasnAPI/Models/Database/ObjectType.cs | 15 + .../ReasnAPI/Models/Database/Parameter.cs | 13 + .../ReasnAPI/Models/Database/Participant.cs | 21 + .../ReasnAPI/Models/Database/ReasnContext.cs | 372 ++++++++++++++++++ .../ReasnAPI/ReasnAPI/Models/Database/Role.cs | 13 + .../ReasnAPI/Models/Database/Status.cs | 19 + .../ReasnAPI/ReasnAPI/Models/Database/Tag.cs | 11 + .../ReasnAPI/ReasnAPI/Models/Database/User.cs | 41 ++ .../ReasnAPI/Models/Database/UserInterest.cs | 15 + Server/ReasnAPI/ReasnAPI/appsettings.json | 2 +- 17 files changed, 664 insertions(+), 1 deletion(-) create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/EventParameter.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/EventTag.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/User.cs create mode 100644 Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs new file mode 100644 index 00000000..e7419ff9 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Address.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Address +{ + public int Id { get; set; } + + public string City { get; set; } = null!; + + public string Country { get; set; } = null!; + + public string Street { get; set; } = null!; + + public string State { get; set; } = null!; + + public string? ZipCode { get; set; } + + public virtual ICollection<Event> Events { get; set; } = new List<Event>(); + + public virtual ICollection<User> Users { get; set; } = new List<User>(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs new file mode 100644 index 00000000..2feb191a --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Comment.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Comment +{ + public int Id { get; set; } + + public int EventId { get; set; } + + public string Content { get; set; } = null!; + + public DateTime CreatedAt { get; set; } + + public int UserId { get; set; } + + public virtual Event Event { get; set; } = null!; + + public virtual User User { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs new file mode 100644 index 00000000..e8bceabc --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Event.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Event +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public int AddressId { get; set; } + + public string Description { get; set; } = null!; + + public int OrganizerId { get; set; } + + public DateTime StartAt { get; set; } + + public DateTime EndAt { get; set; } + + public DateTime CreatedAt { get; set; } + + public DateTime UpdatedAt { get; set; } + + public string Slug { get; set; } = null!; + + public int StatusId { get; set; } + + public virtual Address Address { get; set; } = null!; + + public virtual ICollection<Comment> Comments { get; set; } = new List<Comment>(); + + public virtual User Organizer { get; set; } = null!; + + public virtual ICollection<Participant> Participants { get; set; } = new List<Participant>(); + + public virtual Status Status { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/EventParameter.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/EventParameter.cs new file mode 100644 index 00000000..32fa03fc --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/EventParameter.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class EventParameter +{ + public int ParameterId { get; set; } + + public int EventId { get; set; } + + public virtual Event Event { get; set; } = null!; + + public virtual Parameter Parameter { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/EventTag.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/EventTag.cs new file mode 100644 index 00000000..e641f72d --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/EventTag.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class EventTag +{ + public int EventId { get; set; } + + public int TagId { get; set; } + + public virtual Event Event { get; set; } = null!; + + public virtual Tag Tag { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs new file mode 100644 index 00000000..0bf25075 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Image.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Image +{ + public int Id { get; set; } + + public byte[] ImageData { get; set; } = null!; + + public int ObjectTypeId { get; set; } + + public int ObjectId { get; set; } + + public virtual ObjectType ObjectType { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs new file mode 100644 index 00000000..56c89b91 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Interest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Interest +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public int Level { get; set; } +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs new file mode 100644 index 00000000..c02354eb --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/ObjectType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class ObjectType +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public virtual ICollection<Image> Images { get; set; } = new List<Image>(); + + public virtual ICollection<Status> Statuses { get; set; } = new List<Status>(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs new file mode 100644 index 00000000..f1d4d72a --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Parameter.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Parameter +{ + public int Id { get; set; } + + public string Key { get; set; } = null!; + + public string Value { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs new file mode 100644 index 00000000..3c867a77 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Participant.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Participant +{ + public int Id { get; set; } + + public int EventId { get; set; } + + public int UserId { get; set; } + + public int StatusId { get; set; } + + public virtual Event Event { get; set; } = null!; + + public virtual Status Status { get; set; } = null!; + + public virtual User User { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs new file mode 100644 index 00000000..aa4c646a --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/ReasnContext.cs @@ -0,0 +1,372 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace ReasnAPI.Models.Database; + +public partial class ReasnContext : DbContext +{ + public ReasnContext() + { + } + + public ReasnContext(DbContextOptions<ReasnContext> options) + : base(options) + { + } + + public virtual DbSet<Address> Addresses { get; set; } + + public virtual DbSet<Comment> Comments { get; set; } + + public virtual DbSet<Event> Events { get; set; } + + public virtual DbSet<EventParameter> EventParameters { get; set; } + + public virtual DbSet<EventTag> EventTags { get; set; } + + public virtual DbSet<Image> Images { get; set; } + + public virtual DbSet<Interest> Interests { get; set; } + + public virtual DbSet<ObjectType> ObjectTypes { get; set; } + + public virtual DbSet<Parameter> Parameters { get; set; } + + public virtual DbSet<Participant> Participants { get; set; } + + public virtual DbSet<Role> Roles { get; set; } + + public virtual DbSet<Status> Statuses { get; set; } + + public virtual DbSet<Tag> Tags { get; set; } + + public virtual DbSet<User> Users { get; set; } + + public virtual DbSet<UserInterest> UserInterests { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + => optionsBuilder.UseNpgsql("name=ConnectionStrings:DefaultValue"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity<Address>(entity => + { + entity.HasKey(e => e.Id).HasName("address_pkey"); + + entity.ToTable("address", "common"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.City) + .HasMaxLength(255) + .HasColumnName("city"); + entity.Property(e => e.Country) + .HasMaxLength(255) + .HasColumnName("country"); + entity.Property(e => e.State) + .HasMaxLength(255) + .HasColumnName("state"); + entity.Property(e => e.Street) + .HasMaxLength(255) + .HasColumnName("street"); + entity.Property(e => e.ZipCode) + .HasMaxLength(255) + .HasColumnName("zip_code"); + }); + + modelBuilder.Entity<Comment>(entity => + { + entity.HasKey(e => e.Id).HasName("comment_pkey"); + + entity.ToTable("comment", "events"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Content) + .HasMaxLength(255) + .HasColumnName("content"); + entity.Property(e => e.CreatedAt).HasColumnName("created_at"); + entity.Property(e => e.EventId).HasColumnName("event_id"); + entity.Property(e => e.UserId).HasColumnName("user_id"); + + entity.HasOne(d => d.Event).WithMany(p => p.Comments) + .HasForeignKey(d => d.EventId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("comment_event_id_fkey"); + + entity.HasOne(d => d.User).WithMany(p => p.Comments) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("comment_user_id_fkey"); + }); + + modelBuilder.Entity<Event>(entity => + { + entity.HasKey(e => e.Id).HasName("event_pkey"); + + entity.ToTable("event", "events"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.AddressId).HasColumnName("address_id"); + entity.Property(e => e.CreatedAt).HasColumnName("created_at"); + entity.Property(e => e.Description).HasColumnName("description"); + entity.Property(e => e.EndAt).HasColumnName("end_at"); + entity.Property(e => e.Name) + .HasColumnType("character varying") + .HasColumnName("name"); + entity.Property(e => e.OrganizerId).HasColumnName("organizer_id"); + entity.Property(e => e.Slug) + .HasColumnType("character varying") + .HasColumnName("slug"); + entity.Property(e => e.StartAt).HasColumnName("start_at"); + entity.Property(e => e.StatusId).HasColumnName("status_id"); + entity.Property(e => e.UpdatedAt).HasColumnName("updated_at"); + + entity.HasOne(d => d.Address).WithMany(p => p.Events) + .HasForeignKey(d => d.AddressId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_address_id_fkey"); + + entity.HasOne(d => d.Organizer).WithMany(p => p.Events) + .HasForeignKey(d => d.OrganizerId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_organizer_id_fkey"); + + entity.HasOne(d => d.Status).WithMany(p => p.Events) + .HasForeignKey(d => d.StatusId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_status_id_fkey"); + }); + + modelBuilder.Entity<EventParameter>(entity => + { + entity + .HasNoKey() + .ToTable("event_parameter", "events"); + + entity.Property(e => e.EventId).HasColumnName("event_id"); + entity.Property(e => e.ParameterId).HasColumnName("parameter_id"); + + entity.HasOne(d => d.Event).WithMany() + .HasForeignKey(d => d.EventId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_parameter_event_id_fkey"); + + entity.HasOne(d => d.Parameter).WithMany() + .HasForeignKey(d => d.ParameterId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_parameter_parameter_id_fkey"); + }); + + modelBuilder.Entity<EventTag>(entity => + { + entity + .HasNoKey() + .ToTable("event_tag", "events"); + + entity.Property(e => e.EventId).HasColumnName("event_id"); + entity.Property(e => e.TagId).HasColumnName("tag_id"); + + entity.HasOne(d => d.Event).WithMany() + .HasForeignKey(d => d.EventId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_tag_event_id_fkey"); + + entity.HasOne(d => d.Tag).WithMany() + .HasForeignKey(d => d.TagId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("event_tag_tag_id_fkey"); + }); + + modelBuilder.Entity<Image>(entity => + { + entity.HasKey(e => e.Id).HasName("image_pkey"); + + entity.ToTable("image", "common"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.ImageData).HasColumnName("image_data"); + entity.Property(e => e.ObjectId).HasColumnName("object_id"); + entity.Property(e => e.ObjectTypeId).HasColumnName("object_type_id"); + + entity.HasOne(d => d.ObjectType).WithMany(p => p.Images) + .HasForeignKey(d => d.ObjectTypeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("image_object_type_id_fkey"); + }); + + modelBuilder.Entity<Interest>(entity => + { + entity.HasKey(e => e.Id).HasName("interest_pkey"); + + entity.ToTable("interest", "users"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Level).HasColumnName("level"); + entity.Property(e => e.Name) + .HasMaxLength(255) + .HasColumnName("name"); + }); + + modelBuilder.Entity<ObjectType>(entity => + { + entity.HasKey(e => e.Id).HasName("object_type_pkey"); + + entity.ToTable("object_type", "common"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(255) + .HasColumnName("name"); + }); + + modelBuilder.Entity<Parameter>(entity => + { + entity.HasKey(e => e.Id).HasName("parameter_pkey"); + + entity.ToTable("parameter", "events"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Key) + .HasMaxLength(255) + .HasColumnName("key"); + entity.Property(e => e.Value) + .HasMaxLength(255) + .HasColumnName("value"); + }); + + modelBuilder.Entity<Participant>(entity => + { + entity.HasKey(e => e.Id).HasName("participant_pkey"); + + entity.ToTable("participant", "events"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.EventId).HasColumnName("event_id"); + entity.Property(e => e.StatusId).HasColumnName("status_id"); + entity.Property(e => e.UserId).HasColumnName("user_id"); + + entity.HasOne(d => d.Event).WithMany(p => p.Participants) + .HasForeignKey(d => d.EventId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("participant_event_id_fkey"); + + entity.HasOne(d => d.Status).WithMany(p => p.Participants) + .HasForeignKey(d => d.StatusId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("participant_status_id_fkey"); + + entity.HasOne(d => d.User).WithMany(p => p.Participants) + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("participant_user_id_fkey"); + }); + + modelBuilder.Entity<Role>(entity => + { + entity.HasKey(e => e.Id).HasName("role_pkey"); + + entity.ToTable("role", "users"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(255) + .HasColumnName("name"); + }); + + modelBuilder.Entity<Status>(entity => + { + entity.HasKey(e => e.Id).HasName("status_pkey"); + + entity.ToTable("status", "common"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(255) + .HasColumnName("name"); + entity.Property(e => e.ObjectTypeId).HasColumnName("object_type_id"); + + entity.HasOne(d => d.ObjectType).WithMany(p => p.Statuses) + .HasForeignKey(d => d.ObjectTypeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("status_object_type_id_fkey"); + }); + + modelBuilder.Entity<Tag>(entity => + { + entity.HasKey(e => e.Id).HasName("tag_pkey"); + + entity.ToTable("tag", "events"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(255) + .HasColumnName("name"); + }); + + modelBuilder.Entity<User>(entity => + { + entity.HasKey(e => e.Id).HasName("user_pkey"); + + entity.ToTable("user", "users"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.AddressId).HasColumnName("address_id"); + entity.Property(e => e.CreatedAt).HasColumnName("created_at"); + entity.Property(e => e.Email) + .HasMaxLength(255) + .HasColumnName("email"); + entity.Property(e => e.IsActive).HasColumnName("is_active"); + entity.Property(e => e.Name) + .HasMaxLength(255) + .HasColumnName("name"); + entity.Property(e => e.Password) + .HasMaxLength(255) + .HasColumnName("password"); + entity.Property(e => e.Phone) + .HasMaxLength(255) + .HasColumnName("phone"); + entity.Property(e => e.RoleId).HasColumnName("role_id"); + entity.Property(e => e.Surname) + .HasMaxLength(255) + .HasColumnName("surname"); + entity.Property(e => e.UpdatedAt).HasColumnName("updated_at"); + entity.Property(e => e.Username) + .HasMaxLength(255) + .HasColumnName("username"); + + entity.HasOne(d => d.Address).WithMany(p => p.Users) + .HasForeignKey(d => d.AddressId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_address_id_fkey"); + + entity.HasOne(d => d.Role).WithMany(p => p.Users) + .HasForeignKey(d => d.RoleId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_role_id_fkey"); + }); + + modelBuilder.Entity<UserInterest>(entity => + { + entity + .HasNoKey() + .ToTable("user_interest", "users"); + + entity.Property(e => e.InterestId).HasColumnName("interest_id"); + entity.Property(e => e.UserId).HasColumnName("user_id"); + + entity.HasOne(d => d.Interest).WithMany() + .HasForeignKey(d => d.InterestId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_interest_interest_id_fkey"); + + entity.HasOne(d => d.User).WithMany() + .HasForeignKey(d => d.UserId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("user_interest_user_id_fkey"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs new file mode 100644 index 00000000..a996e058 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Role.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Role +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public virtual ICollection<User> Users { get; set; } = new List<User>(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs new file mode 100644 index 00000000..9f5ad714 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Status.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Status +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public int ObjectTypeId { get; set; } + + public virtual ICollection<Event> Events { get; set; } = new List<Event>(); + + public virtual ObjectType ObjectType { get; set; } = null!; + + public virtual ICollection<Participant> Participants { get; set; } = new List<Participant>(); +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs new file mode 100644 index 00000000..d5f4981f --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/Tag.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class Tag +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/User.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/User.cs new file mode 100644 index 00000000..ed0c9345 --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/User.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class User +{ + public int Id { get; set; } + + public string Name { get; set; } = null!; + + public string Surname { get; set; } = null!; + + public string Username { get; set; } = null!; + + public string Password { get; set; } = null!; + + public DateTime CreatedAt { get; set; } + + public DateTime UpdatedAt { get; set; } + + public int RoleId { get; set; } + + public string Email { get; set; } = null!; + + public bool IsActive { get; set; } + + public int AddressId { get; set; } + + public string? Phone { get; set; } + + public virtual Address Address { get; set; } = null!; + + public virtual ICollection<Comment> Comments { get; set; } = new List<Comment>(); + + public virtual ICollection<Event> Events { get; set; } = new List<Event>(); + + public virtual ICollection<Participant> Participants { get; set; } = new List<Participant>(); + + public virtual Role Role { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs b/Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs new file mode 100644 index 00000000..7a41940e --- /dev/null +++ b/Server/ReasnAPI/ReasnAPI/Models/Database/UserInterest.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace ReasnAPI.Models.Database; + +public partial class UserInterest +{ + public int UserId { get; set; } + + public int InterestId { get; set; } + + public virtual Interest Interest { get; set; } = null!; + + public virtual User User { get; set; } = null!; +} diff --git a/Server/ReasnAPI/ReasnAPI/appsettings.json b/Server/ReasnAPI/ReasnAPI/appsettings.json index 41ddc4c5..de86dfdc 100644 --- a/Server/ReasnAPI/ReasnAPI/appsettings.json +++ b/Server/ReasnAPI/ReasnAPI/appsettings.json @@ -16,7 +16,7 @@ ] }, "ConnectionStrings": { - "DefaultValue": "Server=postgres;Port=5432;Database=Reasn;User Id=dba;Password=sql;" + "DefaultValue": "Server=localhost;Port=5432;Database=reasn;User Id=dba;Password=sql;" }, "AllowedHosts": "*" } From 031c3b643c7d782e50e5aa317f8bfd649a722659 Mon Sep 17 00:00:00 2001 From: rogacky11 <rogacky507@gmail.com> Date: Fri, 29 Mar 2024 01:12:01 +0100 Subject: [PATCH 8/9] added .gitattributes file to make autocrlf false --- .gitattributes.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes.txt diff --git a/.gitattributes.txt b/.gitattributes.txt new file mode 100644 index 00000000..5378fe08 --- /dev/null +++ b/.gitattributes.txt @@ -0,0 +1 @@ +* -text \ No newline at end of file From 47dab7b1fce14764c7bd12a124277884610d48f4 Mon Sep 17 00:00:00 2001 From: rogacky11 <rogacky507@gmail.com> Date: Fri, 29 Mar 2024 01:23:13 +0100 Subject: [PATCH 9/9] changed gitattributes file --- .gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes.txt b/.gitattributes.txt index 5378fe08..526c8a38 100644 --- a/.gitattributes.txt +++ b/.gitattributes.txt @@ -1 +1 @@ -* -text \ No newline at end of file +*.sh text eol=lf \ No newline at end of file