68 lines
2.3 KiB
Cheetah
68 lines
2.3 KiB
Cheetah
$GENERATED_CS_COMMENT
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
using Newtonsoft.Json;
|
|
using ${env['packagename']}.Attributes;
|
|
using ${env['packagename']}.Models;
|
|
using ${env['packagename']}.Controllers;
|
|
|
|
namespace ${env['packagename']}.Implementations
|
|
{
|
|
public class RegularApiImplementation : RegularApiController
|
|
{
|
|
#for $operation in $operations
|
|
#if $operation['method'] == 'get'
|
|
public override IActionResult ${operation['func']}( #slurp
|
|
#if $operation['byIdSelector']
|
|
INSERT CODE TO GET ID #slurp
|
|
#elif $operation['inputType']
|
|
[FromBody]$operation['inputType']['csName'] inputItem #slurp
|
|
#end if
|
|
) {
|
|
// Statement:
|
|
#if not $operation['statement']
|
|
// SELECT
|
|
#set $sep = ""
|
|
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
|
// $sep$property['sqlName']
|
|
#set $sep = ","
|
|
#end for
|
|
// FROM $types[$operation['resultType']['apiName']]['sqlName'];
|
|
#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']
|
|
// $property['sqlName'] -> $property['csName']
|
|
#end for
|
|
#end if
|
|
// Model object to use: $operation['resultType']['apiName'] -> $operation['resultType']['csName']
|
|
// Properties to map result:
|
|
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
|
// $property['sqlName'] -> $property['csName']
|
|
#end for
|
|
#if $operation['isList']
|
|
// result must be mapped in list
|
|
#end if
|
|
return new ObjectResult();
|
|
}
|
|
|
|
#elif $operation['method'] == 'post'
|
|
bla
|
|
|
|
#else
|
|
#raise Exception('invalid method')
|
|
#end if
|
|
|
|
#end for
|
|
|
|
}
|
|
}
|