Skip to content

List of bugs & todo and possible improvements #2

@Zeinok

Description

@Zeinok

Major

  • MAC isn't swapped after swapping bed owners.
    @bp_bed_change.route("/bed-change", methods=["PUT"])
    @permission("api.bed.exchange")
    async def exchange_bed(request):
    source_bed = request.json["source_bed"]
    dest_bed = request.json["dest_bed"]
    # for validate uid
    # source_username = request.json["source_username"]
    # dest_username = request.json["dest_username"]
    source_ip = await Ip.get_ip_by_bed(source_bed)
    dest_ip = await Ip.get_ip_by_bed(dest_bed)
    if source_ip is None or dest_ip is None:
    return messages.BAD_REQUEST
    source_uid = source_ip[0]["uid"]
    dest_uid = dest_ip[0]["uid"]
    await Ip.assign_user(dest_ip[0]["ip"], source_uid)
    await Ip.assign_user(source_ip[0]["ip"], dest_uid)
    return messages.OPERATION_SUCCESS
  • UNIQUE exception is not handled.
    if await MAC.set_mac(target_ip["ip"], mac):

    async def set_mac(ip: str, mac: str) -> bool:
    """Set mac by account_id
    Args:
    ip: ip
    mac:mac address
    Returns:
    bool, If set success return True, if catch error return False.
    """
    async with SQLPool.acquire() as conn:
    async with conn.cursor() as cur:
    sql = (
    "UPDATE `iptable` SET `mac` = %s,`is_updated` = 0 WHERE `ip` = %s "
    )
    para_input = (mac, ip)
    await cur.execute(sql, para_input)
    await conn.commit()
    return True

Minor & To-do

  • Remove legacy aiohttp instance under app in backend.py and move to Base.aiohttpSession.
    app.aiohttp_session = aiohttp.ClientSession(loop=loop)
  • BackgroundJobs/bulk_import.py is untested.
  • Add limit parameter in api.management.user.query. (Querying admin accounts returns all IP)

Missing API endpoints

  • User creation/deletion
  • Role(refered as group in source code) assignment/revocation

Possible Improvements

  • Move bed change log and action log to MySQL and use MongoDB entirely just for API access details.
  • Merge /api/management/ route to /api/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions