mirror of
https://github.com/Shchoholiev/shopping-assistant-api.git
synced 2025-04-12 01:48:49 +00:00
add database models, data transfer objects and mapper profiles
This commit is contained in:
parent
36d7193e15
commit
8b78292ce7
@ -0,0 +1,15 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using ShoppingAssistantApi.Application.Models.CreateDtos;
|
||||||
|
using ShoppingAssistantApi.Application.Models.Dtos;
|
||||||
|
using ShoppingAssistantApi.Domain.Entities;
|
||||||
|
|
||||||
|
namespace ShoppingAssistantApi.Application.MappingProfiles;
|
||||||
|
public class MessageProfile : Profile
|
||||||
|
{
|
||||||
|
public MessageProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Message, MessageDto>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<MessageCreateDto, Message>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using ShoppingAssistantApi.Application.Models.CreateDtos;
|
||||||
|
using ShoppingAssistantApi.Application.Models.Dtos;
|
||||||
|
using ShoppingAssistantApi.Domain.Entities;
|
||||||
|
|
||||||
|
namespace ShoppingAssistantApi.Application.MappingProfiles;
|
||||||
|
public class WishlistProfile : Profile
|
||||||
|
{
|
||||||
|
public WishlistProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Wishlist, WishlistDto>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<WishlistCreateDto, Wishlist>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
namespace ShoppingAssistantApi.Application.Models.CreateDtos;
|
||||||
|
|
||||||
|
public class MessageCreateDto
|
||||||
|
{
|
||||||
|
public required string Text { get; set; }
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace ShoppingAssistantApi.Application.Models.CreateDtos;
|
||||||
|
|
||||||
|
public class WishlistCreateDto
|
||||||
|
{
|
||||||
|
public required string Type { get; set; }
|
||||||
|
public required string FirstMessageText { get; set; }
|
||||||
|
}
|
11
ShoppingAssistantApi.Application/Models/Dtos/MessageDto.cs
Normal file
11
ShoppingAssistantApi.Application/Models/Dtos/MessageDto.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace ShoppingAssistantApi.Application.Models.Dtos;
|
||||||
|
|
||||||
|
public class MessageDto
|
||||||
|
{
|
||||||
|
public required string Id { get; set; }
|
||||||
|
|
||||||
|
public required string Text { get; set; }
|
||||||
|
public required string Role { get; set; }
|
||||||
|
|
||||||
|
public string? CreatedById { get; set; } = null;
|
||||||
|
}
|
11
ShoppingAssistantApi.Application/Models/Dtos/WishlistDto.cs
Normal file
11
ShoppingAssistantApi.Application/Models/Dtos/WishlistDto.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace ShoppingAssistantApi.Application.Models.Dtos;
|
||||||
|
|
||||||
|
public class WishlistDto
|
||||||
|
{
|
||||||
|
public required string Id { get; set; }
|
||||||
|
|
||||||
|
public required string Name { get; set; }
|
||||||
|
public required string Type { get; set; }
|
||||||
|
|
||||||
|
public string CreatedById { get; set; } = null!;
|
||||||
|
}
|
12
ShoppingAssistantApi.Domain/Entities/Message.cs
Normal file
12
ShoppingAssistantApi.Domain/Entities/Message.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using MongoDB.Bson;
|
||||||
|
using ShoppingAssistantApi.Domain.Common;
|
||||||
|
|
||||||
|
namespace ShoppingAssistantApi.Domain.Entities;
|
||||||
|
|
||||||
|
public class Message : EntityBase
|
||||||
|
{
|
||||||
|
public required string Text { get; set; }
|
||||||
|
public required string Role { get; set; }
|
||||||
|
|
||||||
|
public ObjectId? WishlistId { get; set; } = null;
|
||||||
|
}
|
13
ShoppingAssistantApi.Domain/Entities/Wishlist.cs
Normal file
13
ShoppingAssistantApi.Domain/Entities/Wishlist.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using MongoDB.Bson;
|
||||||
|
using ShoppingAssistantApi.Domain.Common;
|
||||||
|
|
||||||
|
namespace ShoppingAssistantApi.Domain.Entities;
|
||||||
|
|
||||||
|
public class Wishlist : EntityBase
|
||||||
|
{
|
||||||
|
public required string Name { get; set; }
|
||||||
|
public required string Type { get; set; }
|
||||||
|
public ICollection<Message>? Messages { get; set; } = null;
|
||||||
|
|
||||||
|
public required ObjectId UserId { get; set; }
|
||||||
|
}
|
7
ShoppingAssistantApi.Domain/Enums/MessageRoles.cs
Normal file
7
ShoppingAssistantApi.Domain/Enums/MessageRoles.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace ShoppingAssistantApi.Domain.Enums;
|
||||||
|
|
||||||
|
public enum MessageRoles
|
||||||
|
{
|
||||||
|
User = 0,
|
||||||
|
Application = 0
|
||||||
|
}
|
7
ShoppingAssistantApi.Domain/Enums/WishlistTypes.cs
Normal file
7
ShoppingAssistantApi.Domain/Enums/WishlistTypes.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace ShoppingAssistantApi.Domain.Enums;
|
||||||
|
|
||||||
|
public enum WishlistTypes
|
||||||
|
{
|
||||||
|
Product = 0,
|
||||||
|
Gift = 1
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user