(feature): ci/cd init
This commit is contained in:
parent
e603ff41a1
commit
abbbcac220
22
.gitlab-ci.yml
Normal file
22
.gitlab-ci.yml
Normal file
@ -0,0 +1,22 @@
|
||||
image: docker:stable
|
||||
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
before_script:
|
||||
- docker info
|
||||
|
||||
build:
|
||||
only:
|
||||
- master
|
||||
before_script:
|
||||
- docker login hcr0002.corp.maks-it.com -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD}
|
||||
script:
|
||||
# weatherforecast
|
||||
- docker build ./src/ -f ./src/WeatherForecast/Dockerfile -t ${CI_REGISTRY}/weatherforecast:latest
|
||||
- docker push ${CI_REGISTRY}/weatherforecast:latest
|
||||
after_script:
|
||||
- docker logout ${CI_REGISTRY}
|
||||
stage: build
|
||||
tags:
|
||||
- docker
|
||||
@ -1,6 +1,5 @@
|
||||
{
|
||||
"_id": "b3f39a82-6a1b-46a4-85cc-04c3b4315511",
|
||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||
"_id": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||
|
||||
"l10n": [
|
||||
{
|
||||
@ -14,6 +13,131 @@
|
||||
"currency": "EUR",
|
||||
"currencySymbol": "€"
|
||||
},
|
||||
|
||||
|
||||
"header": {
|
||||
"title": "{siteName}",
|
||||
"meta": {
|
||||
"chartset": "utf-8",
|
||||
"google-site-verification": "",
|
||||
"description": "Single-page application home page"
|
||||
},
|
||||
"link": {
|
||||
"canonical": "{siteUrl}"
|
||||
}
|
||||
},
|
||||
|
||||
"routes": [
|
||||
{
|
||||
"target": "/",
|
||||
"component": "Home"
|
||||
},
|
||||
{
|
||||
"target": "/home",
|
||||
"component": "Home"
|
||||
},
|
||||
{
|
||||
"target": "/shop",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": "",
|
||||
"component": "ShopCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"component": "ShopCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": ":slug",
|
||||
"component": "ShopItem"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "cart",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": "",
|
||||
"component": "Cart"
|
||||
},
|
||||
{
|
||||
"target": "checkout",
|
||||
"component": "Checkout"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/blog",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": "",
|
||||
"component": "BlogCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"component": "BlogCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": ":slug",
|
||||
"component": "BlogItem"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"adminRoutes": [],
|
||||
"serviceRoutes": [
|
||||
{
|
||||
"target": "/signin",
|
||||
"component": "Signin"
|
||||
},
|
||||
{
|
||||
"target": "/signup",
|
||||
"component": "Signup"
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
"topMenu": [
|
||||
{
|
||||
"target": "/",
|
||||
"title": "Home"
|
||||
},
|
||||
{
|
||||
"target": "/shop",
|
||||
"title": "Shop"
|
||||
},
|
||||
{
|
||||
"target": "/blog",
|
||||
"title": "Blog"
|
||||
},
|
||||
{
|
||||
"target": "/signin",
|
||||
"title": "Sign in"
|
||||
},
|
||||
{
|
||||
"target": "/signup",
|
||||
"title": "Sign up"
|
||||
},
|
||||
{
|
||||
"target": "/shop/cart",
|
||||
"icon": "shopping-cart",
|
||||
"title": "Cart ({quantity})"
|
||||
|
||||
}
|
||||
],
|
||||
"sideMenu": [],
|
||||
|
||||
|
||||
"homePage": {
|
||||
"header": {
|
||||
"title": "Home - {siteName}",
|
||||
@ -379,155 +503,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"header": {
|
||||
"title": "{siteName}",
|
||||
"meta": {
|
||||
"chartset": "utf-8",
|
||||
"google-site-verification": "",
|
||||
"description": "Single-page application home page"
|
||||
},
|
||||
"link": {
|
||||
"canonical": "{siteUrl}"
|
||||
}
|
||||
},
|
||||
|
||||
"routes": [
|
||||
{
|
||||
"target": "/",
|
||||
"component": "Home"
|
||||
},
|
||||
{
|
||||
"target": "/home",
|
||||
"component": "Home"
|
||||
},
|
||||
{
|
||||
"target": "/shop",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": "",
|
||||
"component": "ShopCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"component": "ShopCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": ":slug",
|
||||
"component": "ShopItem"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "cart",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": "",
|
||||
"component": "Cart"
|
||||
},
|
||||
{
|
||||
"target": "checkout",
|
||||
"component": "Checkout"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/blog",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": "",
|
||||
"component": "BlogCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"component": "BlogCatalog"
|
||||
},
|
||||
{
|
||||
"target": ":page",
|
||||
"childRoutes": [
|
||||
{
|
||||
"target": ":slug",
|
||||
"component": "BlogItem"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"adminRoutes": [],
|
||||
"serviceRoutes": [
|
||||
{
|
||||
"target": "/signin",
|
||||
"component": "Signin"
|
||||
},
|
||||
{
|
||||
"target": "/signup",
|
||||
"component": "Signup"
|
||||
}
|
||||
],
|
||||
"topMenu": [
|
||||
{
|
||||
"target": "/",
|
||||
"l10n": [
|
||||
{
|
||||
"locale": 0,
|
||||
"title": "Home"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/shop",
|
||||
"l10n": [
|
||||
{
|
||||
"locale": 0,
|
||||
"title": "Shop"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/blog",
|
||||
"l10n": [
|
||||
{
|
||||
"locale": 0,
|
||||
"title": "Blog"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/signin",
|
||||
"l10n": [
|
||||
{
|
||||
"locale": 0,
|
||||
"title": "Sign in"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/signup",
|
||||
"l10n": [
|
||||
{
|
||||
"locale": 0,
|
||||
"title": "Sign up"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "/shop/cart",
|
||||
"icon": "shopping-cart",
|
||||
"l10n": [
|
||||
{
|
||||
"locale": 0,
|
||||
"title": "Cart ({quantity})"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"sideMenu": []
|
||||
|
||||
]
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
BROWSER=none
|
||||
|
||||
REACT_APP_LOCAL_ONLY=Y
|
||||
REACT_APP_LOCAL_ONLY=N
|
||||
|
||||
REACT_APP_FRONTEND=https://localhost:7174
|
||||
REACT_APP_API=https://reverseproxy:7174/api
|
||||
REACT_APP_API=https://localhost:7174/api
|
||||
|
||||
REACT_APP_SITEID=404c8232-9048-4519-bfba-6e78dc7005ca
|
||||
REACT_APP_LOCALE=en-US
|
||||
|
||||
@ -5,7 +5,7 @@ import { Route, Routes, useLocation } from 'react-router'
|
||||
// Redux
|
||||
import { useSelector, useDispatch } from 'react-redux'
|
||||
import type {} from 'redux-thunk/extend-redux'
|
||||
import { actionCreators as settingsActionCreators } from './store/reducers/Content'
|
||||
import { actionCreators as contentActionCreators } from './store/reducers/Content'
|
||||
|
||||
|
||||
// Components
|
||||
@ -86,7 +86,7 @@ const App = () => {
|
||||
const { content, header } = useSelector((state: ApplicationState) => state)
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(settingsActionCreators.requestContent())
|
||||
dispatch(contentActionCreators.requestContent())
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -547,12 +547,19 @@ export const actionCreators = {
|
||||
requestContent: (props?: IGetContentRequestModel): AppThunkAction<KnownAction> => (dispatch, getState) => {
|
||||
dispatch({ type: 'REQUEST_CONTENT' })
|
||||
|
||||
|
||||
if(process.env.REACT_APP_LOCAL_ONLY == 'Y') {
|
||||
dispatch({ type: 'RECEIVE_CONTENT', ...cloneObject(mockData) })
|
||||
return
|
||||
}
|
||||
|
||||
Get<Promise<IGetContentResponseModel>>(`${process.env.REACT_APP_API}/${process.env.REACT_APP_CONTENT}/${process.env.REACT_APP_SITEID}`, props?.pathParams, props?.searchParams)
|
||||
const siteId = process.env.REACT_APP_SITEID
|
||||
const pathParams = { ...props?.pathParams, siteId }
|
||||
|
||||
const locale = process.env.REACT_APP_LOCALE
|
||||
const searchParams = { ...props?.searchParams, locale }
|
||||
|
||||
Get<Promise<IGetContentResponseModel>>(`${process.env.REACT_APP_API}/${process.env.REACT_APP_CONTENT}`, pathParams, searchParams)
|
||||
.then(response => response)
|
||||
.then((data) => {
|
||||
if(data) {
|
||||
|
||||
@ -4,14 +4,14 @@ using DomainResults.Common;
|
||||
|
||||
using MongoDB.Bson.Serialization;
|
||||
using MongoDB.Driver;
|
||||
using DomainObjects.Documents;
|
||||
using DataProviders.Collections.Abstractions;
|
||||
using DomainObjects.Documents.Content;
|
||||
|
||||
namespace DataProviders.Collections
|
||||
{
|
||||
|
||||
public interface IContentDataProvider {
|
||||
(List<ContentDocument>?, IDomainResult) Get(Guid siteId);
|
||||
(ContentDocument?, IDomainResult) Get(Guid siteId);
|
||||
}
|
||||
|
||||
public class ContentDataProvider : CollectionDataProviderBase<ContentDocument>, IContentDataProvider {
|
||||
@ -25,6 +25,13 @@ namespace DataProviders.Collections
|
||||
ISessionService sessionService) : base(logger, client, idGenerator, sessionService, _databaseName, _collectionName) {
|
||||
}
|
||||
|
||||
public (List<ContentDocument>?, IDomainResult) Get(Guid siteId) => GetWithPredicate(x => x.SiteId == siteId, x => x);
|
||||
public (ContentDocument?, IDomainResult) Get(Guid siteId) {
|
||||
var (list, result) = GetWithPredicate(x => x.Id == siteId, x => x);
|
||||
|
||||
if (!result.IsSuccess || list == null)
|
||||
return (null, result);
|
||||
|
||||
return (list.First(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,10 @@ using DomainObjects.Documents.Sites;
|
||||
using DomainObjects.Documents.Categories;
|
||||
using DomainObjects.Documents.Categories.L10n;
|
||||
using DomainObjects.Documents.Posts;
|
||||
using DomainObjects.Documents.Content;
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
using DomainObjects.Documents.Content.L10n;
|
||||
using Core.Enumerations;
|
||||
|
||||
namespace DataProviders
|
||||
{
|
||||
@ -32,19 +36,8 @@ namespace DataProviders
|
||||
// https://kevsoft.net/2020/07/02/how-to-store-decimal-fields-in-mongodb-with-csharp.html
|
||||
BsonSerializer.RegisterSerializer(new DecimalSerializer(BsonType.Decimal128));
|
||||
|
||||
#region L10n
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(PostItemL10n))) {
|
||||
BsonClassMap.RegisterClassMap<PostItemL10n>(cm => {
|
||||
cm.AutoMap();
|
||||
|
||||
cm.GetMemberMap(c => c.Locale)
|
||||
.SetSerializer(new EnumerationSerializer<Locales>());
|
||||
|
||||
cm.GetMemberMap(c => c.TextFormat)
|
||||
.SetSerializer(new EnumerationSerializer<TextFormat>());
|
||||
});
|
||||
}
|
||||
|
||||
#region MediaAttachments
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(MediaAttachmentL10n))) {
|
||||
BsonClassMap.RegisterClassMap<MediaAttachmentL10n>(cm => {
|
||||
cm.AutoMap();
|
||||
@ -54,6 +47,21 @@ namespace DataProviders
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(MediaAttachment))) {
|
||||
BsonClassMap.RegisterClassMap<MediaAttachment>(cm => {
|
||||
cm.AutoMap();
|
||||
|
||||
cm.GetMemberMap(c => c.MediaType)
|
||||
.SetSerializer(new EnumerationSerializer<MediaTypes>());
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region L10n
|
||||
|
||||
|
||||
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(CategoryL10n))) {
|
||||
BsonClassMap.RegisterClassMap<CategoryL10n>(cm => {
|
||||
cm.AutoMap();
|
||||
@ -118,14 +126,7 @@ namespace DataProviders
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Localization))) {
|
||||
BsonClassMap.RegisterClassMap<Localization>(cm => {
|
||||
cm.AutoMap();
|
||||
|
||||
cm.GetMemberMap(c => c.Locale)
|
||||
.SetSerializer(new EnumerationSerializer<Locales>());
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(MenuItem))) {
|
||||
BsonClassMap.RegisterClassMap<MenuItem>(cm => {
|
||||
@ -158,15 +159,25 @@ namespace DataProviders
|
||||
#endregion
|
||||
|
||||
|
||||
#region BlogItem
|
||||
#region Blog and Shop item
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(PostItemL10n))) {
|
||||
BsonClassMap.RegisterClassMap<PostItemL10n>(cm => {
|
||||
cm.AutoMap();
|
||||
|
||||
cm.GetMemberMap(c => c.Locale)
|
||||
.SetSerializer(new EnumerationSerializer<Locales>());
|
||||
|
||||
cm.GetMemberMap(c => c.TextFormat)
|
||||
.SetSerializer(new EnumerationSerializer<TextFormat>());
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BlogDocument))) {
|
||||
BsonClassMap.RegisterClassMap<BlogDocument>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ShopItem
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopDocument))) {
|
||||
BsonClassMap.RegisterClassMap<ShopDocument>(cm => {
|
||||
cm.AutoMap();
|
||||
@ -331,6 +342,21 @@ namespace DataProviders
|
||||
|
||||
|
||||
#region Content
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Settings))) {
|
||||
BsonClassMap.RegisterClassMap<Settings>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ContentL10n))) {
|
||||
BsonClassMap.RegisterClassMap<ContentL10n>(cm => {
|
||||
cm.AutoMap();
|
||||
|
||||
cm.GetMemberMap(c => c.Locale)
|
||||
.SetSerializer(new EnumerationSerializer<Locales>());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ContentDocument))) {
|
||||
BsonClassMap.RegisterClassMap<ContentDocument>(cm => {
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
using DomainObjects.L10n;
|
||||
|
||||
namespace DomainObjects.Abstractions;
|
||||
|
||||
public abstract class PostItemBase<T> : DomainObjectDocumentBase<T> {
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public List<PostItemL10n> L10n { get; set; }
|
||||
|
||||
public List<MediaAttachment>? MediaAttachments { get; set; }
|
||||
|
||||
public Guid Author { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
public DateTime? Published { get; set; }
|
||||
|
||||
|
||||
public List<string>? Tags { get; set; }
|
||||
|
||||
public List<Guid> Categories { get; set; }
|
||||
|
||||
public bool? FamilyFriendly { get; set; }
|
||||
}
|
||||
37
src/DomainObjects/Abstractions/Posts/L10n/PostItemL10n.cs
Normal file
37
src/DomainObjects/Abstractions/Posts/L10n/PostItemL10n.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using DomainObjects.Enumerations;
|
||||
|
||||
namespace DomainObjects.Abstractions.Posts.L10n;
|
||||
|
||||
public class PostItemL10n : DomainObjectBase<PostItemL10n> {
|
||||
public Locales Locale { get; set; }
|
||||
public string Slug { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Text { get; set; }
|
||||
public TextFormat TextFormat { get; set; }
|
||||
public string PlainText { get; set; }
|
||||
public string ShortText { get; set; }
|
||||
public List<string>? Badges { get; set; }
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
int hash = 17;
|
||||
|
||||
hash = hash * 23 + Locale.GetHashCode();
|
||||
hash = hash * 23 + Slug.GetHashCode();
|
||||
hash = hash * 23 + Description.GetHashCode();
|
||||
hash = hash * 23 + Title.GetHashCode();
|
||||
hash = hash * 23 + Text.GetHashCode();
|
||||
hash = hash * 23 + TextFormat.GetHashCode();
|
||||
hash = hash * 23 + ShortText.GetHashCode();
|
||||
|
||||
if (Badges != null)
|
||||
hash = hash * 23 + Badges.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
src/DomainObjects/Abstractions/Posts/PostItemBase.cs
Normal file
25
src/DomainObjects/Abstractions/Posts/PostItemBase.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
|
||||
namespace DomainObjects.Abstractions.Posts;
|
||||
|
||||
public abstract class PostItemBase<T> : DomainObjectDocumentBase<T> {
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public List<PostItemL10n> L10n { get; set; }
|
||||
|
||||
public List<MediaAttachment>? MediaAttachments { get; set; }
|
||||
|
||||
public Guid Author { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
public DateTime? Published { get; set; }
|
||||
|
||||
|
||||
public List<string>? Tags { get; set; }
|
||||
|
||||
public List<Guid> Categories { get; set; }
|
||||
|
||||
public bool? FamilyFriendly { get; set; }
|
||||
}
|
||||
13
src/DomainObjects/Documents/Content/ContentDocument.cs
Normal file
13
src/DomainObjects/Documents/Content/ContentDocument.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using DomainObjects.Abstractions;
|
||||
using DomainObjects.Documents.Content.L10n;
|
||||
|
||||
namespace DomainObjects.Documents.Content;
|
||||
|
||||
public class ContentDocument : DomainObjectDocumentBase<ContentDocument> {
|
||||
public List<ContentL10n> L10n { get; set; }
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
41
src/DomainObjects/Documents/Content/L10n/ContentL10n.cs
Normal file
41
src/DomainObjects/Documents/Content/L10n/ContentL10n.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using DomainObjects.Enumerations;
|
||||
using DomainObjects.Pages;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DomainObjects.Documents.Content.L10n {
|
||||
public class ContentL10n {
|
||||
public Locales Locale { get; set; }
|
||||
|
||||
public string SiteName { get; set; }
|
||||
public string SiteUrl { get; set; }
|
||||
|
||||
public Header Header { get; set; }
|
||||
|
||||
public Settings Settings { get; set; }
|
||||
|
||||
public List<Route> Routes { get; set; }
|
||||
public List<Route> AdminRoutes { get; set; }
|
||||
public List<Route> ServiceRoutes { get; set; }
|
||||
|
||||
public List<MenuItem> TopMenu { get; set; }
|
||||
public List<MenuItem> SideMenu { get; set; }
|
||||
|
||||
public HomePage HomePage { get; set; }
|
||||
|
||||
public ShopCatalogPage ShopCatalog { get; set; }
|
||||
public ShopItemPage ShopItem { get; set; }
|
||||
public ShopCartPage ShopCart { get; set; }
|
||||
public ShopCheckoutPage ShopCheckout { get; set; }
|
||||
|
||||
|
||||
public BlogCatalogPage BlogCatalog { get; set; }
|
||||
public BlogItemPage BlogItem { get; set; }
|
||||
|
||||
public SignInPage SignIn { get; set; }
|
||||
public SignUpPage SignUp { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
using DomainObjects.Abstractions;
|
||||
using DomainObjects.Pages;
|
||||
|
||||
namespace DomainObjects.Documents;
|
||||
|
||||
public class ContentDocument : DomainObjectDocumentBase<ContentDocument> {
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public string SiteName { get; set; }
|
||||
public string SiteUrl { get; set; }
|
||||
|
||||
public Header Header { get; set; }
|
||||
|
||||
public Localization Localization { get; set; }
|
||||
|
||||
public List<Route> Routes { get; set; }
|
||||
public List<Route> AdminRoutes { get; set; }
|
||||
public List<Route> ServiceRoutes { get; set; }
|
||||
|
||||
public List<MenuItem> TopMenu { get; set; }
|
||||
public List<MenuItem> SideMenu { get; set; }
|
||||
|
||||
public HomePage HomePage { get; set; }
|
||||
|
||||
public ShopCatalogPage ShopCatalog { get; set; }
|
||||
public ShopItemPage ShopItem { get; set; }
|
||||
public ShopCartPage ShopCart { get; set; }
|
||||
public ShopCheckoutPage ShopCheckout { get; set; }
|
||||
|
||||
|
||||
public BlogCatalogPage BlogCatalog { get; set; }
|
||||
public BlogItemPage BlogItem { get; set; }
|
||||
|
||||
public SignInPage SignIn { get; set; }
|
||||
public SignUpPage SignUp { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using DomainObjects.Abstractions;
|
||||
using DomainObjects.Abstractions.Posts;
|
||||
|
||||
namespace DomainObjects.Documents.Posts;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using DomainObjects.Abstractions;
|
||||
using DomainObjects.Abstractions.Posts;
|
||||
|
||||
namespace DomainObjects.Documents.Posts;
|
||||
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
using DomainObjects.Abstractions;
|
||||
using DomainObjects.Enumerations;
|
||||
|
||||
namespace DomainObjects.L10n;
|
||||
|
||||
public class PostItemL10n : DomainObjectBase<PostItemL10n> {
|
||||
public Locales Locale { get; set; }
|
||||
public string Slug { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Text { get; set; }
|
||||
public TextFormat TextFormat { get; set; }
|
||||
public string PlainText { get; set; }
|
||||
public string ShortText { get; set; }
|
||||
public List<string>? Badges { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
unchecked {
|
||||
int hash = 17;
|
||||
|
||||
hash = hash * 23 + Locale.GetHashCode();
|
||||
hash = hash * 23 + Slug.GetHashCode();
|
||||
hash = hash * 23 + Description.GetHashCode();
|
||||
hash = hash * 23 + Title.GetHashCode();
|
||||
hash = hash * 23 + Text.GetHashCode();
|
||||
hash = hash * 23 + TextFormat.GetHashCode();
|
||||
hash = hash * 23 + ShortText.GetHashCode();
|
||||
|
||||
if(Badges != null)
|
||||
hash = hash * 23 + Badges.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,12 +3,10 @@ using DomainObjects.Enumerations;
|
||||
|
||||
namespace DomainObjects;
|
||||
|
||||
public class Localization : DomainObjectBase<Localization> {
|
||||
public class Settings : DomainObjectBase<Settings> {
|
||||
|
||||
public string? TimeZone { get; set; }
|
||||
|
||||
public Locales Locale { get; set; }
|
||||
|
||||
public string? DateFormat { get; set; }
|
||||
|
||||
public string? TimeFormat { get; set; }
|
||||
@ -7,6 +7,7 @@ using DomainObjects;
|
||||
|
||||
using Core.Enumerations;
|
||||
using Core.Abstractions.Models;
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
|
||||
namespace WeatherForecast.Models.Blog.Requests {
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
using DomainObjects.Documents.Posts;
|
||||
using DomainObjects.Enumerations;
|
||||
using DomainObjects.L10n;
|
||||
@ -8,6 +9,7 @@ using DomainObjects;
|
||||
using Core.Enumerations;
|
||||
using Core.Abstractions.Models;
|
||||
|
||||
|
||||
namespace WeatherForecast.Models.Blog.Requests {
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -8,14 +8,16 @@ using DomainObjects.Documents.Posts;
|
||||
using DomainObjects.Documents.Users;
|
||||
using DomainObjects.Documents.Categories;
|
||||
using DomainObjects.Documents.Categories.L10n;
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
|
||||
namespace WeatherForecast.Models.Blog.Responses {
|
||||
namespace WeatherForecast.Models.Blog.Responses
|
||||
{
|
||||
|
||||
#region Media attachment
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GetBlogItemMediaAttachmentL10nResponseModel : ResponseModelBase {
|
||||
#region Media attachment
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GetBlogItemMediaAttachmentL10nResponseModel : ResponseModelBase {
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Core.Abstractions.Models;
|
||||
using Amazon.Runtime.Internal;
|
||||
using Core.Abstractions.Models;
|
||||
using DomainObjects;
|
||||
using DomainObjects.Documents;
|
||||
using DomainObjects.Documents.Content;
|
||||
using DomainObjects.Enumerations;
|
||||
using WeatherForecast.Models.Content.Responses.Pages;
|
||||
|
||||
@ -10,18 +11,13 @@ namespace WeatherForecast.Models.Content.Responses
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LocalizationModel {
|
||||
public class SettingsModel {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string? TimeZone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public Locales? Locale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -47,9 +43,8 @@ namespace WeatherForecast.Models.Content.Responses
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localization"></param>
|
||||
public LocalizationModel(Localization localization) {
|
||||
public SettingsModel(Settings localization) {
|
||||
TimeZone = localization.TimeZone;
|
||||
Locale = localization.Locale;
|
||||
DateFormat = localization.DateFormat;
|
||||
TimeFormat = localization.TimeFormat;
|
||||
Currency = localization.Currency;
|
||||
@ -80,7 +75,7 @@ namespace WeatherForecast.Models.Content.Responses
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public LocalizationModel Localization { get; set; }
|
||||
public SettingsModel Settings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -156,33 +151,37 @@ namespace WeatherForecast.Models.Content.Responses
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="domainObject"></param>
|
||||
public GetContentResponseModel(ContentDocument domainObject) {
|
||||
/// <param name="locale"></param>
|
||||
public GetContentResponseModel(ContentDocument domainObject, Locales locale) {
|
||||
|
||||
SiteName = domainObject.SiteName;
|
||||
SiteUrl = domainObject.SiteUrl;
|
||||
var l10n = domainObject.L10n.Single(x => x.Locale == locale);
|
||||
|
||||
Header = new HeaderModel(domainObject.Header);
|
||||
Localization = new LocalizationModel(domainObject.Localization);
|
||||
|
||||
Routes = domainObject.Routes.Select(x => new RouteModel(x)).ToList();
|
||||
AdminRoutes = domainObject.AdminRoutes.Select(x => new RouteModel(x)).ToList();
|
||||
ServiceRoutes = domainObject.ServiceRoutes.Select(x => new RouteModel(x)).ToList();
|
||||
SiteName = l10n.SiteName;
|
||||
SiteUrl = l10n.SiteUrl;
|
||||
|
||||
TopMenu = domainObject.TopMenu.Select(x => new MenuItemModel(x)).ToList();
|
||||
SideMenu = domainObject.SideMenu.Select(x => new MenuItemModel(x)).ToList();
|
||||
Header = new HeaderModel(l10n.Header);
|
||||
Settings = new SettingsModel(l10n.Settings);
|
||||
|
||||
HomePage = new HomePageModel(domainObject.HomePage);
|
||||
Routes = l10n.Routes.Select(x => new RouteModel(x)).ToList();
|
||||
AdminRoutes = l10n.AdminRoutes.Select(x => new RouteModel(x)).ToList();
|
||||
ServiceRoutes = l10n.ServiceRoutes.Select(x => new RouteModel(x)).ToList();
|
||||
|
||||
ShopCatalog = new ShopCatalogPageModel(domainObject.ShopCatalog);
|
||||
ShopItem = new ShopItemPageModel(domainObject.ShopItem);
|
||||
ShopCart = new ShopCartPageModel(domainObject.ShopCart);
|
||||
ShopCheckout = new ShopCheckoutPageModel(domainObject.ShopCheckout);
|
||||
TopMenu = l10n.TopMenu.Select(x => new MenuItemModel(x)).ToList();
|
||||
SideMenu = l10n.SideMenu.Select(x => new MenuItemModel(x)).ToList();
|
||||
|
||||
BlogCatalog = new BlogCatalogPageModel(domainObject.BlogCatalog);
|
||||
BlogItem = new BlogItemPageModel(domainObject.BlogItem);
|
||||
HomePage = new HomePageModel(l10n.HomePage);
|
||||
|
||||
SignIn = new SignInPageModel(domainObject.SignIn);
|
||||
SignUp = new SignUpPageModel(domainObject.SignUp);
|
||||
ShopCatalog = new ShopCatalogPageModel(l10n.ShopCatalog);
|
||||
ShopItem = new ShopItemPageModel(l10n.ShopItem);
|
||||
ShopCart = new ShopCartPageModel(l10n.ShopCart);
|
||||
ShopCheckout = new ShopCheckoutPageModel(l10n.ShopCheckout);
|
||||
|
||||
BlogCatalog = new BlogCatalogPageModel(l10n.BlogCatalog);
|
||||
BlogItem = new BlogItemPageModel(l10n.BlogItem);
|
||||
|
||||
SignIn = new SignInPageModel(l10n.SignIn);
|
||||
SignUp = new SignUpPageModel(l10n.SignUp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ using DomainObjects;
|
||||
|
||||
using Core.Enumerations;
|
||||
using Core.Abstractions.Models;
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
|
||||
namespace WeatherForecast.Models.Requests {
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ using Core.Enumerations;
|
||||
using Core.Abstractions.Models;
|
||||
using Core.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
|
||||
namespace WeatherForecast.Models.Requests {
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Core.Abstractions.Models;
|
||||
using Core.Enumerations;
|
||||
using DomainObjects;
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
using DomainObjects.Documents.Categories;
|
||||
using DomainObjects.Documents.Categories.L10n;
|
||||
using DomainObjects.Documents.Posts;
|
||||
@ -11,13 +12,14 @@ using DomainObjects.L10n;
|
||||
|
||||
using WeatherForecast.Models.Blog.Responses;
|
||||
|
||||
namespace WeatherForecast.Models.Shop.Responses {
|
||||
namespace WeatherForecast.Models.Shop.Responses
|
||||
{
|
||||
|
||||
#region Media attachment
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GetShopItemMediaAttachmentL10nResponseModel {
|
||||
#region Media attachment
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GetShopItemMediaAttachmentL10nResponseModel {
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
using Core.Abstractions.Models;
|
||||
using Core.Enumerations;
|
||||
using DomainObjects;
|
||||
using DomainObjects.Abstractions.Posts.L10n;
|
||||
using DomainObjects.Documents;
|
||||
using DomainObjects.Documents.Posts;
|
||||
using DomainObjects.Enumerations;
|
||||
using DomainObjects.L10n;
|
||||
|
||||
namespace WeatherForecast.Models.ShopCart.Responses {
|
||||
namespace WeatherForecast.Models.ShopCart.Responses
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GetShopCartItemMediaAttachmentL10nModel : ResponseModelBase {
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GetShopCartItemMediaAttachmentL10nModel : ResponseModelBase {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
@ -52,7 +52,8 @@ namespace WeatherForecast.Services {
|
||||
if (!result.IsSuccess || content == null)
|
||||
return (null, result);
|
||||
|
||||
return IDomainResult.Success(new GetContentResponseModel(content.Single(x => x.Localization.Locale == requestData.Locale)));
|
||||
|
||||
return IDomainResult.Success(new GetContentResponseModel(content, requestData.Locale));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +170,8 @@ namespace WeatherForecast.Services {
|
||||
if (!getContentResult.IsSuccess || content == null)
|
||||
return IDomainResult.Failed<GetImageResponseModel?>();
|
||||
|
||||
var (image, transformResult) = _imageProvider.ResizeAndWatermark(file.Bytes, width, height, FontsEnum.Montserrat, FontStylesEnum.Regular, content.First().SiteName);
|
||||
// TODO: Get site name
|
||||
var (image, transformResult) = _imageProvider.ResizeAndWatermark(file.Bytes, width, height, FontsEnum.Montserrat, FontStylesEnum.Regular, "TODO");
|
||||
if (!transformResult.IsSuccess || image == null)
|
||||
return IDomainResult.Failed<GetImageResponseModel?>();
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ services:
|
||||
image: mongo
|
||||
restart: always
|
||||
ports:
|
||||
- 27018:27017
|
||||
- 27017:27017
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: example
|
||||
|
||||
@ -3,4 +3,4 @@ WiredTiger 10.0.2: (December 21, 2021)
|
||||
WiredTiger version
|
||||
major=10,minor=0,patch=2
|
||||
file:WiredTiger.wt
|
||||
access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=0),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.128176=(addr="018381e4ba16d6a78481e491b9ee468581e4a61a442c808080e302cfc0e3010fc0",order=128176,time=1685120283,size=81920,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=12,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=385381,run_write_gen=385369)),checkpoint_backup_info=,checkpoint_lsn=(95,7552)
|
||||
access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=0),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.129073=(addr="018081e4e7b10cf78181e4228ff9ae8281e4cb791c0e808080e3028fc0e3010fc0",order=129073,time=1685215510,size=81920,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=270,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=388099,run_write_gen=386079)),checkpoint_backup_info=,checkpoint_lsn=(98,494592)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user