Harden media and follow-up handling
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Bson;
|
||||
using QuestionsApi.Models;
|
||||
|
||||
namespace QuestionsApi.Services;
|
||||
@@ -29,6 +30,11 @@ public class QuestionMediaStore
|
||||
return asset;
|
||||
}
|
||||
|
||||
public async Task<QuestionMediaAsset?> GetAsync(string id) =>
|
||||
await _col.Find(asset => asset.Id == id).FirstOrDefaultAsync();
|
||||
public async Task<QuestionMediaAsset?> GetAsync(string id)
|
||||
{
|
||||
if (!ObjectId.TryParse(id, out _))
|
||||
return null;
|
||||
|
||||
return await _col.Find(asset => asset.Id == id).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Bson;
|
||||
using QuestionsApi.Models;
|
||||
|
||||
namespace QuestionsApi.Services;
|
||||
@@ -102,6 +103,7 @@ public class QuestionStore
|
||||
}
|
||||
else
|
||||
{
|
||||
question.Id = ObjectId.GenerateNewId().ToString();
|
||||
question.CreatedUtc = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,7 +1053,7 @@ func _choice_row_size(_index: int, choice_id: String, has_visible_followup: bool
|
||||
if followup_states.has(choice_id):
|
||||
var state: Dictionary = followup_states[choice_id]
|
||||
if bool(state.get("collapsed", false)):
|
||||
return Vector2(0, 110)
|
||||
return Vector2(0, 136)
|
||||
return Vector2(0, 300)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user