-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetActionsCDB.cs
43 lines (36 loc) · 1.23 KB
/
GetActionsCDB.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.IO;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Microsoft.StaffActions.Action.Functions
{
public static class GetActionsCDB
{
// http://localhost:7071/api/actions/
[FunctionName("GetActionsCDB")]
public static IActionResult Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "actions")] HttpRequest req,
[CosmosDB(
databaseName: "actions-db",
collectionName: "actions",
ConnectionStringSetting = "CosmosDBConnection",
SqlQuery = "SELECT top 100 * FROM c"
)] IEnumerable<dynamic> actionItems,
ILogger log)
{
log.LogInformation("Invocation of GetActionsCDB");
return new OkObjectResult(actionItems);
}
}
}
/*
sample queries
Get a list of all actions where there is a child contributor with an id of 1003
SELECT * FROM c WHERE ARRAY_CONTAINS(c.Contributors, {"ID" : 1003}, true)
*/