implement media serving
This commit is contained in:
@@ -9,7 +9,6 @@ public class AobaService(IMongoDatabase db)
|
||||
{
|
||||
private readonly IMongoCollection<Media> _media = db.GetCollection<Media>("media");
|
||||
|
||||
|
||||
public async Task<Media?> GetMediaAsync(ObjectId id)
|
||||
{
|
||||
return await _media.Find(m => m.Id == id).FirstOrDefaultAsync();
|
||||
@@ -19,4 +18,9 @@ public class AobaService(IMongoDatabase db)
|
||||
{
|
||||
return _media.InsertOneAsync(media);
|
||||
}
|
||||
|
||||
public Task IncrementViewCountAsync(ObjectId id)
|
||||
{
|
||||
return _media.UpdateOneAsync(m => m.Id == id, Builders<Media>.Update.Inc(m => m.ViewCount, 1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user