Inserts a new record into the table. Preconditions: All data validations should be completed before calling this method.
(
cls,
url: str,
submitter: str,
reviewer: str | None = None,
status: int = STATUS["PENDING"],
comment: str | None = None,
title: str | None = None,
mr_type: int | None = None,
)
| 167 | |
| 168 | @classmethod |
| 169 | def submit_request( |
| 170 | cls, |
| 171 | url: str, |
| 172 | submitter: str, |
| 173 | reviewer: str | None = None, |
| 174 | status: int = STATUS["PENDING"], |
| 175 | comment: str | None = None, |
| 176 | title: str | None = None, |
| 177 | mr_type: int | None = None, |
| 178 | ): |
| 179 | """ |
| 180 | Inserts a new record into the table. |
| 181 | |
| 182 | Preconditions: All data validations should be completed before calling this method. |
| 183 | """ |
| 184 | oldb = db.get_db() |
| 185 | |
| 186 | comments = [cls.create_comment(submitter, comment)] if comment else [] |
| 187 | json_comment = json.dumps({"comments": comments}) |
| 188 | |
| 189 | return oldb.insert( |
| 190 | cls.TABLENAME, |
| 191 | submitter=submitter, |
| 192 | reviewer=reviewer, |
| 193 | url=url, |
| 194 | status=status, |
| 195 | comments=json_comment, |
| 196 | title=title, |
| 197 | mr_type=mr_type, |
| 198 | ) |
| 199 | |
| 200 | @classmethod |
| 201 | def assign_request(cls, rid: int, reviewer: str | None) -> dict[str, str | None]: |
no test coverage detected