Files
Andy Copland 50fe0bb746 fix: Add OAuth support to search query source enum (#9511)
- Add 'oauth' to SearchQuery enum in server and client models
- Add database migration to include 'oauth' in enum_search_queries_source
- Fixes 400 validation error when OAuth users search with parameters

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-01 03:37:25 -04:00

37 lines
740 B
TypeScript

import { client } from "~/utils/ApiClient";
import Model from "./base/Model";
class SearchQuery extends Model {
static modelName = "Search";
/**
* The query string, automatically truncated to 255 characters.
*/
query: string;
/**
* Where the query originated.
*/
source: "api" | "app" | "slack" | "oauth";
delete = async () => {
this.isSaving = true;
try {
await client.post(`/searches.delete`, {
query: this.query,
});
this.store.data.forEach((searchQuery: SearchQuery) => {
if (searchQuery.query === this.query) {
this.store.remove(searchQuery.id);
}
});
} finally {
this.isSaving = false;
}
};
}
export default SearchQuery;