[backend/api] Add polls to CreateNote
This commit is contained in:
parent
189938af13
commit
735bdfe09a
2 changed files with 19 additions and 1 deletions
|
@ -555,6 +555,15 @@ public class NoteController(
|
||||||
? await db.DriveFiles.Where(p => request.MediaIds.Contains(p.Id)).ToListAsync()
|
? await db.DriveFiles.Where(p => request.MediaIds.Contains(p.Id)).ToListAsync()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
var poll = request.Poll != null
|
||||||
|
? new Poll
|
||||||
|
{
|
||||||
|
ExpiresAt = request.Poll.ExpiresAt,
|
||||||
|
Multiple = request.Poll.Multiple,
|
||||||
|
Choices = request.Poll.Choices,
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
var note = await noteSvc.CreateNoteAsync(new NoteService.NoteCreationData
|
var note = await noteSvc.CreateNoteAsync(new NoteService.NoteCreationData
|
||||||
{
|
{
|
||||||
User = user,
|
User = user,
|
||||||
|
@ -563,7 +572,8 @@ public class NoteController(
|
||||||
Cw = request.Cw,
|
Cw = request.Cw,
|
||||||
Reply = reply,
|
Reply = reply,
|
||||||
Renote = renote,
|
Renote = renote,
|
||||||
Attachments = attachments
|
Attachments = attachments,
|
||||||
|
Poll = poll
|
||||||
});
|
});
|
||||||
|
|
||||||
if (request.IdempotencyKey != null)
|
if (request.IdempotencyKey != null)
|
||||||
|
|
|
@ -9,4 +9,12 @@ public class NoteCreateRequest
|
||||||
public List<string>? MediaIds { get; set; }
|
public List<string>? MediaIds { get; set; }
|
||||||
public required NoteVisibility Visibility { get; set; }
|
public required NoteVisibility Visibility { get; set; }
|
||||||
public string? IdempotencyKey { get; set; }
|
public string? IdempotencyKey { get; set; }
|
||||||
|
public PollRequest? Poll { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PollRequest
|
||||||
|
{
|
||||||
|
public required DateTime? ExpiresAt { get; set; }
|
||||||
|
public required bool Multiple { get; set; }
|
||||||
|
public required List<string> Choices { get; set; }
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue