MCPcopy Create free account
hub / github.com/aptabase/aptabase / Create

Method Create

src/Features/Apps/AppsController.cs:104–127  ·  view source on GitHub ↗
([FromBody] CreateAppRequestBody body)

Source from the content-addressed store, hash-verified

102 }
103
104 [HttpPost("/api/_apps")]
105 public async Task<IActionResult> Create([FromBody] CreateAppRequestBody body)
106 {
107 var user = this.GetCurrentUserIdentity();
108 var app = new Application
109 {
110 Id = NanoId.New(),
111 Name = body.Name,
112 AppKey = $"A-{_env.Region}-{NanoId.Numbers(10)}"
113 };
114
115 await _db.Connection.ExecuteScalarAsync<string>(@"
116 INSERT INTO apps (id, owner_id, name, app_key, has_events)
117 VALUES (@appId, @ownerId, @name, @appKey, false)",
118 new
119 {
120 appId = app.Id,
121 ownerId = user.Id,
122 name = app.Name,
123 appKey = app.AppKey
124 });
125
126 return Ok(app);
127 }
128
129 [HttpGet("/api/_apps/{appId}")]
130 public async Task<IActionResult> GetAppById(string appId)

Callers 4

Program.csFile · 0.45
UserAccountClass · 0.45
TrackEventMethod · 0.45
TrackEventsMethod · 0.45

Calls 3

NewMethod · 0.80
NumbersMethod · 0.80

Tested by

no test coverage detected