Skip to content

Commit

Permalink
WIP: partial progress of #27.
Browse files Browse the repository at this point in the history
  • Loading branch information
CesarD committed Mar 18, 2024
1 parent cfba276 commit 0d28e3d
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Content/Backend/Query/.template.config/dotnetcli.host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"queryName": {
"longName": "queryName",
"shortName": "qn"
},
"returnType": {
"longName": "returnType",
"shortName": "rt"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/Content/Backend/Query/.template.config/ide.host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"icon": "icon.png",
"unsupportedHosts": [],
"symbolInfo": [
{
"id": "queryName",
"name": {
"text": "Query name"
},
"isVisible": true
},
{
"id": "returnType",
"name": {
"text": "Return type"
},
"isVisible": true
}
]
}
87 changes: 87 additions & 0 deletions src/Content/Backend/Query/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "One Beyond",
"classifications": [ "Common", "Code" ],
"name": "Monaco Query Template",
"identity": "Monaco.Template.Backend.Solution.Query",
"shortName": "monaco-backend-query",
"sourceName": "MyFeature",
"tags": {
"language": "C#",
"type": "item"
},
"symbols": {
"applicationProjectNamespace": {
"type": "bind",
"binding": "msbuild:RootNamespace",
"replaces": "ProjectName",
"defaultValue": "MyProjectNamespace"
},
"solutionName": {
"type": "derived",
"valueSource": "applicationProjectNamespace",
"valueTransform": "ValueAfterLastDot"
},
"commonSolutionNamespace": {
"type": "parameter",
"datatype": "text",
"defaultValue": "",
"displayName": "Solution Namespace"
},
"generatedSolutionNamespace": {
"type": "generated",
"generator": "switch",
//"replaces": "CommonSolutionName",
"parameters": {
"datatype": "text",
"cases": [
{
"condition": "(commonSolutionNamespace == '')",
"value": "(solutionName)"
},
{
"condition": "(commonSolutionNamespace != '')",
"value": "(commonSolutionNamespace)"
}
]
}
},
//"derivedSolutionNamespace": {
// "type": "derived",

//},
//"generatedSolutionNamespace": {
// "type": "generated",
// "generator": "coalesce",
// "parameters": {
// "sourceVariableName": "commonSolutionNamespace",
// "fallbackVariableName": "solutionName"
// },
// "replaces": "RootSolutionName"
//},
"queryName": {
"type": "parameter",
"datatype": "text",
"defaultValue": "GetItemsList",
"displayName": "Query name",
"description": "Name of the Query feature",
"replaces": "GetItemsList",
"fileRename": "GetItemsList"
},
"returnType": {
"type": "parameter",
"datatype": "text",
"defaultValue": "List<ItemDto>",
"displayName": "Return type",
"description": "Type of the return value",
"replaces": "List<ItemDto>"
}
},
"forms": {
"ValueAfterLastDot": {
"identifier": "replace",
"pattern": "([.\\w]+\\.)\\w+", // regex to match everything up to and including the final "."
"replacement": "" // replace it with empty string
}
}
}
27 changes: 27 additions & 0 deletions src/Content/Backend/Query/GetItemsList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using MediatR;
using Microsoft.Extensions.Primitives;
using ProjectName.DTOs;
using ProjectName.DTOs.Extensions;
using ProjectName.Infrastructure.Context;
using CommonSolutionName.Common.Application.Queries;
using CommonSolutionName.Common.Application.Queries.Extensions;

namespace ProjectName.Features.MyFeature;

public sealed class GetItemsList
{
public record Query(IEnumerable<KeyValuePair<string, StringValues>> QueryString) : QueryBase<List<ItemDto>>(QueryString);

public sealed class Handler : IRequestHandler<Query, List<ItemDto>>
{
private readonly AppDbContext _dbContext;

public Handler(AppDbContext dbContext)
{
_dbContext = dbContext;
}

public Task<List<ItemDto>> Handle(Query request, CancellationToken cancellationToken) =>
throw new NotImplementedException();
}
}

0 comments on commit 0d28e3d

Please sign in to comment.