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

Method GetAppById

src/Features/Apps/AppsController.cs:129–152  ·  view source on GitHub ↗
(string appId)

Source from the content-addressed store, hash-verified

127 }
128
129 [HttpGet("/api/_apps/{appId}")]
130 public async Task<IActionResult> GetAppById(string appId)
131 {
132 var user = this.GetCurrentUserIdentity();
133
134 var app = await _db.Connection.QueryFirstOrDefaultAsync<Application>(
135 @"SELECT a.id, a.name, a.icon_path, a.app_key,
136 a.owner_id = @userId as has_ownership, a.has_events,
137 u.lock_reason
138 FROM apps a
139 LEFT JOIN app_shares s
140 ON s.app_id = a.id
141 INNER JOIN users u
142 ON u.id = a.owner_id
143 WHERE a.id = @appId
144 AND (a.owner_id = @userId OR s.email = @userEmail)
145 AND a.deleted_at IS NULL
146 GROUP BY a.id, a.name, a.icon_path, a.app_key, u.lock_reason
147 ORDER by a.name",
148 new { appId, userId = user.Id, userEmail = user.Email }
149 );
150
151 return Ok(app);
152 }
153
154 [HttpPut("/api/_apps/{appId}")]
155 public async Task<IActionResult> Update(string appId, [FromBody] UpdateAppRequestBody body, CancellationToken cancellationToken)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected