-
Notifications
You must be signed in to change notification settings - Fork 0
/
Function.cs
26 lines (22 loc) · 905 Bytes
/
Function.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;
namespace AuditHttpFunction
{
public class Function(ILogger<Function> logger, IAuditHttpService httpService)
{
[Function("Function1")]
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "buildings/{buildingId}/posts")] HttpRequest req, string buildingId)
{
logger.LogInformation("C# HTTP trigger function processed a request.");
var projectId = await GetProjectIdFromDbAsync(buildingId);
var posts = await httpService.GetBuildingPostsAsync(buildingId);
return new OkObjectResult(posts);
}
private async Task<string> GetProjectIdFromDbAsync(string buildingId)
{
return "123";
}
}
}