(string appId)
| 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) |
nothing calls this directly
no test coverage detected