"""User-related utility functions.""" from analytics.consts.user import AccountTypes from analytics.models import user def create(user_id, user_type): """Create user based on a set of data. Args: user_id (int): the user id. user_type (str): the user type. Returns: User, status: the user information and the status of the request. If an error has happened when commiting the information, a 500 is returned. """ return user.create_user(user_id=user_id, user_type=user_type) def is_user_vendor(user): """Check if a user is a vendor. Args: user (User): the user object. Returns: bool: if the user is a label. """ return user.user_type == AccountTypes.VENDOR def is_user_subaccount(user): """Check if a user is a subaccount. Args: user (User): the user object. Returns: bool: if the user is a subaccount. """ return user.user_type == AccountTypes.SUBACCOUNT