feat: add user-based ticket endpoints
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Matrix42.Extensions.Scaffolder.Core.Project;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Matrix42.Extensions.Scaffolder.Core.Functionality
|
||||
{
|
||||
public interface IProjectFunctionalityDefinition
|
||||
{
|
||||
ProjectFunctionality Kind { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Files to create for this functionality (relative paths, template content).
|
||||
/// </summary>
|
||||
IEnumerable<TemplateFile> GetFiles(ExtensionScaffoldingOptions options, ProjectDefinition project);
|
||||
|
||||
/// <summary>
|
||||
/// References to add to the csproj.
|
||||
/// </summary>
|
||||
IEnumerable<ProjectReferenceDefinition> GetReferences(ExtensionScaffoldingOptions options, ProjectDefinition project);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using Matrix42.Extensions.Scaffolder.Core.Project;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Matrix42.Extensions.Scaffolder.Core.Functionality
|
||||
{
|
||||
public sealed class WebApiFunctionalityDefinition : IProjectFunctionalityDefinition
|
||||
{
|
||||
public ProjectFunctionality Kind => ProjectFunctionality.WebApi;
|
||||
|
||||
public IEnumerable<TemplateFile> GetFiles(
|
||||
ExtensionScaffoldingOptions options,
|
||||
ProjectDefinition project)
|
||||
{
|
||||
var ns = options.ExtensionNamespace;
|
||||
|
||||
yield return new TemplateFile
|
||||
{
|
||||
RelativePath = @"Controllers\TestController.cs",
|
||||
Content = WebApi_TestControllerTemplate.Replace("{ns}", ns),
|
||||
CreateIfMissingOnly = true
|
||||
};
|
||||
}
|
||||
|
||||
public IEnumerable<ProjectReferenceDefinition> GetReferences(ExtensionScaffoldingOptions options, ProjectDefinition project)
|
||||
{
|
||||
yield return new ProjectReferenceDefinition
|
||||
{
|
||||
Include = "Matrix42.WebApi.Contracts",
|
||||
HintPath = @"..\..\..\..\Root\bin\Matrix42.WebApi.Contracts.dll"
|
||||
};
|
||||
|
||||
yield return new ProjectReferenceDefinition
|
||||
{
|
||||
Include = "Matrix42.Hosting.Contracts",
|
||||
HintPath = @"..\..\..\..\Root\bin\Matrix42.Hosting.Contracts.dll"
|
||||
};
|
||||
}
|
||||
|
||||
private const string WebApi_TestControllerTemplate =
|
||||
@"
|
||||
using Matrix42.WebApi.Contracts;
|
||||
using Matrix42.Hosting.Contracts;
|
||||
|
||||
namespace {ns}.Services
|
||||
{
|
||||
[RoutePrefix(""api/test"")]
|
||||
public class TestController : ApiController
|
||||
{
|
||||
private readonly IDependencyResolver _resolver;
|
||||
|
||||
public TestController(IDependencyResolver resolver)
|
||||
{
|
||||
_resolver = resolver;
|
||||
}
|
||||
|
||||
[HttpPost, Route(""test"")]
|
||||
public string TestMethod()
|
||||
{
|
||||
// TODO: implement your test method logic
|
||||
return ""OK"";
|
||||
}
|
||||
}
|
||||
}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user