File tree 4 files changed +22
-4
lines changed
Cik.Magazine.CategoryService 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 8
8
9
9
namespace Cik . Magazine . ApiGateway . Controllers
10
10
{
11
+ /// <summary>
12
+ /// The main controller for the graphql endpoint
13
+ /// </summary>
11
14
[ Route ( "graphql" ) ]
12
15
public class GraphQLController : Controller
13
16
{
14
17
private readonly IDocumentExecuter _documentExecuter ;
15
18
private readonly ILogger _logger ;
16
19
private readonly ISchema _schema ;
17
20
21
+ /// <summary>
22
+ /// The constructor of the GraphQLController
23
+ /// </summary>
24
+ /// <param name="documentExecuter"></param>
25
+ /// <param name="schema"></param>
26
+ /// <param name="logger"></param>
18
27
public GraphQLController ( IDocumentExecuter documentExecuter , ISchema schema , ILogger < GraphQLController > logger )
19
28
{
20
29
_documentExecuter = documentExecuter ;
21
30
_schema = schema ;
22
31
_logger = logger ;
23
32
}
24
33
34
+ /// <summary>
35
+ /// Post action is the main and only one action for submit the query and mutation of GraphQL
36
+ /// </summary>
37
+ /// <param name="query"></param>
38
+ /// <returns></returns>
25
39
[ HttpPost ]
26
40
public async Task < IActionResult > Post ( [ FromBody ] GraphQLQuery query )
27
41
{
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ public class CategoryType : ObjectGraphType<CategoryGraph>
6
6
{
7
7
public CategoryType ( )
8
8
{
9
+ Name = "Category" ;
10
+ Description = "The category type in the magazine system" ;
11
+
9
12
Field ( x => x . Id ) . Description ( "The Id of the Category." ) ;
10
13
Field ( x => x . Name ) . Description ( "The Name of the Category." ) ;
11
14
Field ( x => x . Status ) . Description ( "The Status of the Category." ) ;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ public NoSqlStorage()
22
22
public void Handle ( CreateNewCategory message )
23
23
{
24
24
_log . Info ( "Creation: start to handle [{0}]" , message . GetType ( ) . Name ) ;
25
+
25
26
// TODO: will refactor later
26
27
_mongoClient = new MongoClient ( new MongoUrl ( "mongodb://127.0.0.1:27017" ) ) ;
27
28
var db = _mongoClient . GetDatabase ( "magazine" ) ;
@@ -37,14 +38,15 @@ public void Handle(CreateNewCategory message)
37
38
38
39
col . InsertOne ( new CategoryViewResponse
39
40
{
40
- Name = message . Name ,
41
+ Name = message . Name ,
41
42
Status = message . Status
42
43
} ) ;
43
44
}
44
45
45
46
public void Handle ( DeleteCategory message )
46
47
{
47
48
_log . Info ( "Delete: start to handle [{0}]" , message . GetType ( ) . Name ) ;
49
+
48
50
// TODO: will refactor later
49
51
_mongoClient = new MongoClient ( new MongoUrl ( "mongodb://127.0.0.1:27017" ) ) ;
50
52
var db = _mongoClient . GetDatabase ( "magazine" ) ;
@@ -65,6 +67,7 @@ public void Handle(DeleteCategory message)
65
67
public void Handle ( UpdateCategory message )
66
68
{
67
69
_log . Info ( "Edit: start to handle [{0}]" , message . GetType ( ) . Name ) ;
70
+
68
71
// TODO: will refactor later
69
72
_mongoClient = new MongoClient ( new MongoUrl ( "mongodb://127.0.0.1:27017" ) ) ;
70
73
var db = _mongoClient . GetDatabase ( "magazine" ) ;
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . IO ;
3
- using System . Runtime . Remoting . Contexts ;
4
- using System . Threading ;
5
3
using Akka . Actor ;
6
4
using Akka . Event ;
7
- using Cik . Magazine . CategoryService . Sagas ;
8
5
using Cik . Magazine . Shared . Queries ;
9
6
using MongoDB . Driver ;
10
7
@@ -15,6 +12,7 @@ public class CategoryQuery : TypedActor,
15
12
IHandle < CategoryViewRequest >
16
13
{
17
14
private readonly ILoggingAdapter _log ;
15
+
18
16
// TODO: will refactor later
19
17
private readonly MongoClient _mongoClient = new MongoClient ( new MongoUrl ( "mongodb://127.0.0.1:27017" ) ) ;
20
18
You can’t perform that action at this time.
0 commit comments