Beispiel #1
0
def make_star_false(filesystem_id: str) -> None:
    source = get_source(filesystem_id)
    if not source.star:
        source_star = SourceStar(source)
        db.session.add(source_star)
        db.session.commit()
    source.star.starred = False
Beispiel #2
0
def make_star_true(filesystem_id: str) -> None:
    source = get_source(filesystem_id)
    if source.star:
        source.star.starred = True
    else:
        source_star = SourceStar(source)
        db.session.add(source_star)
Beispiel #3
0
def star_source(source: Source) -> None:
    """
    Adds a SourceStar record for the source.
    """
    star = SourceStar(source, True)
    db.session.add(star)
    db.session.commit()
Beispiel #4
0
 def new_source_star(self, source_id):
     source = Source.query.get(source_id)
     star = SourceStar(source, bool_or_none())
     db.session.add(star)
Beispiel #5
0
 def new_source_star(self, source_id: int) -> None:
     source = Source.query.get(source_id)
     star = SourceStar(source, random.choice([True, False]))
     db.session.add(star)