(feat): blog items dataprovider and controllers
This commit is contained in:
parent
3506afda39
commit
b635c3bc3b
1081
db/DML/blogcatalog.json
Normal file
1081
db/DML/blogcatalog.json
Normal file
File diff suppressed because one or more lines are too long
13
db/DML/categories.json
Normal file
13
db/DML/categories.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"_id":"e154e33f-3cc7-468d-bb66-e0390ddb9ae0",
|
||||||
|
"siteId":"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"l10n":[
|
||||||
|
{
|
||||||
|
"locale":0,
|
||||||
|
"slug":"default",
|
||||||
|
"text":"Default category"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -1,47 +1,32 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"_id": "bdc1aeac-2592-40c2-b9b3-a4988ce6173d",
|
"_id":"bdc1aeac-2592-40c2-b9b3-a4988ce6173d",
|
||||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
"siteId":"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"userId": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
"userId":"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
"slug": "shop-catalog-item",
|
"sku":"SKU-01",
|
||||||
"sku": "SKU-01",
|
"quantity":2,
|
||||||
"image": { "src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg", "alt": "..." },
|
"created":{
|
||||||
"title": "Mongo Shop item title",
|
"$date":"2022-01-01T00:00:00.000Z"
|
||||||
"brandName": "Brand & Name",
|
}
|
||||||
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
},
|
||||||
"created": { "$date": "2022-01-01T00:00:00.000Z" },
|
{
|
||||||
"price": 20,
|
"_id":"0aaa0244-4b4a-4b05-8135-463ba187d78b",
|
||||||
"newPrice": 10,
|
"siteId":"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"quantity": 1
|
"userId":"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
},
|
"sku":"SKU-02",
|
||||||
{
|
"quantity":2,
|
||||||
"_id": "0aaa0244-4b4a-4b05-8135-463ba187d78b",
|
"created":{
|
||||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
"$date":"2022-01-01T00:00:00.000Z"
|
||||||
"userId": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
}
|
||||||
"slug": "shop-catalog-item",
|
},
|
||||||
"sku": "SKU-02",
|
{
|
||||||
"image": { "src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg", "alt": "..." },
|
"_id":"7da86cc6-80a9-4828-b81f-421d26a8cb24",
|
||||||
"title": "Mongo Shop item title",
|
"siteId":"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"brandName": "Brand & Name",
|
"userId":"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
"sku":"SKU-03",
|
||||||
"created": { "$date": "2022-01-01T00:00:00.000Z" },
|
"quantity":2,
|
||||||
"price": 20,
|
"created":{
|
||||||
"newPrice": 10,
|
"$date":"2022-01-01T00:00:00.000Z"
|
||||||
"quantity": 2
|
}
|
||||||
},
|
}
|
||||||
{
|
|
||||||
"_id": "7da86cc6-80a9-4828-b81f-421d26a8cb24",
|
|
||||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
|
||||||
"userId": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
|
||||||
"slug": "shop-catalog-item",
|
|
||||||
"sku": "SKU-03",
|
|
||||||
"image": { "src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg", "alt": "..." },
|
|
||||||
"title": "Mongo Shop item title",
|
|
||||||
"brandName": "Brand & Name",
|
|
||||||
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
|
||||||
"created": { "$date": "2022-01-01T00:00:00.000Z" },
|
|
||||||
"price": 20,
|
|
||||||
"newPrice": 10,
|
|
||||||
"quantity": 2
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
@ -1,187 +1,194 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"_id": "e2dd785c-f036-453a-886b-d842b7c31366",
|
"_id": "e2dd785c-f036-453a-886b-d842b7c31366",
|
||||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"slug": "shop-catalog-item",
|
"l10n": [
|
||||||
|
{
|
||||||
"images": [
|
"locale": 0,
|
||||||
{
|
"slug": "shop-catalog-item-01",
|
||||||
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
"description": "",
|
||||||
|
"title": "Shop item title",
|
||||||
|
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
||||||
|
"text": "",
|
||||||
|
"contentType": 0,
|
||||||
|
"plainText": "",
|
||||||
|
"badges": [
|
||||||
|
"sale"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
||||||
|
"l10n": [
|
||||||
|
{
|
||||||
|
"locale": 0,
|
||||||
"alt": "..."
|
"alt": "..."
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"title": "Shop item title",
|
}
|
||||||
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
],
|
||||||
"text": "",
|
"author": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
"author": {
|
"created": {
|
||||||
"_id": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
"$date": "2022-01-01T00:00:00.000Z"
|
||||||
"image": {
|
},
|
||||||
"src": "https://dummyimage.com/40x40/ced4da/6c757d",
|
"tags": [
|
||||||
|
"react",
|
||||||
|
"redux",
|
||||||
|
"webapi"
|
||||||
|
],
|
||||||
|
"categories": [
|
||||||
|
"e154e33f-3cc7-468d-bb66-e0390ddb9ae0"
|
||||||
|
],
|
||||||
|
"brandName": "Mongodb Brand & Name",
|
||||||
|
"sku": "SKU-01",
|
||||||
|
"rating": 4.5,
|
||||||
|
"price": 20,
|
||||||
|
"newPrice": 10,
|
||||||
|
"quantity": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "055ede3f-7449-47d1-83b1-387dc3573711",
|
||||||
|
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"l10n": [
|
||||||
|
{
|
||||||
|
"locale": 0,
|
||||||
|
"slug": "shop-catalog-item-02",
|
||||||
|
"description": "",
|
||||||
|
"title": "Shop item title",
|
||||||
|
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
||||||
|
"text": "",
|
||||||
|
"contentType": 0,
|
||||||
|
"plainText": "",
|
||||||
|
"badges": [
|
||||||
|
"sale"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
||||||
|
"l10n": [
|
||||||
|
{
|
||||||
|
"locale": 0,
|
||||||
"alt": "..."
|
"alt": "..."
|
||||||
},
|
}
|
||||||
"nickName": "Admin"
|
]
|
||||||
},
|
}
|
||||||
"created": {
|
],
|
||||||
"$date": "2022-01-01T00:00:00.000Z"
|
"author": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
},
|
"created": {
|
||||||
"badges": [
|
"$date": "2022-01-01T00:00:00.000Z"
|
||||||
"sale"
|
},
|
||||||
],
|
"tags": [
|
||||||
"tags": [
|
"react",
|
||||||
"react",
|
"redux",
|
||||||
"redux",
|
"webapi"
|
||||||
"webapi"
|
],
|
||||||
],
|
"categories": [
|
||||||
"categories": [
|
"e154e33f-3cc7-468d-bb66-e0390ddb9ae0"
|
||||||
{
|
],
|
||||||
"_id": "e154e33f-3cc7-468d-bb66-e0390ddb9ae0",
|
"brandName": "Mongodb Brand & Name",
|
||||||
"slug": "default",
|
"sku": "SKU-02",
|
||||||
"text": "Default category"
|
"rating": 4.5,
|
||||||
}
|
"price": 20,
|
||||||
],
|
"newPrice": 10,
|
||||||
"brandName": "Mongodb Brand & Name",
|
"quantity": 100
|
||||||
"sku": "SKU-01",
|
},
|
||||||
"rating": 4.5,
|
{
|
||||||
"price": 20,
|
"_id": "d17accca-6666-43ef-a91f-b63604e6113c",
|
||||||
"newPrice": 10,
|
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"quantity": 100
|
"l10n": [
|
||||||
},
|
{
|
||||||
{
|
"locale": 0,
|
||||||
"_id": "055ede3f-7449-47d1-83b1-387dc3573711",
|
"slug": "shop-catalog-item-03",
|
||||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
"description": "",
|
||||||
"slug": "shop-catalog-item",
|
"title": "Shop item title",
|
||||||
"images": [
|
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
||||||
{
|
"text": "",
|
||||||
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
"contentType": 0,
|
||||||
|
"plainText": "",
|
||||||
|
"badges": [
|
||||||
|
"sale"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
||||||
|
"l10n": [
|
||||||
|
{
|
||||||
|
"locale": 0,
|
||||||
"alt": "..."
|
"alt": "..."
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"title": "Shop item title",
|
}
|
||||||
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
],
|
||||||
"text": "",
|
"author": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
"author": {
|
"created": {
|
||||||
"_id": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
"$date": "2022-01-01T00:00:00.000Z"
|
||||||
"image": {
|
},
|
||||||
"src": "https://dummyimage.com/40x40/ced4da/6c757d",
|
"tags": [
|
||||||
|
"react",
|
||||||
|
"redux",
|
||||||
|
"webapi"
|
||||||
|
],
|
||||||
|
"categories": [
|
||||||
|
"e154e33f-3cc7-468d-bb66-e0390ddb9ae0"
|
||||||
|
],
|
||||||
|
"brandName": "Mongodb Brand & Name",
|
||||||
|
"sku": "SKU-03",
|
||||||
|
"rating": 4.5,
|
||||||
|
"price": 20,
|
||||||
|
"newPrice": 10,
|
||||||
|
"quantity": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "0dc37621-0925-41d8-90db-552224d59c2a",
|
||||||
|
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"l10n": [
|
||||||
|
{
|
||||||
|
"locale": 0,
|
||||||
|
"slug": "shop-catalog-item-04",
|
||||||
|
"description": "",
|
||||||
|
"title": "Shop item title",
|
||||||
|
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
||||||
|
"text": "",
|
||||||
|
"contentType": 0,
|
||||||
|
"plainText": "",
|
||||||
|
"badges": [
|
||||||
|
"sale"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
||||||
|
"l10n": [
|
||||||
|
{
|
||||||
|
"locale": 0,
|
||||||
"alt": "..."
|
"alt": "..."
|
||||||
},
|
}
|
||||||
"nickName": "Admin"
|
]
|
||||||
},
|
}
|
||||||
"created": {
|
],
|
||||||
"$date": "2022-01-01T00:00:00.000Z"
|
"author": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
},
|
"created": {
|
||||||
"badges": [
|
"$date": "2022-01-01T00:00:00.000Z"
|
||||||
"sale"
|
},
|
||||||
],
|
"tags": [
|
||||||
"tags": [
|
"react",
|
||||||
"react",
|
"redux",
|
||||||
"redux",
|
"webapi"
|
||||||
"webapi"
|
],
|
||||||
],
|
"categories": [
|
||||||
"categories": [
|
"e154e33f-3cc7-468d-bb66-e0390ddb9ae0"
|
||||||
{
|
],
|
||||||
"_id": "e154e33f-3cc7-468d-bb66-e0390ddb9ae0",
|
"brandName": "Mongodb Brand & Name",
|
||||||
"slug": "default",
|
"sku": "SKU-04",
|
||||||
"text": "Default category"
|
"rating": 4.5,
|
||||||
}
|
"price": 20,
|
||||||
],
|
"newPrice": 10,
|
||||||
"brandName": "Mongodb Brand & Name",
|
"quantity": 100
|
||||||
"sku": "SKU-02",
|
}
|
||||||
"rating": 4.5,
|
|
||||||
"price": 20,
|
|
||||||
"newPrice": 10,
|
|
||||||
"quantity": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id": "d17accca-6666-43ef-a91f-b63604e6113c",
|
|
||||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
|
||||||
"slug": "shop-catalog-item",
|
|
||||||
"images": [
|
|
||||||
{
|
|
||||||
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
|
||||||
"alt": "..."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"brandName": "Brand & Name",
|
|
||||||
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
|
||||||
"text": "",
|
|
||||||
"author": {
|
|
||||||
"_id": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
|
||||||
"image": {
|
|
||||||
"src": "https://dummyimage.com/40x40/ced4da/6c757d",
|
|
||||||
"alt": "..."
|
|
||||||
},
|
|
||||||
"nickName": "Admin"
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"$date": "2022-01-01T00:00:00.000Z"
|
|
||||||
},
|
|
||||||
"badges": [
|
|
||||||
"sale"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"react",
|
|
||||||
"redux",
|
|
||||||
"webapi"
|
|
||||||
],
|
|
||||||
"categories": [
|
|
||||||
{
|
|
||||||
"_id": "e154e33f-3cc7-468d-bb66-e0390ddb9ae0",
|
|
||||||
"slug": "default",
|
|
||||||
"text": "Default category"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"brandName": "Mongodb Brand & Name",
|
|
||||||
"sku": "SKU-03",
|
|
||||||
"rating": 4.5,
|
|
||||||
"price": 20,
|
|
||||||
"newPrice": 10,
|
|
||||||
"quantity": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id": "0dc37621-0925-41d8-90db-552224d59c2a",
|
|
||||||
"siteId": "404c8232-9048-4519-bfba-6e78dc7005ca",
|
|
||||||
"slug": "shop-catalog-item",
|
|
||||||
"images": [
|
|
||||||
{
|
|
||||||
"src": "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
|
||||||
"alt": "..."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Shop item title",
|
|
||||||
"shortText": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
|
||||||
"text": "",
|
|
||||||
"author": {
|
|
||||||
"_id": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
|
||||||
"image": {
|
|
||||||
"src": "https://dummyimage.com/40x40/ced4da/6c757d",
|
|
||||||
"alt": "..."
|
|
||||||
},
|
|
||||||
"nickName": "Admin"
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"$date": "2022-01-01T00:00:00.000Z"
|
|
||||||
},
|
|
||||||
"badges": [
|
|
||||||
"sale"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"react",
|
|
||||||
"redux",
|
|
||||||
"webapi"
|
|
||||||
],
|
|
||||||
"categories": [
|
|
||||||
{
|
|
||||||
"_id": "e154e33f-3cc7-468d-bb66-e0390ddb9ae0",
|
|
||||||
"slug": "default",
|
|
||||||
"text": "Default category"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"brandName": "Mongodb Brand & Name",
|
|
||||||
"sku": "SKU-04",
|
|
||||||
"rating": 4.5,
|
|
||||||
"price": 20,
|
|
||||||
"newPrice": 10,
|
|
||||||
"quantity": 100
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
@ -68,7 +68,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/ShopCartItems/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
"raw": "https://localhost:7151/api/ShopCartItems/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60?locale=en-US",
|
||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
@ -79,6 +79,12 @@
|
|||||||
"ShopCartItems",
|
"ShopCartItems",
|
||||||
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60"
|
"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "locale",
|
||||||
|
"value": "en-US"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -141,7 +147,7 @@
|
|||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\r\n \"slug\": \"shop-catalog-item\",\r\n \"image\": {\r\n \"src\": \"https://dummyimage.com/450x300/dee2e6/6c757d.jpg\",\r\n \"alt\": \"...\"\r\n },\r\n \"title\": \"Shop item title\",\r\n \"brandName\": \"Brand & Name\",\r\n \"shortText\": \"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...\",\r\n \"created\": \"2022-01-01T00:00:00Z\",\r\n \"price\": 20,\r\n \"newPrice\": 10,\r\n \"quantity\": 1\r\n}"
|
"raw": "{\r\n \"quantity\": 1\r\n}"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-04",
|
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-04",
|
||||||
@ -179,7 +185,7 @@
|
|||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\r\n \"slug\": \"shop-catalog-item\",\r\n \"image\": {\r\n \"src\": \"https://dummyimage.com/450x300/dee2e6/6c757d.jpg\",\r\n \"alt\": \"...\"\r\n },\r\n \"title\": \"Shop item title\",\r\n \"brandName\": \"New Brand & Name\",\r\n \"shortText\": \"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...\",\r\n \"created\": \"2022-01-01T00:00:00Z\",\r\n \"price\": 40,\r\n \"newPrice\": 50,\r\n \"quantity\": 2\r\n}"
|
"raw": "{\r\n \"quantity\": 2\r\n}"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-04",
|
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-04",
|
||||||
@ -234,6 +240,317 @@
|
|||||||
"response": []
|
"response": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ShopItems",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "01-Get",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/ShopCatalog/404c8232-9048-4519-bfba-6e78dc7005ca?currentPage=1&itemsPerPage=4",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopCatalog",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "currentPage",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "itemsPerPage",
|
||||||
|
"value": "4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "01-Delete",
|
||||||
|
"request": {
|
||||||
|
"method": "DELETE",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/ShopCatalog/404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopCatalog",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ShopItem",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "01-Get",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/ShopItem/404c8232-9048-4519-bfba-6e78dc7005ca/SKU-01",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"SKU-01"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "02-Post",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\r\n \"l10n\":[\r\n {\r\n \"locale\":\"en-US\",\r\n \"slug\":\"shop-catalog-item-05\",\r\n \"description\": \"\",\r\n \"title\":\"Shop item title\",\r\n \"shortText\":\"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...\",\r\n \"text\":\"\",\r\n \"contentType\": \"HTML\",\r\n \"badges\":[\r\n \"sale\"\r\n ]\r\n }\r\n ],\r\n \r\n \"tags\":[\r\n \"react\",\r\n \"redux\",\r\n \"webapi\"\r\n ],\r\n \"categories\":[\r\n \"e154e33f-3cc7-468d-bb66-e0390ddb9ae0\"\r\n ],\r\n \"brandName\":\"Mongodb Brand & Name\",\r\n \"rating\":4.5,\r\n \"price\":20,\r\n \"newPrice\":10,\r\n \"quantity\":100\r\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/ShopItem/404c8232-9048-4519-bfba-6e78dc7005ca/SKU-05",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"SKU-05"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "03-Put",
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\r\n \"slug\":\"shop-catalog-item-05\",\r\n \"l10n\":[\r\n {\r\n \"locale\":\"en-US\",\r\n \"slug\":\"shop-catalog-item-05\",\r\n \"description\": \"\",\r\n \"title\":\"Shop item title\",\r\n \"shortText\":\"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...\",\r\n \"text\":\"\",\r\n \"contentType\": \"HTML\",\r\n \"badges\":[\r\n \"sale\"\r\n ]\r\n }\r\n ],\r\n \"images\":[\r\n {\r\n \"src\":\"https://dummyimage.com/450x300/dee2e6/6c757d.jpg\",\r\n \"l10n\":[\r\n {\r\n \"locale\":\"en-US\",\r\n \"alt\":\"...\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"author\":\"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60\",\r\n \"tags\":[\r\n \"react\",\r\n \"redux\",\r\n \"webapi\"\r\n ],\r\n \"categories\":[\r\n \"e154e33f-3cc7-468d-bb66-e0390ddb9ae0\"\r\n ],\r\n \"brandName\":\"Mongodb Brand & Name\",\r\n \"rating\":4.5,\r\n \"price\":20,\r\n \"newPrice\":10,\r\n \"quantity\":200\r\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/ShopItem/404c8232-9048-4519-bfba-6e78dc7005ca/SKU-05",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"SKU-05"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "04-Delete",
|
||||||
|
"request": {
|
||||||
|
"method": "DELETE",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/ShopItem/404c8232-9048-4519-bfba-6e78dc7005ca/SKU-05",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"SKU-05"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BlogItems",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "01-Get",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/BlogItems/404c8232-9048-4519-bfba-6e78dc7005ca?currentPage=2&itemsPerPage=2&locale=en-US",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"BlogItems",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "currentPage",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "itemsPerPage",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "locale",
|
||||||
|
"value": "en-US"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "02-Delete",
|
||||||
|
"request": {
|
||||||
|
"method": "DELETE",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/BlogItems/404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"BlogItems",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BlogItem",
|
||||||
|
"item": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Core.Abstractions.DomainObjects {
|
|
||||||
public class Category {
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public string Slug { get; set; }
|
|
||||||
public string Text { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -5,7 +5,6 @@ using Core.DomainObjects.PageSections;
|
|||||||
|
|
||||||
namespace Core.Abstractions.DomainObjects {
|
namespace Core.Abstractions.DomainObjects {
|
||||||
public abstract class PageBase<T> : DomainObjectBase<T> {
|
public abstract class PageBase<T> : DomainObjectBase<T> {
|
||||||
|
|
||||||
public Header Header { get; set; }
|
public Header Header { get; set; }
|
||||||
public TitleSection? TitleSection { get; set; }
|
public TitleSection? TitleSection { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
using Core.DomainObjects.L10n;
|
||||||
|
using Core.Enumerations;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -11,26 +13,19 @@ namespace Core.Abstractions.DomainObjects {
|
|||||||
|
|
||||||
public Guid SiteId { get; set; }
|
public Guid SiteId { get; set; }
|
||||||
|
|
||||||
public string Slug { get; set; }
|
public List<PostItemL10n> L10n { get; set; }
|
||||||
|
|
||||||
public List<Image> Images { get; set; }
|
public List<Image> Images { get; set; }
|
||||||
|
|
||||||
public string Title { get; set; }
|
public Guid Author { get; set; }
|
||||||
|
|
||||||
public string Text { get; set; }
|
|
||||||
|
|
||||||
public string ShortText { get; set; }
|
|
||||||
|
|
||||||
public Author Author { get; set; }
|
|
||||||
|
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
public List<string> Badges { get; set; }
|
|
||||||
|
|
||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
public List<Category> Categories { get; set; }
|
public List<Guid> Categories { get; set; }
|
||||||
|
|
||||||
|
public bool? FamilyFriendly { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Core.Abstractions.Models {
|
namespace Core.Abstractions.Models {
|
||||||
public abstract class PostItemRequestModel<T> : ModelBase {
|
public abstract class RequestModelBase<T> : ModelBase {
|
||||||
public abstract T ToDomainObject();
|
public abstract T ToDomainObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
using Core.Abstractions.DomainObjects;
|
|
||||||
|
|
||||||
namespace Core.DomainObjects {
|
|
||||||
public class Category : DomainObjectBase<Category> {
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public string Text { get; set; }
|
|
||||||
|
|
||||||
public override int GetHashCode() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -8,7 +8,23 @@ namespace Core.DomainObjects.Documents {
|
|||||||
public uint? Likes { get; set; }
|
public uint? Likes { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
unchecked {
|
||||||
|
int hash = 17;
|
||||||
|
hash = hash * 23 + Id.GetHashCode();
|
||||||
|
hash = hash * 23 + SiteId.GetHashCode();
|
||||||
|
hash = hash * 23 + L10n.GetHashCode();
|
||||||
|
if (Images != null)
|
||||||
|
hash = hash * 23 + Images.Sum(x => x.GetHashCode());
|
||||||
|
hash = hash * 23 + Author.GetHashCode();
|
||||||
|
hash = hash * 23 + Created.GetHashCode();
|
||||||
|
hash = hash * 23 + Tags.Sum(x => x.GetHashCode());
|
||||||
|
hash = hash * 23 + Categories.Sum(x => x.GetHashCode());
|
||||||
|
|
||||||
|
hash = hash * 23 + ReadTime.GetHashCode();
|
||||||
|
hash = hash * 23 + Likes.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
webapi/Core/DomainObjects/Documents/Category.cs
Normal file
18
webapi/Core/DomainObjects/Documents/Category.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Core.Abstractions.DomainObjects;
|
||||||
|
using Core.DomainObjects.L10n;
|
||||||
|
|
||||||
|
namespace Core.DomainObjects {
|
||||||
|
public class Category : DomainObjectDocumentBase<Category> {
|
||||||
|
public Guid SiteId { get; set; }
|
||||||
|
public List<CategoryL10n> L10n { get; set; }
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
unchecked {
|
||||||
|
int hash = 17;
|
||||||
|
hash = hash * 23 + Id.GetHashCode();
|
||||||
|
hash = hash * 23 + L10n.Sum(x => x.GetHashCode());
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,17 +4,10 @@ namespace Core.DomainObjects.Documents {
|
|||||||
public class ShopCartItem : DomainObjectDocumentBase<ShopCartItem> {
|
public class ShopCartItem : DomainObjectDocumentBase<ShopCartItem> {
|
||||||
public Guid SiteId { get; set; }
|
public Guid SiteId { get; set; }
|
||||||
public Guid UserId { get; set; }
|
public Guid UserId { get; set; }
|
||||||
public string Slug { get; set; }
|
|
||||||
public string Sku { get; set; }
|
public string Sku { get; set; }
|
||||||
public Image Image { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string BrandName { get; set; }
|
|
||||||
public string ShortText { get; set; }
|
|
||||||
public DateTime Created { get; set; }
|
|
||||||
public double Price { get; set; }
|
|
||||||
public double NewPrice { get; set; }
|
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
// https://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-overriding-gethashcode
|
// https://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-overriding-gethashcode
|
||||||
// Overflow is fine, just wrap
|
// Overflow is fine, just wrap
|
||||||
@ -22,18 +15,10 @@ namespace Core.DomainObjects.Documents {
|
|||||||
int hash = 17;
|
int hash = 17;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
hash = hash * 23 + Id.GetHashCode();
|
hash = hash * 23 + Id.GetHashCode();
|
||||||
hash = hash * 23 + SiteId.GetHashCode();
|
|
||||||
hash = hash * 23 + UserId.GetHashCode();
|
hash = hash * 23 + UserId.GetHashCode();
|
||||||
hash = hash * 23 + Slug.GetHashCode();
|
|
||||||
hash = hash * 23 + Sku.GetHashCode();
|
hash = hash * 23 + Sku.GetHashCode();
|
||||||
hash = hash * 23 + Image.GetHashCode();
|
|
||||||
hash = hash * 23 + Title.GetHashCode();
|
|
||||||
hash = hash * 23 + BrandName.GetHashCode();
|
|
||||||
hash = hash * 23 + ShortText.GetHashCode();
|
|
||||||
hash = hash * 23 + Created.GetHashCode();
|
|
||||||
hash = hash * 23 + Price.GetHashCode();
|
|
||||||
hash = hash * 23 + NewPrice.GetHashCode();
|
|
||||||
hash = hash * 23 + Quantity.GetHashCode();
|
hash = hash * 23 + Quantity.GetHashCode();
|
||||||
|
hash = hash * 23 + Created.GetHashCode();
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,24 +5,21 @@ namespace Core.DomainObjects.Documents {
|
|||||||
public string BrandName { get; set; }
|
public string BrandName { get; set; }
|
||||||
public string Sku { get; set; }
|
public string Sku { get; set; }
|
||||||
public decimal? Rating { get; set; }
|
public decimal? Rating { get; set; }
|
||||||
public double Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
public double? NewPrice { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
public uint? Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
unchecked {
|
unchecked {
|
||||||
int hash = 17;
|
int hash = 17;
|
||||||
hash = hash * 23 + Id.GetHashCode();
|
hash = hash * 23 + Id.GetHashCode();
|
||||||
hash = hash * 23 + SiteId.GetHashCode();
|
hash = hash * 23 + SiteId.GetHashCode();
|
||||||
hash = hash * 23 + Slug.GetHashCode();
|
hash = hash * 23 + L10n.GetHashCode();
|
||||||
hash = hash * 23 + Images.Sum(x => x.GetHashCode());
|
if (Images != null)
|
||||||
hash = hash * 23 + Title.GetHashCode();
|
hash = hash * 23 + Images.Sum(x => x.GetHashCode());
|
||||||
hash = hash * 23 + Text.GetHashCode();
|
|
||||||
hash = hash * 23 + ShortText.GetHashCode();
|
|
||||||
hash = hash * 23 + Author.GetHashCode();
|
hash = hash * 23 + Author.GetHashCode();
|
||||||
hash = hash * 23 + Created.GetHashCode();
|
hash = hash * 23 + Created.GetHashCode();
|
||||||
hash = hash * 23 + Badges.Sum(x => x.GetHashCode());
|
hash = hash * 23 + Tags.GetHashCode();
|
||||||
hash = hash * 23 + Tags.Sum(x => x.GetHashCode());
|
|
||||||
hash = hash * 23 + Categories.Sum(x => x.GetHashCode());
|
hash = hash * 23 + Categories.Sum(x => x.GetHashCode());
|
||||||
|
|
||||||
hash = hash * 23 + BrandName.GetHashCode();
|
hash = hash * 23 + BrandName.GetHashCode();
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Core.DomainObjects {
|
namespace Core.DomainObjects {
|
||||||
|
|
||||||
|
|
||||||
public class User : DomainObjectDocumentBase<User> {
|
public class User : DomainObjectDocumentBase<User> {
|
||||||
public string NickName { get; set; }
|
public string NickName { get; set; }
|
||||||
|
|
||||||
@ -24,6 +25,8 @@ namespace Core.DomainObjects {
|
|||||||
public Address BillingAddress { get; set; }
|
public Address BillingAddress { get; set; }
|
||||||
public Address ShippingAddress { get; set; }
|
public Address ShippingAddress { get; set; }
|
||||||
|
|
||||||
|
// manage whitelisted tokens as salted hash
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,19 @@
|
|||||||
using Core.Abstractions.DomainObjects;
|
using Core.Abstractions.DomainObjects;
|
||||||
|
using Core.DomainObjects.L10n;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace Core.DomainObjects {
|
namespace Core.DomainObjects {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class Image : DomainObjectBase<Image> {
|
public class Image : DomainObjectBase<Image> {
|
||||||
public string Src { get; set; }
|
public string Src { get; set; }
|
||||||
public string Alt { get; set; }
|
public List<ImageL10n> L10n { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
int hash = 17;
|
int hash = 17;
|
||||||
hash = hash * 23 + Src.GetHashCode();
|
hash = hash * 23 + Src.GetHashCode();
|
||||||
hash = hash * 23 + Alt.GetHashCode();
|
hash = hash * 23 + L10n.GetHashCode();
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
webapi/Core/DomainObjects/L10n/CategoryL10n.cs
Normal file
24
webapi/Core/DomainObjects/L10n/CategoryL10n.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Core.Abstractions.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Core.DomainObjects.L10n {
|
||||||
|
public class CategoryL10n : DomainObjectBase<CategoryL10n> {
|
||||||
|
public Locales Locale { get; set; }
|
||||||
|
public string Slug { get; set; }
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
unchecked {
|
||||||
|
int hash = 17;
|
||||||
|
hash = hash * 23 + Locale.GetHashCode();
|
||||||
|
hash = hash * 23 + Text.GetHashCode();
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
webapi/Core/DomainObjects/L10n/ImageL10n.cs
Normal file
21
webapi/Core/DomainObjects/L10n/ImageL10n.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Core.Abstractions.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Core.DomainObjects.L10n {
|
||||||
|
public class ImageL10n : DomainObjectBase<ImageL10n> {
|
||||||
|
public Locales Locale { get; set; }
|
||||||
|
public string Alt { get; set; }
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
int hash = 17;
|
||||||
|
hash = hash * 23 + Locale.GetHashCode();
|
||||||
|
hash = hash * 23 + Alt.GetHashCode();
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
webapi/Core/DomainObjects/L10n/PostItemL10n.cs
Normal file
31
webapi/Core/DomainObjects/L10n/PostItemL10n.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using Core.Abstractions.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
|
namespace Core.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 ContentTypes ContentType { 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 + ContentType.GetHashCode();
|
||||||
|
hash = hash * 23 + ShortText.GetHashCode();
|
||||||
|
hash = hash * 23 + Badges.Sum(x => x.GetHashCode());
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,6 @@ using Core.DomainObjects.PageSections;
|
|||||||
|
|
||||||
namespace Core.DomainObjects.Pages {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class BlogCatalogPage : PageBase<BlogCatalogPage> {
|
public class BlogCatalogPage : PageBase<BlogCatalogPage> {
|
||||||
|
|
||||||
public FeaturedBlogSection FeaturedBlogSection { get; set; }
|
public FeaturedBlogSection FeaturedBlogSection { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
|
|||||||
@ -3,8 +3,6 @@ using Core.DomainObjects.PageSections;
|
|||||||
|
|
||||||
namespace Core.DomainObjects.Pages {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class BlogItemPage : PageBase<BlogItemPage> {
|
public class BlogItemPage : PageBase<BlogItemPage> {
|
||||||
|
|
||||||
|
|
||||||
public CommentsSection CommentsSection { get; set; }
|
public CommentsSection CommentsSection { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
|
|||||||
@ -3,8 +3,6 @@ using Core.DomainObjects.PageSections;
|
|||||||
|
|
||||||
namespace Core.DomainObjects.Pages {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class HomePage : PageBase<HomePage> {
|
public class HomePage : PageBase<HomePage> {
|
||||||
|
|
||||||
|
|
||||||
public FeaturesSection FeaturesSection { get; set; }
|
public FeaturesSection FeaturesSection { get; set; }
|
||||||
public TestimonialsSection TestimonialsSection { get; set; }
|
public TestimonialsSection TestimonialsSection { get; set; }
|
||||||
public FeaturedBlogsSection FeaturedBlogsSection { get; set; }
|
public FeaturedBlogsSection FeaturedBlogsSection { get; set; }
|
||||||
|
|||||||
@ -3,8 +3,6 @@ using Core.DomainObjects.PageSections;
|
|||||||
|
|
||||||
namespace Core.DomainObjects.Pages {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class ShopCartPage : PageBase<ShopCartPage> {
|
public class ShopCartPage : PageBase<ShopCartPage> {
|
||||||
|
|
||||||
|
|
||||||
public ProductsSection ProductsSection { get; set; }
|
public ProductsSection ProductsSection { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
|
|||||||
@ -3,9 +3,6 @@ using Core.DomainObjects.PageSections;
|
|||||||
|
|
||||||
namespace Core.DomainObjects.Pages {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class ShopCatalogPage : PageBase<ShopCatalogPage> {
|
public class ShopCatalogPage : PageBase<ShopCatalogPage> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ShopItemsSection ShopItemsSection { get; set; }
|
public ShopItemsSection ShopItemsSection { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
|
|||||||
11
webapi/Core/Enumerations/ContentTypes.cs
Normal file
11
webapi/Core/Enumerations/ContentTypes.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Core.Abstractions;
|
||||||
|
|
||||||
|
namespace Core.Enumerations {
|
||||||
|
public class ContentTypes : Enumeration {
|
||||||
|
|
||||||
|
public static ContentTypes Html = new(0, "HTML");
|
||||||
|
public static ContentTypes Md = new(1, "MD");
|
||||||
|
|
||||||
|
private ContentTypes(int id, string displayName) : base(id, displayName) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
17
webapi/Core/Enumerations/Locales.cs
Normal file
17
webapi/Core/Enumerations/Locales.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Core.Abstractions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Core.Enumerations {
|
||||||
|
public class Locales : Enumeration {
|
||||||
|
|
||||||
|
public static Locales Us = new(0, "en-US");
|
||||||
|
public static Locales Ru = new(1, "ru-RU");
|
||||||
|
public static Locales It = new(2, "it-IT");
|
||||||
|
|
||||||
|
private Locales(int id, string displayName) : base (id, displayName) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
59
webapi/DataProviders/BlogCatalogDataProvider.cs
Normal file
59
webapi/DataProviders/BlogCatalogDataProvider.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
using Core.DomainObjects.Documents;
|
||||||
|
using DataProviders.Abstractions;
|
||||||
|
using DomainResults.Common;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MongoDB.Bson.Serialization;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataProviders {
|
||||||
|
|
||||||
|
public interface IBlogCatalogDataProvider {
|
||||||
|
(Guid?, IDomainResult) Insert(BlogItem blogItem);
|
||||||
|
(BlogItem?, IDomainResult) Get(Guid siteId, string slug);
|
||||||
|
(List<BlogItem>?, IDomainResult) GetAll(Guid siteId, int skip, int take);
|
||||||
|
(Guid?, IDomainResult) Update(BlogItem blogItem);
|
||||||
|
IDomainResult Delete(Guid id);
|
||||||
|
IDomainResult DeleteAll(Guid siteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BlogCatalogDataProvider : DataProviderBase<BlogItem>, IBlogCatalogDataProvider {
|
||||||
|
|
||||||
|
private const string _collectionName = "blogcatalog";
|
||||||
|
|
||||||
|
public BlogCatalogDataProvider(
|
||||||
|
ILogger<DataProviderBase<BlogItem>> logger,
|
||||||
|
IMongoClient client,
|
||||||
|
IIdGenerator idGenerator,
|
||||||
|
ISessionService sessionService) : base(logger, client, idGenerator, sessionService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public (Guid?, IDomainResult) Insert(BlogItem blogItem) =>
|
||||||
|
Insert(blogItem, _collectionName);
|
||||||
|
|
||||||
|
public (BlogItem?, IDomainResult) Get(Guid siteId, string slug) {
|
||||||
|
var (list, result) = GetWithPredicate(x => x.SiteId == siteId && x.L10n.Where(y => y.Slug == slug).Count() > 0, _collectionName);
|
||||||
|
|
||||||
|
if (!result.IsSuccess || list == null || list.Count == 0)
|
||||||
|
return (null, result);
|
||||||
|
|
||||||
|
return (list.First(), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public (List<BlogItem>?, IDomainResult) GetAll(Guid siteId, int skip, int take) =>
|
||||||
|
GetWithPredicate(x => x.SiteId == siteId, 0, 0, _collectionName);
|
||||||
|
|
||||||
|
public (Guid?, IDomainResult) Update(BlogItem blogItem) =>
|
||||||
|
UpdateWithPredicate(blogItem, x => x.Id == blogItem.Id, _collectionName);
|
||||||
|
|
||||||
|
public IDomainResult Delete(Guid id) =>
|
||||||
|
DeleteWithPredicate(x => x.Id == id, _collectionName);
|
||||||
|
|
||||||
|
public IDomainResult DeleteAll(Guid siteId) =>
|
||||||
|
DeleteManyWithPredicate(x => x.SiteId == siteId, _collectionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
namespace DataProviders;
|
|
||||||
|
|
||||||
public interface IBlogDataProvider { }
|
|
||||||
|
|
||||||
public class BlogDataProvider : IBlogDataProvider {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BlogDataProvider() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
40
webapi/DataProviders/CategoryDataProvider.cs
Normal file
40
webapi/DataProviders/CategoryDataProvider.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using Core.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using DataProviders.Abstractions;
|
||||||
|
using DomainResults.Common;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MongoDB.Bson.Serialization;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataProviders {
|
||||||
|
|
||||||
|
|
||||||
|
public interface ICategoryDataProvider {
|
||||||
|
(Category?, IDomainResult) Get(Guid id, Guid siteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CategoryDataProvider : DataProviderBase<Category>, ICategoryDataProvider {
|
||||||
|
|
||||||
|
private const string _collectionName = "categories";
|
||||||
|
public CategoryDataProvider(
|
||||||
|
ILogger<DataProviderBase<Category>> logger,
|
||||||
|
IMongoClient client,
|
||||||
|
IIdGenerator idGenerator,
|
||||||
|
ISessionService sessionService) : base(logger, client, idGenerator, sessionService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public (Category?, IDomainResult) Get(Guid id, Guid siteId) {
|
||||||
|
var (list, result) = GetWithPredicate(x => x.Id == id && x.SiteId == siteId, 0, 0, _collectionName);
|
||||||
|
|
||||||
|
if (!result.IsSuccess || list == null || list.Count == 0)
|
||||||
|
return (null, result);
|
||||||
|
|
||||||
|
return (list.First(), result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,7 +18,8 @@ namespace DataProviders.Extensions
|
|||||||
services.AddSingleton<IContentDataProvider, ContentDataProvider>();
|
services.AddSingleton<IContentDataProvider, ContentDataProvider>();
|
||||||
services.AddSingleton<IShopCatalogDataProvider, ShopCatalogDataProvider>();
|
services.AddSingleton<IShopCatalogDataProvider, ShopCatalogDataProvider>();
|
||||||
services.AddSingleton<IShopCartDataProvider, ShopCartDataProvider>();
|
services.AddSingleton<IShopCartDataProvider, ShopCartDataProvider>();
|
||||||
|
services.AddSingleton<ICategoryDataProvider, CategoryDataProvider>();
|
||||||
|
services.AddSingleton<IBlogCatalogDataProvider, BlogCatalogDataProvider>();
|
||||||
Mappings.RegisterClassMap();
|
Mappings.RegisterClassMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,9 @@ using Core.DomainObjects;
|
|||||||
using Core.DomainObjects.Pages;
|
using Core.DomainObjects.Pages;
|
||||||
using Core.DomainObjects.PageSections;
|
using Core.DomainObjects.PageSections;
|
||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
using Core.DomainObjects.L10n;
|
||||||
|
using DataProviders.Converters;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace DataProviders {
|
namespace DataProviders {
|
||||||
public class Mappings {
|
public class Mappings {
|
||||||
@ -20,6 +23,40 @@ namespace DataProviders {
|
|||||||
|
|
||||||
// https://kevsoft.net/2020/06/25/storing-guids-as-strings-in-mongodb-with-csharp.html
|
// https://kevsoft.net/2020/06/25/storing-guids-as-strings-in-mongodb-with-csharp.html
|
||||||
BsonSerializer.RegisterSerializer(new GuidSerializer(BsonType.String));
|
BsonSerializer.RegisterSerializer(new GuidSerializer(BsonType.String));
|
||||||
|
// 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.ContentType)
|
||||||
|
.SetSerializer(new EnumerationSerializer<ContentTypes>());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BsonClassMap.IsClassMapRegistered(typeof(ImageL10n))) {
|
||||||
|
BsonClassMap.RegisterClassMap<ImageL10n>(cm => {
|
||||||
|
cm.AutoMap();
|
||||||
|
|
||||||
|
cm.GetMemberMap(c => c.Locale)
|
||||||
|
.SetSerializer(new EnumerationSerializer<Locales>());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BsonClassMap.IsClassMapRegistered(typeof(CategoryL10n))) {
|
||||||
|
BsonClassMap.RegisterClassMap<CategoryL10n>(cm => {
|
||||||
|
cm.AutoMap();
|
||||||
|
|
||||||
|
cm.GetMemberMap(c => c.Locale)
|
||||||
|
.SetSerializer(new EnumerationSerializer<Locales>());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Primitives
|
#region Primitives
|
||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Address))) {
|
if (!BsonClassMap.IsClassMapRegistered(typeof(Address))) {
|
||||||
@ -116,6 +153,24 @@ namespace DataProviders {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region BlogItem
|
||||||
|
if (!BsonClassMap.IsClassMapRegistered(typeof(BlogItem))) {
|
||||||
|
BsonClassMap.RegisterClassMap<BlogItem>(cm => {
|
||||||
|
cm.AutoMap();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ShopItem
|
||||||
|
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopItem))) {
|
||||||
|
BsonClassMap.RegisterClassMap<ShopItem>(cm => {
|
||||||
|
cm.AutoMap();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region PageSections
|
#region PageSections
|
||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BillingAddressSection))) {
|
if (!BsonClassMap.IsClassMapRegistered(typeof(BillingAddressSection))) {
|
||||||
BsonClassMap.RegisterClassMap<BillingAddressSection>(cm => {
|
BsonClassMap.RegisterClassMap<BillingAddressSection>(cm => {
|
||||||
@ -270,13 +325,6 @@ namespace DataProviders {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region BlogItem
|
|
||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BlogItem))) {
|
|
||||||
BsonClassMap.RegisterClassMap<BlogItem>(cm => {
|
|
||||||
cm.AutoMap();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Content
|
#region Content
|
||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Content))) {
|
if (!BsonClassMap.IsClassMapRegistered(typeof(Content))) {
|
||||||
@ -289,13 +337,10 @@ namespace DataProviders {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ShopItem
|
|
||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopItem))) {
|
|
||||||
BsonClassMap.RegisterClassMap<ShopItem>(cm => {
|
|
||||||
cm.AutoMap();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region User
|
#region User
|
||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(User))) {
|
if (!BsonClassMap.IsClassMapRegistered(typeof(User))) {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ namespace DataProviders {
|
|||||||
(List<ShopItem>?, IDomainResult) GetAll(Guid siteId, int skip, int take);
|
(List<ShopItem>?, IDomainResult) GetAll(Guid siteId, int skip, int take);
|
||||||
(Guid?, IDomainResult) Update(ShopItem shopCart);
|
(Guid?, IDomainResult) Update(ShopItem shopCart);
|
||||||
IDomainResult Delete(Guid id);
|
IDomainResult Delete(Guid id);
|
||||||
|
IDomainResult DeleteAll(Guid siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShopCatalogDataProvider : DataProviderBase<ShopItem>, IShopCatalogDataProvider {
|
public class ShopCatalogDataProvider : DataProviderBase<ShopItem>, IShopCatalogDataProvider {
|
||||||
@ -48,5 +49,8 @@ namespace DataProviders {
|
|||||||
|
|
||||||
public IDomainResult Delete(Guid id) =>
|
public IDomainResult Delete(Guid id) =>
|
||||||
DeleteWithPredicate(x => x.Id == id, _collectionName);
|
DeleteWithPredicate(x => x.Id == id, _collectionName);
|
||||||
|
|
||||||
|
public IDomainResult DeleteAll(Guid siteId) =>
|
||||||
|
DeleteManyWithPredicate(x => x.SiteId == siteId, _collectionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,103 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
using Core.Models;
|
|
||||||
|
|
||||||
using WeatherForecast.Models;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Core.Abstractions.Models;
|
|
||||||
using WeatherForecast.Models.Responses;
|
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers;
|
|
||||||
|
|
||||||
[AllowAnonymous]
|
|
||||||
[ApiController]
|
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class BlogCatalogController : ControllerBase {
|
|
||||||
|
|
||||||
private readonly ILogger<BlogCatalogController> _logger;
|
|
||||||
|
|
||||||
public BlogCatalogController(ILogger<BlogCatalogController> logger) {
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="currentPage"></param>
|
|
||||||
/// <param name="itemsPerPage"></param>
|
|
||||||
/// <param name="category"></param>
|
|
||||||
/// <param name="searchText"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Get([FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int currentPage = 1, [FromQuery] int itemsPerPage = 4) {
|
|
||||||
|
|
||||||
|
|
||||||
//var blogModels = new List<BlogItemModel>();
|
|
||||||
//for (int i = 0; i < 100; i++) {
|
|
||||||
// var blogItemModel = new BlogItemModel {
|
|
||||||
// Id = Guid.NewGuid(),
|
|
||||||
// Slug = "blog-post-title",
|
|
||||||
// Image = new ImageModel { Src = "https://dummyimage.com/850x350/dee2e6/6c757d.jpg", Alt = "..." },
|
|
||||||
// Badge = "news",
|
|
||||||
// Title = $"Blog post title {i}",
|
|
||||||
// ShortText = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...",
|
|
||||||
// Text = "",
|
|
||||||
// Author = new AuthorModel {
|
|
||||||
// Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." },
|
|
||||||
// NickName = "Admin"
|
|
||||||
// },
|
|
||||||
// Created = DateTime.UtcNow,
|
|
||||||
// Tags = new List<string> { "react", "redux", "webapi" },
|
|
||||||
|
|
||||||
// ReadTime = 10,
|
|
||||||
// Likes = 200,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// blogModels.Add(blogItemModel);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var totalPages = blogModels.Count() / itemsPerPage;
|
|
||||||
|
|
||||||
var blogCatalogResponse = new GetBlogCatalogResponseModel {
|
|
||||||
|
|
||||||
/*
|
|
||||||
FeaturedBlog = blogModels[0],
|
|
||||||
BlogItemsPagination = new PaginationModelBase<BlogItemModel> {
|
|
||||||
CurrentPage = currentPage,
|
|
||||||
TotalPages = totalPages,
|
|
||||||
Items = blogModels.Skip((currentPage -1) * itemsPerPage).Take(itemsPerPage).ToList()
|
|
||||||
},
|
|
||||||
Categories = new List<CategoryModel> {
|
|
||||||
new CategoryModel {
|
|
||||||
Id = Guid.NewGuid(),
|
|
||||||
Text = "Web Design"
|
|
||||||
},
|
|
||||||
new CategoryModel {
|
|
||||||
Id = Guid.NewGuid(),
|
|
||||||
Text = "Html"
|
|
||||||
},
|
|
||||||
new CategoryModel {
|
|
||||||
Id = Guid.NewGuid(),
|
|
||||||
Text = "Freebies"
|
|
||||||
},
|
|
||||||
new CategoryModel {
|
|
||||||
Id = Guid.NewGuid(),
|
|
||||||
Text = "Javascript"
|
|
||||||
},
|
|
||||||
new CategoryModel {
|
|
||||||
Id = Guid.NewGuid(),
|
|
||||||
Text = "CSS"
|
|
||||||
},
|
|
||||||
new CategoryModel {
|
|
||||||
Id = Guid.NewGuid(),
|
|
||||||
Text = "Tutorials"
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Ok(blogCatalogResponse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -20,25 +20,25 @@ namespace WeatherForecast.Controllers {
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
//[HttpGet]
|
||||||
public IActionResult Get() {
|
//public IActionResult Get() {
|
||||||
|
|
||||||
var categories = new List<CategoryModel> {
|
// var categories = new List<CategoryModel> {
|
||||||
new CategoryModel {
|
// new CategoryModel {
|
||||||
Id = Guid.NewGuid(),
|
// Id = Guid.NewGuid(),
|
||||||
Text = "Software"
|
// Text = "Software"
|
||||||
},
|
// },
|
||||||
new CategoryModel {
|
// new CategoryModel {
|
||||||
Id = Guid.NewGuid(),
|
// Id = Guid.NewGuid(),
|
||||||
Text = "Hardware"
|
// Text = "Hardware"
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
|
|
||||||
var response = new GetBlogCategoriesResponseModel {
|
// var response = new GetBlogCategoriesResponseModel {
|
||||||
Items = categories
|
// Items = categories
|
||||||
};
|
// };
|
||||||
|
|
||||||
return Ok(response);
|
// return Ok(response);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
57
webapi/WeatherForecast/Controllers/BlogItemsController.cs
Normal file
57
webapi/WeatherForecast/Controllers/BlogItemsController.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
using Core.Models;
|
||||||
|
|
||||||
|
using WeatherForecast.Models;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Core.Abstractions.Models;
|
||||||
|
using WeatherForecast.Models.Responses;
|
||||||
|
using DomainResults.Mvc;
|
||||||
|
using WeatherForecast.Services;
|
||||||
|
using Core.Abstractions;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
|
namespace WeatherForecast.Controllers;
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public class BlogItemsController : ControllerBase {
|
||||||
|
|
||||||
|
private readonly ILogger<BlogItemsController> _logger;
|
||||||
|
private readonly IBlogItemsService _blogItemsService;
|
||||||
|
|
||||||
|
public BlogItemsController(
|
||||||
|
ILogger<BlogItemsController> logger,
|
||||||
|
IBlogItemsService blogItemsService
|
||||||
|
) {
|
||||||
|
_logger = logger;
|
||||||
|
_blogItemsService = blogItemsService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="itemsPerPage"></param>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="searchText"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("{siteId}")]
|
||||||
|
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale) {
|
||||||
|
var result = _blogItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us, searchText);
|
||||||
|
return result.ToActionResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("{siteId}")]
|
||||||
|
public IActionResult Delete([FromRoute] Guid siteId) {
|
||||||
|
var result = _blogItemsService.Delete(siteId);
|
||||||
|
return result.ToActionResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,4 +1,6 @@
|
|||||||
using DomainResults.Mvc;
|
using Core.Abstractions;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using DomainResults.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using WeatherForecast.Models.Requests;
|
using WeatherForecast.Models.Requests;
|
||||||
@ -49,8 +51,8 @@ namespace WeatherForecast.Controllers {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}/{userId}/{sku}")]
|
[HttpGet("{siteId}/{userId}/{sku}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromQuery] string locale) {
|
||||||
var result = _shopCartItemService.Get(siteId, userId, sku);
|
var result = _shopCartItemService.Get(siteId, userId, sku, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using DomainResults.Mvc;
|
using Core.Abstractions;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using DomainResults.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using WeatherForecast.Models.Requests;
|
using WeatherForecast.Models.Requests;
|
||||||
@ -35,8 +37,8 @@ namespace WeatherForecast.Controllers {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}/{userId}")]
|
[HttpGet("{siteId}/{userId}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromQuery] string locale) {
|
||||||
var result = _shopCartItemsService.Get(siteId, userId);
|
var result = _shopCartItemsService.Get(siteId, userId, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,25 +15,25 @@ namespace WeatherForecast.Controllers {
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
///
|
/////
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
[HttpGet]
|
//[HttpGet]
|
||||||
public IActionResult Get() {
|
//public IActionResult Get() {
|
||||||
|
|
||||||
var categories = new List<CategoryModel> {
|
// var categories = new List<CategoryModel> {
|
||||||
new CategoryModel {
|
// new CategoryModel {
|
||||||
Id = Guid.NewGuid(),
|
// Id = Guid.NewGuid(),
|
||||||
Text = "Software"
|
// Text = "Software"
|
||||||
},
|
// },
|
||||||
new CategoryModel {
|
// new CategoryModel {
|
||||||
Id = Guid.NewGuid(),
|
// Id = Guid.NewGuid(),
|
||||||
Text = "Hardware"
|
// Text = "Hardware"
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
|
|
||||||
return Ok(categories);
|
// return Ok(categories);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using WeatherForecast.Services;
|
using WeatherForecast.Services;
|
||||||
using DomainResults.Mvc;
|
using DomainResults.Mvc;
|
||||||
|
using Core.Abstractions;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using WeatherForecast.Models.Requests;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers {
|
namespace WeatherForecast.Controllers {
|
||||||
|
|
||||||
@ -21,6 +24,19 @@ namespace WeatherForecast.Controllers {
|
|||||||
_shopItemService = shopItemService;
|
_shopItemService = shopItemService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("{siteId}/{sku}")]
|
||||||
|
public IActionResult Post([FromRoute] Guid siteId, [FromRoute] string sku, [FromBody] PostShopItemRequestModel requestData) {
|
||||||
|
var result = _shopItemService.Post(siteId, sku, requestData);
|
||||||
|
return result.ToActionResult();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -28,8 +44,33 @@ namespace WeatherForecast.Controllers {
|
|||||||
/// <param name="sku"></param>
|
/// <param name="sku"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}/{sku}")]
|
[HttpGet("{siteId}/{sku}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] string sku) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] string sku, [FromQuery] string locale) {
|
||||||
var result = _shopItemService.Get(siteId, sku);
|
var result = _shopItemService.Get(siteId, sku, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us);
|
||||||
|
return result.ToActionResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut("{siteId}/{sku}")]
|
||||||
|
public IActionResult Update([FromRoute] Guid siteId, [FromRoute] string sku, [FromBody] PutShopItemRequestModel requestData) {
|
||||||
|
var result = _shopItemService.Update(siteId, sku, requestData);
|
||||||
|
return result.ToActionResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("{siteId}/{sku}")]
|
||||||
|
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] string sku) {
|
||||||
|
var result = _shopItemService.Delete(siteId, sku);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using Core.Abstractions.Models;
|
using Core.Abstractions;
|
||||||
|
using Core.Abstractions.Models;
|
||||||
|
using Core.Enumerations;
|
||||||
using Core.Models;
|
using Core.Models;
|
||||||
using DomainResults.Mvc;
|
using DomainResults.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -35,8 +37,19 @@ public class ShopItemsController : ControllerBase {
|
|||||||
/// <param name="itemsPerPage"></param>
|
/// <param name="itemsPerPage"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}")]
|
[HttpGet("{siteId}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? searchText) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string locale, [FromQuery] string? searchText) {
|
||||||
var result = _shopItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, searchText);
|
var result = _shopItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us, searchText);
|
||||||
|
return result.ToActionResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("{siteId}")]
|
||||||
|
public IActionResult Delete([FromRoute] Guid siteId) {
|
||||||
|
var result = _shopItemsService.Delete(siteId);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,13 +4,15 @@ using Core.DomainObjects;
|
|||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
public abstract class PersonModelBase<T> : ModelBase {
|
public abstract class PersonModelBase<T> : ModelBase {
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public ImageModel? Image { get; set; }
|
public ImageModel? Image { get; set; }
|
||||||
|
|
||||||
public PersonModelBase() { }
|
public PersonModelBase() { }
|
||||||
|
|
||||||
public PersonModelBase(PersonBase<T> person) {
|
public PersonModelBase(PersonBase<T> person) {
|
||||||
if(person.Image != null)
|
//if(person.Image != null)
|
||||||
Image = new ImageModel(person.Image);
|
// Image = new ImageModel(person.Image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,17 @@
|
|||||||
using Core.Abstractions.DomainObjects;
|
using Core.Abstractions.DomainObjects;
|
||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
|
using WeatherForecast.Models.L10n;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
public abstract class PostItemRequestModelBase<T> : PostItemRequestModel<T> {
|
|
||||||
|
|
||||||
public string Slug { get; set; }
|
public abstract class PostItemRequestModelBase<T> : RequestModelBase<T> {
|
||||||
|
|
||||||
public List<ImageModel> Images { get; set; }
|
public List<PostItemL10nModel> L10n { get; set; }
|
||||||
|
|
||||||
public List<string> Badges { get; set; }
|
public List<Guid>? Categories { get; set; }
|
||||||
|
|
||||||
public string Title { get; set; }
|
public List<string>? Tags { get; set; }
|
||||||
|
|
||||||
public string? ShortText { get; set; }
|
public bool? FamilyFriendly { get; set; }
|
||||||
|
|
||||||
public string? Text { get; set; }
|
|
||||||
|
|
||||||
public AuthorModel Author { get; set; }
|
|
||||||
|
|
||||||
public DateTime Created { get; set; }
|
|
||||||
|
|
||||||
public List<string> Tags { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,20 +1,26 @@
|
|||||||
using Core.Abstractions.DomainObjects;
|
using Core.Abstractions.DomainObjects;
|
||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
|
using Core.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
public abstract class PostItemResponseModelBase<T> : ResponseModelBase {
|
public abstract class PostItemResponseModelBase<T> : ResponseModelBase {
|
||||||
|
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
public List<ImageModel> Images { get; set; }
|
public List<ImageModel> Images { get; set; }
|
||||||
|
|
||||||
public List<string> Badges { get; set; }
|
public List<string> Badges { get; set; }
|
||||||
|
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
public string? ShortText { get; set; }
|
public string ShortText { get; set; }
|
||||||
|
|
||||||
public string? Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
public string PlainText { get; set; }
|
||||||
|
|
||||||
public AuthorModel Author { get; set; }
|
public AuthorModel Author { get; set; }
|
||||||
|
|
||||||
@ -22,16 +28,35 @@ namespace WeatherForecast.Models.Abstractions {
|
|||||||
|
|
||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
public PostItemResponseModelBase(PostItemBase<T> postItem) {
|
public List<CategoryModel> Categories { get; set; }
|
||||||
Slug = postItem.Slug;
|
|
||||||
Images = postItem.Images.Select(x => new ImageModel(x)).ToList();
|
public bool? FamilyFriendly { get; set; }
|
||||||
Badges = postItem.Badges;
|
|
||||||
Title = postItem.Title;
|
public PostItemResponseModelBase(PostItemBase<T> postItem, List<Category> categories, Locales locale) {
|
||||||
Text = postItem.Text;
|
|
||||||
ShortText = postItem.ShortText;
|
var postItemL10n = postItem.L10n.SingleOrDefault(x => x.Locale == locale);
|
||||||
Author = new AuthorModel(postItem.Author);
|
if (postItemL10n != null) {
|
||||||
|
Slug = postItemL10n.Slug;
|
||||||
|
Badges = postItemL10n.Badges;
|
||||||
|
Title = postItemL10n.Title;
|
||||||
|
ShortText = postItemL10n.ShortText;
|
||||||
|
Text = postItemL10n.Text;
|
||||||
|
PlainText = postItemL10n.PlainText;
|
||||||
|
Badges = postItemL10n.Badges;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Categories = categories.Select(x => new CategoryModel(x, locale)).ToList();
|
||||||
|
|
||||||
|
// Author = new AuthorModel(postItem.Author);
|
||||||
|
|
||||||
Created = postItem.Created;
|
Created = postItem.Created;
|
||||||
Tags = postItem.Tags;
|
Tags = postItem.Tags;
|
||||||
|
|
||||||
|
|
||||||
|
Images = postItem.Images.Select(x => new ImageModel(x, locale)).ToList();
|
||||||
|
|
||||||
|
FamilyFriendly = postItem.FamilyFriendly;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using Core.Abstractions.DomainObjects;
|
using Core.Abstractions.DomainObjects;
|
||||||
|
using Core.DomainObjects;
|
||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
using Core.Enumerations;
|
||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
@ -9,9 +11,10 @@ namespace WeatherForecast.Models {
|
|||||||
|
|
||||||
public uint? Likes { get; set; }
|
public uint? Likes { get; set; }
|
||||||
|
|
||||||
public BlogItemModel(BlogItem postItem) : base(postItem) {
|
public BlogItemModel(BlogItem blogItem, List<Category> categories, Locales locale) : base(blogItem, categories, locale) {
|
||||||
ReadTime = postItem.ReadTime;
|
|
||||||
Likes = postItem.Likes;
|
ReadTime = blogItem.ReadTime;
|
||||||
|
Likes = blogItem.Likes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,18 @@
|
|||||||
namespace WeatherForecast.Models {
|
using Core.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
|
namespace WeatherForecast.Models {
|
||||||
public class CategoryModel {
|
public class CategoryModel {
|
||||||
public Guid Id { get; set; }
|
public string Slug { get; set; }
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
public CategoryModel(Category category, Locales locale) {
|
||||||
|
|
||||||
|
var categoryL10n = category.L10n.SingleOrDefault(x => x.Locale == locale);
|
||||||
|
if (categoryL10n != null) {
|
||||||
|
Slug = categoryL10n.Slug;
|
||||||
|
Text = categoryL10n.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
public class ImageModel {
|
public class ImageModel {
|
||||||
@ -7,9 +8,13 @@ namespace WeatherForecast.Models {
|
|||||||
|
|
||||||
public ImageModel() { }
|
public ImageModel() { }
|
||||||
|
|
||||||
public ImageModel(Image image) {
|
public ImageModel(Image image, Locales locale) {
|
||||||
Src = image.Src;
|
Src = image.Src;
|
||||||
Alt = image.Alt;
|
|
||||||
|
var l10n = image.L10n.SingleOrDefault(x => x.Locale == locale);
|
||||||
|
if (l10n != null) {
|
||||||
|
Alt = l10n.Alt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
webapi/WeatherForecast/Models/L10n/PostItemL10nModel.cs
Normal file
37
webapi/WeatherForecast/Models/L10n/PostItemL10nModel.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using Core.Abstractions;
|
||||||
|
using Core.Abstractions.Models;
|
||||||
|
using Core.DomainObjects.L10n;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
|
namespace WeatherForecast.Models.L10n {
|
||||||
|
public class PostItemL10nModel : RequestModelBase<PostItemL10n> {
|
||||||
|
public string Locale { get; set; }
|
||||||
|
public string Slug { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
public string ShortText { get; set; }
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
public string ContentType { get; set; }
|
||||||
|
public List<string> Badges { get; set; }
|
||||||
|
|
||||||
|
public override PostItemL10n ToDomainObject() => new PostItemL10n {
|
||||||
|
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
||||||
|
Slug = Slug,
|
||||||
|
Description = Description,
|
||||||
|
Title = Title,
|
||||||
|
Text = Text,
|
||||||
|
ShortText = ShortText,
|
||||||
|
|
||||||
|
// TODO: create plain text creation logic
|
||||||
|
PlainText = "TODO",
|
||||||
|
|
||||||
|
ContentType = Enumeration.FromDisplayName<ContentTypes>(ContentType),
|
||||||
|
Badges = Badges
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -14,8 +14,8 @@ namespace WeatherForecast.Models.PageSections {
|
|||||||
|
|
||||||
public TitleSectionModel(TitleSection titleSection) : base(titleSection) {
|
public TitleSectionModel(TitleSection titleSection) : base(titleSection) {
|
||||||
|
|
||||||
if(titleSection.Image != null)
|
//if(titleSection.Image != null)
|
||||||
Image = new ImageModel(titleSection.Image);
|
// Image = new ImageModel(titleSection.Image);
|
||||||
|
|
||||||
if (titleSection.PrimaryLink != null)
|
if (titleSection.PrimaryLink != null)
|
||||||
PrimaryLink = new LinkModel(titleSection.PrimaryLink);
|
PrimaryLink = new LinkModel(titleSection.PrimaryLink);
|
||||||
|
|||||||
@ -3,31 +3,12 @@ using Core.DomainObjects;
|
|||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
public class PostShopCartItemRequestModel : PostItemRequestModel<ShopCartItem> {
|
public class PostShopCartItemRequestModel : RequestModelBase<ShopCartItem> {
|
||||||
|
|
||||||
public string Slug { get; set; }
|
|
||||||
public ImageModel Image { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string BrandName { get; set; }
|
|
||||||
public string ShortText { get; set; }
|
|
||||||
public DateTime Created { get; set; }
|
|
||||||
public double Price { get; set; }
|
|
||||||
public double NewPrice { get; set; }
|
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
public override ShopCartItem ToDomainObject() => new ShopCartItem {
|
public override ShopCartItem ToDomainObject() => new ShopCartItem {
|
||||||
Slug = Slug,
|
Quantity = Quantity,
|
||||||
Image = new Image {
|
Created = DateTime.UtcNow
|
||||||
Src = Image.Src,
|
|
||||||
Alt = Image.Alt
|
|
||||||
},
|
|
||||||
Title = Title,
|
|
||||||
BrandName = BrandName,
|
|
||||||
ShortText = ShortText,
|
|
||||||
Created = Created,
|
|
||||||
Price = Price,
|
|
||||||
NewPrice = NewPrice,
|
|
||||||
Quantity = Quantity
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,29 +1,29 @@
|
|||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
using Core.DomainObjects.L10n;
|
||||||
|
using ExtensionMethods;
|
||||||
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
public class PostShopItemRequestModel : PostItemRequestModel<ShopItem> {
|
public class PostShopItemRequestModel : PostItemRequestModelBase<ShopItem> {
|
||||||
public string Slug { get; set; }
|
|
||||||
public List<ImageModel> Images { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string BrandName { get; set; }
|
public string BrandName { get; set; }
|
||||||
public string ShortText { get; set; }
|
public decimal? Rating { get; set; }
|
||||||
public DateTime Created { get; set; }
|
public decimal Price { get; set; }
|
||||||
public double Price { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
public double NewPrice { get; set; }
|
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
public override ShopItem ToDomainObject() => new ShopItem {
|
public override ShopItem ToDomainObject() => new ShopItem {
|
||||||
Slug = Slug,
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
||||||
Images = Images.Select(x => new Image {
|
// Images
|
||||||
Src = x.Src,
|
// Author
|
||||||
Alt = x.Alt
|
Created = DateTime.UtcNow,
|
||||||
}).ToList(),
|
Tags = Tags,
|
||||||
Title = Title,
|
Categories = Categories,
|
||||||
|
FamilyFriendly = FamilyFriendly,
|
||||||
|
|
||||||
BrandName = BrandName,
|
BrandName = BrandName,
|
||||||
ShortText = ShortText,
|
Rating = Rating,
|
||||||
Created = Created,
|
|
||||||
Price = Price,
|
Price = Price,
|
||||||
NewPrice = NewPrice,
|
NewPrice = NewPrice,
|
||||||
Quantity = Quantity
|
Quantity = Quantity
|
||||||
|
|||||||
@ -3,31 +3,12 @@ using Core.DomainObjects;
|
|||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
public class PutShopCartItemRequestModel : PostItemRequestModel<ShopCartItem> {
|
public class PutShopCartItemRequestModel : RequestModelBase<ShopCartItem> {
|
||||||
|
|
||||||
public string Slug { get; set; }
|
|
||||||
public ImageModel Image { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string BrandName { get; set; }
|
|
||||||
public string ShortText { get; set; }
|
|
||||||
public DateTime Created { get; set; }
|
|
||||||
public double Price { get; set; }
|
|
||||||
public double NewPrice { get; set; }
|
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public override ShopCartItem ToDomainObject() => new ShopCartItem {
|
public override ShopCartItem ToDomainObject() => new ShopCartItem {
|
||||||
Slug = Slug,
|
|
||||||
Image = new Image {
|
|
||||||
Src = Image.Src,
|
|
||||||
Alt = Image.Alt
|
|
||||||
},
|
|
||||||
Title = Title,
|
|
||||||
BrandName = BrandName,
|
|
||||||
ShortText = ShortText,
|
|
||||||
Created = Created,
|
|
||||||
Price = Price,
|
|
||||||
NewPrice = NewPrice,
|
|
||||||
Quantity = Quantity
|
Quantity = Quantity
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,31 @@
|
|||||||
using Core.Abstractions.Models;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
|
using Core.DomainObjects;
|
||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
public class PutShopItemRequestModel : PostItemRequestModel<ShopItem> {
|
public class PutShopItemRequestModel : PostItemRequestModelBase<ShopItem> {
|
||||||
public override ShopItem ToDomainObject() {
|
|
||||||
throw new NotImplementedException();
|
public string BrandName { get; set; }
|
||||||
}
|
public decimal? Rating { get; set; }
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
public decimal? NewPrice { get; set; }
|
||||||
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
|
public override ShopItem ToDomainObject() => new ShopItem {
|
||||||
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
||||||
|
// Images
|
||||||
|
// Author
|
||||||
|
Created = DateTime.UtcNow,
|
||||||
|
Tags = Tags,
|
||||||
|
Categories = Categories,
|
||||||
|
FamilyFriendly = FamilyFriendly,
|
||||||
|
|
||||||
|
BrandName = BrandName,
|
||||||
|
Rating = Rating,
|
||||||
|
Price = Price,
|
||||||
|
NewPrice = NewPrice,
|
||||||
|
Quantity = Quantity
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
using Core.Abstractions.Models;
|
|
||||||
using Core.Models;
|
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
|
||||||
public class GetBlogCatalogResponseModel : ResponseModelBase {
|
|
||||||
|
|
||||||
public BlogItemModel FeaturedBlog { get; set; }
|
|
||||||
|
|
||||||
public List<CategoryModel> Categories { get; set; }
|
|
||||||
|
|
||||||
public PaginationModelBase<BlogItemModel> BlogItemsPagination { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
using Core.Abstractions.Models;
|
||||||
|
using Core.DomainObjects;
|
||||||
|
using Core.DomainObjects.Documents;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using Core.Models;
|
||||||
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
public class GetBlogItemResponseModel : PostItemResponseModelBase<BlogItem> {
|
||||||
|
|
||||||
|
public uint? ReadTime { get; set; }
|
||||||
|
|
||||||
|
public uint? Likes { get; set; }
|
||||||
|
|
||||||
|
public GetBlogItemResponseModel(BlogItem blogItem, List<Category> categories, Locales locale) : base(blogItem, categories, locale) {
|
||||||
|
ReadTime = blogItem.ReadTime;
|
||||||
|
Likes = blogItem.Likes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
using Core.Abstractions.Models;
|
||||||
|
using Core.Models;
|
||||||
|
|
||||||
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
public class GetBlogItemsResponseModel : PaginationModelBase<GetBlogItemResponseModel> {
|
||||||
|
|
||||||
|
|
||||||
|
//public BlogItemModel FeaturedBlog { get; set; }
|
||||||
|
|
||||||
|
//public List<CategoryModel> Categories { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public GetBlogItemsResponseModel(int currentPage, int totalPages, List<GetBlogItemResponseModel> items)
|
||||||
|
: base(currentPage, totalPages, items) { }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
public class GetShopCartItemResponseModel : ResponseModelBase {
|
public class GetShopCartItemResponseModel : ResponseModelBase {
|
||||||
@ -10,24 +11,29 @@ namespace WeatherForecast.Models.Responses {
|
|||||||
public string BrandName { get; set; }
|
public string BrandName { get; set; }
|
||||||
public string ShortText { get; set; }
|
public string ShortText { get; set; }
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public double Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
public double NewPrice { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
public uint Quantity { get; set; }
|
public uint? Quantity { get; set; }
|
||||||
|
|
||||||
public GetShopCartItemResponseModel() { }
|
public GetShopCartItemResponseModel() { }
|
||||||
|
|
||||||
public GetShopCartItemResponseModel(ShopCartItem shopCartItem) {
|
public GetShopCartItemResponseModel(ShopItem shopItem, ShopCartItem shopCartItem, Locales locale) {
|
||||||
Slug = shopCartItem.Slug;
|
|
||||||
Sku = shopCartItem.Sku;
|
Sku = shopItem.Sku;
|
||||||
Image = new ImageModel(shopCartItem.Image);
|
BrandName = shopItem.BrandName;
|
||||||
Title = shopCartItem.Title;
|
Created = shopItem.Created;
|
||||||
BrandName = shopCartItem.BrandName;
|
Price = shopItem.Price;
|
||||||
ShortText = shopCartItem.ShortText;
|
NewPrice = shopItem.NewPrice;
|
||||||
Created = shopCartItem.Created;
|
|
||||||
Price = shopCartItem.Price;
|
|
||||||
NewPrice = shopCartItem.NewPrice;
|
|
||||||
Quantity = shopCartItem.Quantity;
|
Quantity = shopCartItem.Quantity;
|
||||||
|
|
||||||
|
|
||||||
|
var shopItemL10n = shopItem.L10n.Single(x => x.Locale == locale);
|
||||||
|
Slug = shopItemL10n.Slug;
|
||||||
|
Title = shopItemL10n.Title;
|
||||||
|
ShortText = shopItemL10n.ShortText;
|
||||||
|
|
||||||
|
Image = new ImageModel(shopItem.Images.First(), locale);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,19 @@
|
|||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects;
|
||||||
|
using Core.DomainObjects.Documents;
|
||||||
using Core.DomainObjects.Pages;
|
using Core.DomainObjects.Pages;
|
||||||
|
using Core.Enumerations;
|
||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
public class GetShopItemResponseModel : PostItemResponseModelBase<ShopItem> {
|
public class GetShopItemResponseModel : PostItemResponseModelBase<ShopItem> {
|
||||||
public List<ImageModel>? Images { get; set; }
|
|
||||||
public string Sku { get; set; }
|
public string Sku { get; set; }
|
||||||
public decimal? Rating { get; set; }
|
public decimal? Rating { get; set; }
|
||||||
public double Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
public double? NewPrice { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
public uint? Quantity { get; set; }
|
public uint? Quantity { get; set; }
|
||||||
|
|
||||||
public GetShopItemResponseModel(ShopItem shopCatalogItem) : base(shopCatalogItem) {
|
public GetShopItemResponseModel(ShopItem shopCatalogItem, List<Category> categories, Locales locale) : base(shopCatalogItem, categories, locale) {
|
||||||
Images = shopCatalogItem.Images.Select(x => new ImageModel(x)).ToList();
|
|
||||||
Sku = shopCatalogItem.Sku;
|
Sku = shopCatalogItem.Sku;
|
||||||
Rating = shopCatalogItem.Rating;
|
Rating = shopCatalogItem.Rating;
|
||||||
Price = shopCatalogItem.Price;
|
Price = shopCatalogItem.Price;
|
||||||
|
|||||||
56
webapi/WeatherForecast/Services/BlogItemsService.cs
Normal file
56
webapi/WeatherForecast/Services/BlogItemsService.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using Core.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using DataProviders;
|
||||||
|
using DomainResults.Common;
|
||||||
|
using WeatherForecast.Models.Responses;
|
||||||
|
|
||||||
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
public interface IBlogItemsService {
|
||||||
|
(GetBlogItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText);
|
||||||
|
IDomainResult Delete(Guid siteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BlogItemsService : IBlogItemsService {
|
||||||
|
|
||||||
|
private readonly ILogger<BlogItemsService> _logger;
|
||||||
|
private readonly IBlogCatalogDataProvider _blogCatalogDataProvider;
|
||||||
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
|
public BlogItemsService(
|
||||||
|
ILogger<BlogItemsService> logger,
|
||||||
|
IBlogCatalogDataProvider blogCatalogDataProvider,
|
||||||
|
ICategoryDataProvider categoryDataProvider
|
||||||
|
) {
|
||||||
|
_logger = logger;
|
||||||
|
_blogCatalogDataProvider = blogCatalogDataProvider;
|
||||||
|
_categoryDataProvider = categoryDataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public (GetBlogItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText) {
|
||||||
|
var (items, result) = _blogCatalogDataProvider.GetAll(siteId, currentPage > 0 ? ((currentPage - 1) * itemsPerPage) : 0, itemsPerPage);
|
||||||
|
if (!result.IsSuccess || items == null)
|
||||||
|
return (null, result);
|
||||||
|
|
||||||
|
var blogItems = new List<GetBlogItemResponseModel>();
|
||||||
|
foreach (var item in items) {
|
||||||
|
var categories = new List<Category>();
|
||||||
|
foreach (var catId in item.Categories) {
|
||||||
|
var (cat, getCategoryResult) = _categoryDataProvider.Get(catId, siteId);
|
||||||
|
if (!getCategoryResult.IsSuccess || cat == null)
|
||||||
|
return (null, getCategoryResult);
|
||||||
|
|
||||||
|
categories.Add(cat);
|
||||||
|
}
|
||||||
|
blogItems.Add(new GetBlogItemResponseModel(item, categories, locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
return blogItems.Count > 0
|
||||||
|
? IDomainResult.Success(new GetBlogItemsResponseModel(currentPage, 0, blogItems))
|
||||||
|
: IDomainResult.NotFound<GetBlogItemsResponseModel?>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDomainResult Delete(Guid siteId) =>
|
||||||
|
_blogCatalogDataProvider.DeleteAll(siteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,7 @@
|
|||||||
using DataProviders;
|
using Core.Abstractions;
|
||||||
|
using Core.DomainObjects.Documents;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using DataProviders;
|
||||||
using DomainResults.Common;
|
using DomainResults.Common;
|
||||||
|
|
||||||
using WeatherForecast.Models.Requests;
|
using WeatherForecast.Models.Requests;
|
||||||
@ -8,7 +11,7 @@ namespace WeatherForecast.Services {
|
|||||||
|
|
||||||
public interface IShopCartItemService {
|
public interface IShopCartItemService {
|
||||||
(Guid?, IDomainResult) Post(Guid siteId, Guid userId, string sku, PostShopCartItemRequestModel requestModel);
|
(Guid?, IDomainResult) Post(Guid siteId, Guid userId, string sku, PostShopCartItemRequestModel requestModel);
|
||||||
(GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku);
|
(GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku, Locales locale);
|
||||||
(Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData);
|
(Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData);
|
||||||
IDomainResult Delete(Guid siteId, Guid userId, string sku);
|
IDomainResult Delete(Guid siteId, Guid userId, string sku);
|
||||||
}
|
}
|
||||||
@ -16,13 +19,16 @@ namespace WeatherForecast.Services {
|
|||||||
public class ShopCartItemService : IShopCartItemService {
|
public class ShopCartItemService : IShopCartItemService {
|
||||||
|
|
||||||
ILogger<ShopCartItemService> _logger;
|
ILogger<ShopCartItemService> _logger;
|
||||||
|
IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
IShopCartDataProvider _shopCartDataProvider;
|
IShopCartDataProvider _shopCartDataProvider;
|
||||||
|
|
||||||
public ShopCartItemService(
|
public ShopCartItemService(
|
||||||
ILogger<ShopCartItemService> logger,
|
ILogger<ShopCartItemService> logger,
|
||||||
|
IShopCatalogDataProvider shopCatalogDataProvider,
|
||||||
IShopCartDataProvider shopCartDataprovider
|
IShopCartDataProvider shopCartDataprovider
|
||||||
) {
|
) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_shopCatalogDataProvider = shopCatalogDataProvider;
|
||||||
_shopCartDataProvider = shopCartDataprovider;
|
_shopCartDataProvider = shopCartDataprovider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,13 +51,17 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(id);
|
return IDomainResult.Success(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku) {
|
public (GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku, Locales locale) {
|
||||||
var (item, result) = _shopCartDataProvider.Get(siteId, userId, sku);
|
|
||||||
|
|
||||||
|
var (cartItem, getCartItemResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
||||||
|
if (!getCartItemResult.IsSuccess || cartItem == null)
|
||||||
|
return (null, getCartItemResult);
|
||||||
|
|
||||||
|
var (item, result) = _shopCatalogDataProvider.Get(siteId, cartItem.Sku);
|
||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
return (null, result);
|
return (null, result);
|
||||||
|
|
||||||
return IDomainResult.Success(new GetShopCartItemResponseModel(item));
|
return IDomainResult.Success(new GetShopCartItemResponseModel(item, cartItem, locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
public (Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData) {
|
public (Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData) {
|
||||||
@ -65,6 +75,7 @@ namespace WeatherForecast.Services {
|
|||||||
newItem.SiteId = siteId;
|
newItem.SiteId = siteId;
|
||||||
newItem.UserId = userId;
|
newItem.UserId = userId;
|
||||||
newItem.Sku = sku;
|
newItem.Sku = sku;
|
||||||
|
newItem.Created = item.Created;
|
||||||
|
|
||||||
if (!item.Equals(newItem)) {
|
if (!item.Equals(newItem)) {
|
||||||
var (id, updateResult) = _shopCartDataProvider.Update(newItem);
|
var (id, updateResult) = _shopCartDataProvider.Update(newItem);
|
||||||
|
|||||||
@ -1,35 +1,53 @@
|
|||||||
using DataProviders;
|
using DomainResults.Common;
|
||||||
using DomainResults.Common;
|
|
||||||
|
|
||||||
using WeatherForecast.Models.Responses;
|
using WeatherForecast.Models.Responses;
|
||||||
|
|
||||||
|
using DataProviders;
|
||||||
|
|
||||||
|
using Core.Abstractions;
|
||||||
|
using Core.DomainObjects.Documents;
|
||||||
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
public interface IShopCartItemsService {
|
public interface IShopCartItemsService {
|
||||||
(List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId);
|
(List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId, Locales locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShopCartItemsService : IShopCartItemsService {
|
public class ShopCartItemsService : IShopCartItemsService {
|
||||||
|
|
||||||
ILogger<ShopCartItemsService> _logger;
|
ILogger<ShopCartItemsService> _logger;
|
||||||
|
IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
IShopCartDataProvider _shopCartDataProvider;
|
IShopCartDataProvider _shopCartDataProvider;
|
||||||
|
|
||||||
public ShopCartItemsService(
|
public ShopCartItemsService(
|
||||||
ILogger<ShopCartItemsService> logger,
|
ILogger<ShopCartItemsService> logger,
|
||||||
|
IShopCatalogDataProvider shopCatalogDataProvider,
|
||||||
IShopCartDataProvider shopCartDataprovider
|
IShopCartDataProvider shopCartDataprovider
|
||||||
) {
|
) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_shopCatalogDataProvider = shopCatalogDataProvider;
|
||||||
_shopCartDataProvider = shopCartDataprovider;
|
_shopCartDataProvider = shopCartDataprovider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId) {
|
public (List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId, Locales locale) {
|
||||||
|
|
||||||
var (items, result) = _shopCartDataProvider.GetAll(siteId, userId);
|
var (cartItems, getCartItemsResult) = _shopCartDataProvider.GetAll(siteId, userId);
|
||||||
|
if (!getCartItemsResult.IsSuccess || cartItems == null)
|
||||||
|
return (null, getCartItemsResult);
|
||||||
|
|
||||||
if (!result.IsSuccess || items == null)
|
var items = new List<GetShopCartItemResponseModel>();
|
||||||
return (null, result);
|
foreach (var cartItem in cartItems) {
|
||||||
|
var (item, result) = _shopCatalogDataProvider.Get(siteId, cartItem.Sku);
|
||||||
|
if (!result.IsSuccess || item == null)
|
||||||
|
return (null, result);
|
||||||
|
|
||||||
return IDomainResult.Success(items.Select(x => new GetShopCartItemResponseModel(x)).ToList());
|
items.Add(new GetShopCartItemResponseModel(item, cartItem, locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
return items.Count > 0
|
||||||
|
? IDomainResult.Success(items)
|
||||||
|
: IDomainResult.NotFound<List<GetShopCartItemResponseModel>?>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,35 @@
|
|||||||
using DataProviders;
|
using Core.DomainObjects;
|
||||||
|
using Core.DomainObjects.L10n;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using DataProviders;
|
||||||
using DomainResults.Common;
|
using DomainResults.Common;
|
||||||
|
using ExtensionMethods;
|
||||||
using WeatherForecast.Models;
|
using WeatherForecast.Models;
|
||||||
using WeatherForecast.Models.Requests;
|
using WeatherForecast.Models.Requests;
|
||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
public interface IShopItemService {
|
public interface IShopItemService {
|
||||||
(GetShopItemResponseModel, IDomainResult) Get(Guid siteId, string sku);
|
(Guid?, IDomainResult) Post(Guid siteId, string sku, PostShopItemRequestModel requestModel);
|
||||||
|
(GetShopItemResponseModel, IDomainResult) Get(Guid siteId, string sku, Locales locale);
|
||||||
|
(Guid?, IDomainResult) Update(Guid siteId, string sku, PutShopItemRequestModel requestData);
|
||||||
|
IDomainResult Delete(Guid siteId, string sku);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShopItemService : IShopItemService {
|
public class ShopItemService : IShopItemService {
|
||||||
|
|
||||||
private readonly ILogger<ShopItemService> _logger;
|
private readonly ILogger<ShopItemService> _logger;
|
||||||
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
public ShopItemService(
|
public ShopItemService(
|
||||||
ILogger<ShopItemService> logger,
|
ILogger<ShopItemService> logger,
|
||||||
IShopCatalogDataProvider shopCatalogDataProvider
|
IShopCatalogDataProvider shopCatalogDataProvider,
|
||||||
|
ICategoryDataProvider categoryDataProvider
|
||||||
) {
|
) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_shopCatalogDataProvider = shopCatalogDataProvider;
|
_shopCatalogDataProvider = shopCatalogDataProvider;
|
||||||
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (Guid?, IDomainResult) Post(Guid siteId, string sku, PostShopItemRequestModel requestModel) {
|
public (Guid?, IDomainResult) Post(Guid siteId, string sku, PostShopItemRequestModel requestModel) {
|
||||||
@ -32,6 +42,25 @@ namespace WeatherForecast.Services {
|
|||||||
item.SiteId = siteId;
|
item.SiteId = siteId;
|
||||||
item.Sku = sku;
|
item.Sku = sku;
|
||||||
|
|
||||||
|
// TODO: should be recovered from users by jwt
|
||||||
|
item.Author = "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60".ToGuid();
|
||||||
|
|
||||||
|
// TODO: should be placed to object storage
|
||||||
|
item.Images = new List<Image>() {
|
||||||
|
new Image {
|
||||||
|
Src = "https://dummyimage.com/450x300/dee2e6/6c757d.jpg",
|
||||||
|
L10n = new List<ImageL10n> {
|
||||||
|
new ImageL10n {
|
||||||
|
Locale = Locales.Us,
|
||||||
|
Alt = "..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: default value shoud not be hardcoded by database id
|
||||||
|
item.Categories ??= new List<Guid> { "e154e33f-3cc7-468d-bb66-e0390ddb9ae0".ToGuid() };
|
||||||
|
|
||||||
var (id, insertResult) = _shopCatalogDataProvider.Insert(item);
|
var (id, insertResult) = _shopCatalogDataProvider.Insert(item);
|
||||||
|
|
||||||
if (!insertResult.IsSuccess)
|
if (!insertResult.IsSuccess)
|
||||||
@ -40,13 +69,22 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(id);
|
return IDomainResult.Success(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GetShopItemResponseModel?, IDomainResult) Get(Guid siteId, string sku) {
|
public (GetShopItemResponseModel?, IDomainResult) Get(Guid siteId, string sku, Locales locale) {
|
||||||
var (item, result) = _shopCatalogDataProvider.Get(siteId, sku);
|
var (item, result) = _shopCatalogDataProvider.Get(siteId, sku);
|
||||||
|
|
||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
return (null, result);
|
return (null, result);
|
||||||
|
|
||||||
return IDomainResult.Success(new GetShopItemResponseModel(item));
|
var categories = new List<Category>();
|
||||||
|
foreach (var catId in item.Categories) {
|
||||||
|
var (category, getCategoryResult) = _categoryDataProvider.Get(catId, siteId);
|
||||||
|
if (!getCategoryResult.IsSuccess || category == null)
|
||||||
|
return (null, getCategoryResult);
|
||||||
|
|
||||||
|
categories.Add(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
return IDomainResult.Success(new GetShopItemResponseModel(item, categories, locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
public (Guid?, IDomainResult) Update(Guid siteId, string sku, PutShopItemRequestModel requestData) {
|
public (Guid?, IDomainResult) Update(Guid siteId, string sku, PutShopItemRequestModel requestData) {
|
||||||
@ -59,6 +97,8 @@ namespace WeatherForecast.Services {
|
|||||||
newItem.Id = item.Id;
|
newItem.Id = item.Id;
|
||||||
newItem.SiteId = siteId;
|
newItem.SiteId = siteId;
|
||||||
newItem.Sku = sku;
|
newItem.Sku = sku;
|
||||||
|
newItem.Created = item.Created;
|
||||||
|
newItem.Author = item.Author;
|
||||||
|
|
||||||
if (!item.Equals(newItem)) {
|
if (!item.Equals(newItem)) {
|
||||||
var (id, updateResult) = _shopCatalogDataProvider.Update(newItem);
|
var (id, updateResult) = _shopCatalogDataProvider.Update(newItem);
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using DataProviders;
|
using Core.DomainObjects;
|
||||||
|
using Core.Enumerations;
|
||||||
|
using DataProviders;
|
||||||
using DomainResults.Common;
|
using DomainResults.Common;
|
||||||
using WeatherForecast.Models;
|
using WeatherForecast.Models;
|
||||||
using WeatherForecast.Models.Responses;
|
using WeatherForecast.Models.Responses;
|
||||||
@ -6,28 +8,52 @@ using WeatherForecast.Models.Responses;
|
|||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
public interface IShopItemsService {
|
public interface IShopItemsService {
|
||||||
(GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, string? searchText);
|
(GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText);
|
||||||
|
IDomainResult Delete(Guid siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShopItemsService : IShopItemsService {
|
public class ShopItemsService : IShopItemsService {
|
||||||
ILogger<ShopItemsService> _logger;
|
private readonly ILogger<ShopItemsService> _logger;
|
||||||
IShopCatalogDataProvider _shopCatalogDataProvider;
|
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
public ShopItemsService(
|
public ShopItemsService(
|
||||||
ILogger<ShopItemsService> logger,
|
ILogger<ShopItemsService> logger,
|
||||||
IShopCatalogDataProvider shopCatalogDataprovider
|
IShopCatalogDataProvider shopCatalogDataprovider,
|
||||||
|
ICategoryDataProvider categoryDataProvider
|
||||||
) {
|
) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_shopCatalogDataProvider = shopCatalogDataprovider;
|
_shopCatalogDataProvider = shopCatalogDataprovider;
|
||||||
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, string? searchText) {
|
public (GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText) {
|
||||||
var (items, result) = _shopCatalogDataProvider.GetAll(siteId, currentPage > 0 ? ((currentPage - 1) * itemsPerPage) : 0, itemsPerPage);
|
var (items, result) = _shopCatalogDataProvider.GetAll(siteId, currentPage > 0 ? ((currentPage - 1) * itemsPerPage) : 0, itemsPerPage);
|
||||||
|
|
||||||
if (!result.IsSuccess || items == null)
|
if (!result.IsSuccess || items == null)
|
||||||
return (null, result);
|
return (null, result);
|
||||||
|
|
||||||
return IDomainResult.Success(new GetShopItemsResponseModel(currentPage, 0, items.Select(x => new GetShopItemResponseModel(x)).ToList()));
|
|
||||||
|
var shopItems = new List<GetShopItemResponseModel>();
|
||||||
|
foreach (var item in items) {
|
||||||
|
var categories = new List<Category>();
|
||||||
|
foreach (var catId in item.Categories) {
|
||||||
|
var (cat, getCategoryResult) = _categoryDataProvider.Get(catId, siteId);
|
||||||
|
if (!getCategoryResult.IsSuccess || cat == null)
|
||||||
|
return (null, getCategoryResult);
|
||||||
|
|
||||||
|
categories.Add(cat);
|
||||||
|
}
|
||||||
|
shopItems.Add(new GetShopItemResponseModel(item, categories, locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
return shopItems.Count > 0
|
||||||
|
? IDomainResult.Success(new GetShopItemsResponseModel(currentPage, 0, shopItems))
|
||||||
|
: IDomainResult.NotFound<GetShopItemsResponseModel?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IDomainResult Delete(Guid siteId)
|
||||||
|
=> _shopCatalogDataProvider.DeleteAll(siteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,8 @@ namespace WeatherForecast {
|
|||||||
services.AddScoped<IShopItemsService, ShopItemsService>();
|
services.AddScoped<IShopItemsService, ShopItemsService>();
|
||||||
services.AddScoped<IShopCartItemService, ShopCartItemService>();
|
services.AddScoped<IShopCartItemService, ShopCartItemService>();
|
||||||
services.AddScoped<IShopCartItemsService, ShopCartItemsService>();
|
services.AddScoped<IShopCartItemsService, ShopCartItemsService>();
|
||||||
|
//services.AddScoped<IBlogItemService, BlogItemService>();
|
||||||
|
services.AddScoped<IBlogItemsService, BlogItemsService>();
|
||||||
services.RegisterDataproviders(appSettings);
|
services.RegisterDataproviders(appSettings);
|
||||||
|
|
||||||
#region Swagger
|
#region Swagger
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user