openreplay/api/chalicelib/core/usability_testing/schema.py
Rajesh Rajendran 4c7f2edd57
Api v1.16.0 (#1730)
* feat(api): usability testing (#1686)

* feat(api): usability testing - wip

* feat(db): usabiity testing

* feat(api): usability testing - api

* feat(api): usability testing - api

* feat(api): usability testing - db change

* feat(api): usability testing - db change

* feat(api): usability testing - unit tests update

* feat(api): usability testing - test and tasks stats

* feat(api): usability testing - sessions list fix, return zeros if test id is not having signals

* Api v1.16.0 (#1698)

* feat: canvas support [assist] (#1641)

* feat(tracker/ui): start canvas support

* feat(tracker): slpeer -> peerjs for canvas streams

* fix(ui): fix agent canvas peer id

* fix(ui): fix agent canvas peer id

* fix(ui): fix peer removal

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(ui): canvas support for ui

* fix(tracker): fix falling tests

* feat(ui): replay canvas in video

* feat(ui): refactor video streaming to draw on canvas

* feat(ui): 10hz check for canvas replay

* feat(ui): fix for tests

* feat(ui): fix for tests

* feat(ui): fix for tests

* feat(ui): fix for tests cov

* feat(ui): mroe test coverage

* fix(ui): styling

* fix(tracker): support backend settings for canvas

* feat(ui): allow devtools to be resizeable (#1605)

* fix(ui): console redux tab null check

* Api v1.15.0 (#1689)

* fix(chalice): fix create alert with MS Teams notification channel
closes openreplay/openreplay#1677

* fix(chalice): fix MS Teams notifications
* refactor(chalice): enhanced MS Teams notifications
closes openreplay/openreplay#1681

(cherry picked from commit 265897f509)

* fix(ui): filter keys conflcit with metadata, path analysis 4 col

* fix(ui): clear the filers and series on card type change

* fix(player): fix msg reader bug

* fix(DB): fix CH wrong version (#1692)

(cherry picked from commit 48dbbb55db)

* fix(ui): filter keys conflcit with metadata

* fix(tracker): unique broadcast channel name

* fix(chalice): fixed delete cards (#1697)

(cherry picked from commit 92fedd310c)

* fix(tracker): add trycatch to ignore iframe errors

* feat(backend): added ARM arch support to backend services [Dockerfile]

* feat(backend): removed userAgent from sessions and unstarted-sessions tables

* fix(DB): change path-analysis card size

---------

Co-authored-by: Delirium <nikita@openreplay.com>
Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
Co-authored-by: Alexander <zavorotynskiy@pm.me>

* refactor(chalice): cleaned code (#1699)

* feat(api): usability testing - added start_path to the resposne, remove count from the list

* feat(api): usability testing - test to have response count and live count

* feat(api): usability testing - test to have additional data

* Revert "refactor(chalice): cleaned code (#1699)" (#1702)

This reverts commit 83f2b0c12c.

* feat(api): usability testing - responses with total and other improvements

* change(api): vulnerability whitelist udpate

* feat(api): usability testing - create added missing columns, and sessions with user_id search

* feat(api): usability testing - update test with responseCount

* feat(api): usability testing - timestamps in unix

* feat(api): usability testing - request with proper case change

* feat(api): usability testing - task.description nullable

* feat(api): usability testing - check deleted status

* Api v1.16.0 (#1707)

* fix(chalice): fixed search sessions

* fix(chalice): fixed search sessions
* refactor(chalice): upgraded dependencies
* refactor(crons): upgraded dependencies
* refactor(alerts): upgraded dependencies

* Api v1.16.0 (#1712)

* feat(DB): user-testing support

* feat(chalice): user testing support

* feat(chalice): support utxVideo (#1726)

* feat(chalice): changed bucket name for ux testing webcamera videos

---------

Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
Co-authored-by: Kraiem Taha Yassine <tahayk2@gmail.com>
Co-authored-by: Delirium <nikita@openreplay.com>
Co-authored-by: Alexander <zavorotynskiy@pm.me>
2023-11-30 10:53:31 +01:00

134 lines
7.1 KiB
Python

from typing import Optional, List
from pydantic import Field
from datetime import datetime
from enum import Enum
from schemas import BaseModel
from pydantic.v1 import validator
class StatusEnum(str, Enum):
preview = 'preview'
in_progress = 'in-progress'
paused = 'paused'
closed = 'closed'
class UTTestTask(BaseModel):
task_id: Optional[int] = Field(None, description="The unique identifier of the task")
test_id: Optional[int] = Field(None, description="The unique identifier of the usability test")
title: str = Field(..., description="The title of the task")
description: Optional[str] = Field(None, description="A detailed description of the task")
allow_typing: Optional[bool] = Field(False, description="Indicates if the user is allowed to type")
class UTTestBase(BaseModel):
title: str = Field(..., description="The title of the usability test")
project_id: Optional[int] = Field(None, description="The ID of the associated project")
created_by: Optional[int] = Field(None, description="The ID of the user who created the test")
starting_path: Optional[str] = Field(None, description="The starting path for the usability test")
status: Optional[StatusEnum] = Field(StatusEnum.in_progress, description="The current status of the usability test")
require_mic: bool = Field(False, description="Indicates if a microphone is required")
require_camera: bool = Field(False, description="Indicates if a camera is required")
description: Optional[str] = Field(None, description="A detailed description of the usability test")
guidelines: Optional[str] = Field(None, description="Guidelines for the usability test")
conclusion_message: Optional[str] = Field(None, description="Conclusion message for the test participants")
visibility: bool = Field(False, description="Flag to indicate if the test is visible to the public")
tasks: Optional[List[UTTestTask]] = Field(None, description="List of tasks for the usability test")
class UTTestCreate(UTTestBase):
pass
class UTTestStatusUpdate(BaseModel):
status: StatusEnum = Field(..., description="The updated status of the usability test")
class UTTestRead(UTTestBase):
test_id: int = Field(..., description="The unique identifier of the usability test")
created_by: Optional[int] = Field(None, description="The ID of the user who created the test")
updated_by: Optional[int] = Field(None, description="The ID of the user who last updated the test")
created_at: datetime = Field(..., description="The timestamp when the test was created")
updated_at: datetime = Field(..., description="The timestamp when the test was last updated")
deleted_at: Optional[datetime] = Field(None, description="The timestamp when the test was deleted, if applicable")
class UTTestUpdate(BaseModel):
# Optional fields for updating the usability test
title: Optional[str] = Field(None, description="The updated title of the usability test")
status: Optional[StatusEnum] = Field(None, description="The updated status of the usability test")
description: Optional[str] = Field(None, description="The updated description of the usability test")
starting_path: Optional[str] = Field(None, description="The updated starting path for the usability test")
require_mic: Optional[bool] = Field(None, description="Indicates if a microphone is required")
require_camera: Optional[bool] = Field(None, description="Indicates if a camera is required")
guidelines: Optional[str] = Field(None, description="Updated guidelines for the usability test")
conclusion_message: Optional[str] = Field(None, description="Updated conclusion message for the test participants")
visibility: Optional[bool] = Field(None, description="Flag to indicate if the test is visible to the public")
tasks: Optional[List[UTTestTask]] = Field([], description="List of tasks for the usability test")
class UTTestDelete(BaseModel):
# You would usually not need a model for deletion, but let's assume you need to confirm the deletion timestamp
deleted_at: datetime = Field(..., description="The timestamp when the test is marked as deleted")
class UTTestSearch(BaseModel):
query: Optional[str] = Field(None, description="Search query for the UT tests")
page: Optional[int] = Field(1, ge=1, description="Page number of the results")
limit: Optional[int] = Field(10, ge=1, le=100, description="Number of results per page")
sort_by: Optional[str] = Field(description="Field to sort by", default="created_at")
sort_order: Optional[str] = Field("asc", description="Sort order: 'asc' or 'desc'")
is_active: Optional[bool] = Field(True, description="Flag to indicate if the test is active")
user_id: Optional[int] = Field(None, description="The ID of the user who created the test")
@validator('sort_order')
def sort_order_must_be_valid(cls, v):
if v not in ['asc', 'desc']:
raise ValueError('Sort order must be either "asc" or "desc"')
return v
class UTTestResponsesSearch(BaseModel):
query: Optional[str] = Field(None, description="Search query for the UT responses")
page: Optional[int] = Field(1, ge=1, description="Page number of the results")
limit: Optional[int] = Field(10, ge=1, le=100, description="Number of results per page")
class UTTestSignal(BaseModel):
signal_id: int = Field(..., description="The unique identifier of the response")
test_id: int = Field(..., description="The unique identifier of the usability test")
session_id: int = Field(..., description="The unique identifier of the session")
type: str = Field(..., description="The type of the signal")
type_id: int = Field(..., description="The unique identifier of the type")
status: str = Field(..., description="The status of the signal")
comment: Optional[str] = Field(None, description="The comment for the signal")
timestamp: datetime = Field(..., description="The timestamp when the signal was created")
class UTTestResponse(BaseModel):
test_id: int = Field(..., description="The unique identifier of the usability test")
response_id: str = Field(..., description="The type of the signal")
status: str = Field(..., description="The status of the signal")
comment: Optional[str] = Field(None, description="The comment for the signal")
timestamp: datetime = Field(..., description="The timestamp when the signal was created")
class UTTestSession(BaseModel):
test_id: int = Field(..., description="The unique identifier of the usability test")
session_id: int = Field(..., description="The unique identifier of the session")
status: str = Field(..., description="The status of the signal")
timestamp: datetime = Field(..., description="The timestamp when the signal was created")
class UTTestSessionsSearch(BaseModel):
page: Optional[int] = Field(1, ge=1, description="Page number of the results")
limit: Optional[int] = Field(10, ge=1, le=100, description="Number of results per page")
status: Optional[str] = Field(None, description="The status of the session")
class SearchResult(BaseModel):
results: List[UTTestRead]
total: int
page: int
limit: int