Skip to content

Commit

Permalink
Merge pull request #943 from open-rmf/hammer/fix-favorite-with-labels
Browse files Browse the repository at this point in the history
Hammer/fix favorite with labels
  • Loading branch information
aaronchongth authored Apr 30, 2024
2 parents 2327f5b + f872e22 commit 0d6f019
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 165 deletions.
120 changes: 33 additions & 87 deletions packages/api-client/lib/openapi/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,55 +431,6 @@ export interface ApiServerModelsTortoiseModelsScheduledTaskScheduledTaskSchedule
*/
at?: string | null;
}
/**
*
* @export
* @interface ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
export interface ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf {
/**
*
* @type {string}
* @memberof ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
id: string;
/**
*
* @type {string}
* @memberof ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
name: string;
/**
*
* @type {string}
* @memberof ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
unix_millis_earliest_start_time?: string | null;
/**
*
* @type {any}
* @memberof ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
priority?: any;
/**
*
* @type {string}
* @memberof ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
category: string;
/**
*
* @type {any}
* @memberof ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
description?: any;
/**
*
* @type {string}
* @memberof ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf
*/
user: string;
}
/**
* Which agent (robot) is the task assigned to
* @export
Expand Down Expand Up @@ -2657,51 +2608,57 @@ export interface TaskEventLog {
/**
*
* @export
* @interface TaskFavoritePydantic
* @interface TaskFavorite
*/
export interface TaskFavoritePydantic {
export interface TaskFavorite {
/**
*
* @type {string}
* @memberof TaskFavoritePydantic
* @memberof TaskFavorite
*/
id: string;
/**
*
* @type {string}
* @memberof TaskFavoritePydantic
* @memberof TaskFavorite
*/
name: string;
/**
*
* @type {number}
* @memberof TaskFavoritePydantic
* @memberof TaskFavorite
*/
unix_millis_earliest_start_time: number;
/**
*
* @type {object}
* @memberof TaskFavoritePydantic
* @memberof TaskFavorite
*/
priority?: object;
/**
*
* @type {string}
* @memberof TaskFavoritePydantic
* @memberof TaskFavorite
*/
category: string;
/**
*
* @type {object}
* @memberof TaskFavoritePydantic
* @memberof TaskFavorite
*/
description?: object;
/**
*
* @type {string}
* @memberof TaskFavoritePydantic
* @memberof TaskFavorite
*/
user: string;
/**
*
* @type {Array<string>}
* @memberof TaskFavorite
*/
labels?: Array<string>;
}
/**
*
Expand Down Expand Up @@ -8885,20 +8842,16 @@ export const TasksApiAxiosParamCreator = function (configuration?: Configuration
/**
*
* @summary Post Favorite Task
* @param {TaskFavoritePydantic} taskFavoritePydantic
* @param {TaskFavorite} taskFavorite
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
postFavoriteTaskFavoriteTasksPost: async (
taskFavoritePydantic: TaskFavoritePydantic,
taskFavorite: TaskFavorite,
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
// verify required parameter 'taskFavoritePydantic' is not null or undefined
assertParamExists(
'postFavoriteTaskFavoriteTasksPost',
'taskFavoritePydantic',
taskFavoritePydantic,
);
// verify required parameter 'taskFavorite' is not null or undefined
assertParamExists('postFavoriteTaskFavoriteTasksPost', 'taskFavorite', taskFavorite);
const localVarPath = `/favorite_tasks`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
Expand All @@ -8921,7 +8874,7 @@ export const TasksApiAxiosParamCreator = function (configuration?: Configuration
...options.headers,
};
localVarRequestOptions.data = serializeDataIfNeeded(
taskFavoritePydantic,
taskFavorite,
localVarRequestOptions,
configuration,
);
Expand Down Expand Up @@ -9654,9 +9607,7 @@ export const TasksApiFp = function (configuration?: Configuration) {
*/
async getFavoritesTasksFavoriteTasksGet(
options?: AxiosRequestConfig,
): Promise<
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<TaskFavoritePydantic>>
> {
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<TaskFavorite>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getFavoritesTasksFavoriteTasksGet(
options,
);
Expand Down Expand Up @@ -9846,21 +9797,16 @@ export const TasksApiFp = function (configuration?: Configuration) {
/**
*
* @summary Post Favorite Task
* @param {TaskFavoritePydantic} taskFavoritePydantic
* @param {TaskFavorite} taskFavorite
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async postFavoriteTaskFavoriteTasksPost(
taskFavoritePydantic: TaskFavoritePydantic,
taskFavorite: TaskFavorite,
options?: AxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise<ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf>
> {
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.postFavoriteTaskFavoriteTasksPost(
taskFavoritePydantic,
taskFavorite,
options,
);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
Expand Down Expand Up @@ -10191,7 +10137,7 @@ export const TasksApiFactory = function (
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFavoritesTasksFavoriteTasksGet(options?: any): AxiosPromise<Array<TaskFavoritePydantic>> {
getFavoritesTasksFavoriteTasksGet(options?: any): AxiosPromise<Array<TaskFavorite>> {
return localVarFp
.getFavoritesTasksFavoriteTasksGet(options)
.then((request) => request(axios, basePath));
Expand Down Expand Up @@ -10345,16 +10291,16 @@ export const TasksApiFactory = function (
/**
*
* @summary Post Favorite Task
* @param {TaskFavoritePydantic} taskFavoritePydantic
* @param {TaskFavorite} taskFavorite
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
postFavoriteTaskFavoriteTasksPost(
taskFavoritePydantic: TaskFavoritePydantic,
taskFavorite: TaskFavorite,
options?: any,
): AxiosPromise<ApiServerModelsTortoiseModelsTasksTaskFavoriteLeaf> {
): AxiosPromise<any> {
return localVarFp
.postFavoriteTaskFavoriteTasksPost(taskFavoritePydantic, options)
.postFavoriteTaskFavoriteTasksPost(taskFavorite, options)
.then((request) => request(axios, basePath));
},
/**
Expand Down Expand Up @@ -10815,17 +10761,17 @@ export class TasksApi extends BaseAPI {
/**
*
* @summary Post Favorite Task
* @param {TaskFavoritePydantic} taskFavoritePydantic
* @param {TaskFavorite} taskFavorite
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TasksApi
*/
public postFavoriteTaskFavoriteTasksPost(
taskFavoritePydantic: TaskFavoritePydantic,
taskFavorite: TaskFavorite,
options?: AxiosRequestConfig,
) {
return TasksApiFp(this.configuration)
.postFavoriteTaskFavoriteTasksPost(taskFavoritePydantic, options)
.postFavoriteTaskFavoriteTasksPost(taskFavorite, options)
.then((request) => request(this.axios, this.basePath));
}

Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/lib/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { version as rmfModelVer } from 'rmf-models';

export const version = {
rmfModels: rmfModelVer,
rmfServer: 'e78c8685138183b4743776c71ff2c1d990ea52f5',
rmfServer: '4c9eb01b568dd3b5e98d46fd3571d2e5b173179e',
openapiGenerator: '6.2.1',
};
37 changes: 6 additions & 31 deletions packages/api-client/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ export default {
schema: {
title: 'Response Get Favorites Tasks Favorite Tasks Get',
type: 'array',
items: { $ref: '#/components/schemas/TaskFavoritePydantic' },
items: { $ref: '#/components/schemas/TaskFavorite' },
},
},
},
Expand All @@ -1565,20 +1565,14 @@ export default {
operationId: 'post_favorite_task_favorite_tasks_post',
requestBody: {
content: {
'application/json': { schema: { $ref: '#/components/schemas/TaskFavoritePydantic' } },
'application/json': { schema: { $ref: '#/components/schemas/TaskFavorite' } },
},
required: true,
},
responses: {
'200': {
description: 'Successful Response',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/api_server.models.tortoise_models.tasks.TaskFavorite.leaf',
},
},
},
content: { 'application/json': { schema: {} } },
},
'422': {
description: 'Validation Error',
Expand Down Expand Up @@ -3734,8 +3728,8 @@ export default {
},
additionalProperties: false,
},
TaskFavoritePydantic: {
title: 'TaskFavoritePydantic',
TaskFavorite: {
title: 'TaskFavorite',
required: ['id', 'name', 'unix_millis_earliest_start_time', 'category', 'user'],
type: 'object',
properties: {
Expand All @@ -3749,6 +3743,7 @@ export default {
category: { title: 'Category', type: 'string' },
description: { title: 'Description', type: 'object' },
user: { title: 'User', type: 'string' },
labels: { title: 'Labels', type: 'array', items: { type: 'string' } },
},
},
TaskInterruptionRequest: {
Expand Down Expand Up @@ -4263,26 +4258,6 @@ export default {
$ref: '#/components/schemas/api_server.models.tortoise_models.scheduled_task.ScheduledTask',
},
},
'api_server.models.tortoise_models.tasks.TaskFavorite.leaf': {
title: 'TaskFavorite',
required: ['id', 'name', 'category', 'user'],
type: 'object',
properties: {
id: { title: 'Id', maxLength: 255, type: 'string' },
name: { title: 'Name', maxLength: 255, type: 'string' },
unix_millis_earliest_start_time: {
title: 'Unix Millis Earliest Start Time',
type: 'string',
format: 'date-time',
nullable: true,
},
priority: { title: 'Priority' },
category: { title: 'Category', maxLength: 255, type: 'string' },
description: { title: 'Description' },
user: { title: 'User', maxLength: 255, type: 'string' },
},
additionalProperties: false,
},
api_server__models__delivery_alerts__DeliveryAlert__Category: {
title: 'Category',
enum: ['missing', 'wrong', 'obstructed', 'cancelled'],
Expand Down
1 change: 1 addition & 0 deletions packages/api-server/api_server/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@
from .rmf_api.undo_skip_phase_request import UndoPhaseSkipRequest
from .rmf_api.undo_skip_phase_response import UndoPhaseSkipResponse
from .task_booking_label import *
from .task_favorite import *
from .user import *
14 changes: 14 additions & 0 deletions packages/api-server/api_server/models/task_favorite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Dict, List

from pydantic import BaseModel


class TaskFavorite(BaseModel):
id: str
name: str
unix_millis_earliest_start_time: int
priority: Dict | None
category: str
description: Dict | None
user: str
labels: List[str] | None
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
TaskEventLogPhasesEventsLog,
TaskEventLogPhasesLog,
TaskFavorite,
TaskFavoritePydantic,
TaskRequest,
TaskState,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from tortoise.contrib.pydantic.creator import pydantic_model_creator
from tortoise.fields import (
CharField,
DatetimeField,
Expand Down Expand Up @@ -80,6 +79,4 @@ class TaskFavorite(Model):
category = CharField(255, null=False, index=True)
description = JSONField()
user = CharField(255, null=False, index=True)


TaskFavoritePydantic = pydantic_model_creator(TaskFavorite)
labels = JSONField(null=True, default=list)
Loading

0 comments on commit 0d6f019

Please sign in to comment.