generate all script, service integration and injection
This commit is contained in:
@ -11,20 +11,42 @@ using Newtonsoft.Json;
|
||||
using ${env['packagename']}.Attributes;
|
||||
using ${env['packagename']}.Models;
|
||||
using ${env['packagename']}.Controllers;
|
||||
using ${env['packagename']}.Services;
|
||||
|
||||
namespace ${env['packagename']}.Implementations
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class RegularApiImplementation : RegularApiController
|
||||
{
|
||||
|
||||
private readonly IDbService _dbService;
|
||||
public RegularApiImplementation(IDbService dbService) {
|
||||
_dbService = dbService;
|
||||
}
|
||||
|
||||
#for $operation in $operations
|
||||
#if $operation['method'] == 'get'
|
||||
/// <summary>
|
||||
/// $operation['description']
|
||||
/// </summary>
|
||||
public override IActionResult ${operation['func']}( #slurp
|
||||
#if $operation['byIdSelector']
|
||||
INSERT CODE TO GET ID #slurp
|
||||
#elif $operation['inputType']
|
||||
[FromBody]$operation['inputType']['csName'] inputItem #slurp
|
||||
#if $operation['paramsInputTypes']
|
||||
#set $sep = ""
|
||||
#for $paramsInputType in $operation['paramsInputTypes']
|
||||
$sep [FromRoute (Name = "$paramsInputType['name']")] #slurp
|
||||
#if $paramsInputType['required']
|
||||
[Required] #slurp
|
||||
#end if
|
||||
$paramsInputType['type'] $paramsInputType['name'] #slurp
|
||||
#set $sep = ","
|
||||
#end for
|
||||
#elif $operation['bodyInputType']
|
||||
[FromBody]$operation['bodyInputType']['csName'] $operation['bodyInputType']['apiName'] #slurp
|
||||
#end if
|
||||
) {
|
||||
) {
|
||||
_dbService.JustDoSomething("Hello ${operation['func']}");
|
||||
|
||||
// Statement:
|
||||
#if not $operation['statement']
|
||||
// SELECT
|
||||
@ -37,9 +59,9 @@ namespace ${env['packagename']}.Implementations
|
||||
#else
|
||||
// $operation['statement']
|
||||
#end if
|
||||
#if $operation['inputType']
|
||||
// Input type mapping: $operation['inputType']['apiName'] -> $operation['inputType']['csName']
|
||||
#for $property in $types[$operation['inputType']['apiName']]['properties']
|
||||
#if $operation['bodyInputType']
|
||||
// Input type mapping: $operation['bodyInputType']['apiName'] -> $operation['bodyInputType']['csName']
|
||||
#for $property in $types[$operation['bodyInputType']['apiName']]['properties']
|
||||
// $property['sqlName'] -> $property['csName']
|
||||
#end for
|
||||
#end if
|
||||
@ -51,11 +73,17 @@ namespace ${env['packagename']}.Implementations
|
||||
#if $operation['isList']
|
||||
// result must be mapped in list
|
||||
#end if
|
||||
return new ObjectResult();
|
||||
return new ObjectResult(null);
|
||||
}
|
||||
|
||||
#elif $operation['method'] == 'post'
|
||||
bla
|
||||
// INSERT
|
||||
|
||||
#elif $operation['method'] == 'put'
|
||||
// UPDATE
|
||||
|
||||
#elif $operation['method'] == 'delete'
|
||||
// DELETE
|
||||
|
||||
#else
|
||||
#raise Exception('invalid method')
|
||||
|
Reference in New Issue
Block a user