@Summary Get organization by user and organization name @ID get-organization-by-user-and-organization-name @Security CoderSessionToken @Produce json @Tags Users @Param user path string true "User ID, name, or me" @Param organizationname path string true "Organization name" @Success 200 {object} code
(rw http.ResponseWriter, r *http.Request)
| 1893 | // @Success 200 {object} codersdk.Organization |
| 1894 | // @Router /api/v2/users/{user}/organizations/{organizationname} [get] |
| 1895 | func (api *API) organizationByUserAndName(rw http.ResponseWriter, r *http.Request) { |
| 1896 | ctx := r.Context() |
| 1897 | organizationName := chi.URLParam(r, "organizationname") |
| 1898 | organization, err := api.Database.GetOrganizationByName(ctx, database.GetOrganizationByNameParams{ |
| 1899 | Name: organizationName, |
| 1900 | Deleted: false, |
| 1901 | }) |
| 1902 | if httpapi.Is404Error(err) { |
| 1903 | httpapi.ResourceNotFound(rw) |
| 1904 | return |
| 1905 | } |
| 1906 | if err != nil { |
| 1907 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 1908 | Message: "Internal error fetching organization.", |
| 1909 | Detail: err.Error(), |
| 1910 | }) |
| 1911 | return |
| 1912 | } |
| 1913 | |
| 1914 | httpapi.Write(ctx, rw, http.StatusOK, db2sdk.Organization(organization)) |
| 1915 | } |
| 1916 | |
| 1917 | type CreateUserRequest struct { |
| 1918 | codersdk.CreateUserRequestWithOrgs |
nothing calls this directly
no test coverage detected