lab4
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct User {
|
||||
std::string id;
|
||||
std::string username;
|
||||
std::string display_name;
|
||||
std::string password_hash;
|
||||
std::string created_at;
|
||||
};
|
||||
|
||||
struct Chat {
|
||||
std::string id;
|
||||
std::string title;
|
||||
std::vector<std::string> member_ids;
|
||||
std::string created_at;
|
||||
};
|
||||
|
||||
struct Message {
|
||||
std::string id;
|
||||
std::string chat_id;
|
||||
std::string sender_id;
|
||||
std::string text;
|
||||
std::string created_at;
|
||||
std::vector<std::string> attachment_ids;
|
||||
};
|
||||
|
||||
struct MessagePage {
|
||||
std::vector<Message> items;
|
||||
std::optional<std::string> next_cursor;
|
||||
};
|
||||
|
||||
struct ChatPage {
|
||||
std::vector<Chat> items;
|
||||
std::optional<std::string> next_cursor;
|
||||
};
|
||||
|
||||
// Lab4: variants stay empty ([]); lab5 fills thumbnail/crop/optimized.
|
||||
struct Variant {
|
||||
std::string name;
|
||||
std::string content_type;
|
||||
int size_bytes = 0;
|
||||
std::string sha256;
|
||||
};
|
||||
|
||||
struct Attachment {
|
||||
std::string id;
|
||||
std::string chat_id;
|
||||
std::string owner_id;
|
||||
std::string filename;
|
||||
std::string content_type;
|
||||
int size_bytes = 0;
|
||||
std::string sha256;
|
||||
std::string status; // lab4: "ready"
|
||||
std::vector<Variant> variants; // lab4: always empty
|
||||
std::optional<std::string> error_code;
|
||||
std::string s3_key; // internal; never exposed in API JSON
|
||||
std::string created_at;
|
||||
std::string updated_at;
|
||||
};
|
||||
|
||||
// Track 1: pending presigned PUT session (not a public attachment until complete).
|
||||
struct DirectUpload {
|
||||
std::string id;
|
||||
std::string chat_id;
|
||||
std::string owner_id;
|
||||
std::string filename;
|
||||
std::string content_type;
|
||||
int expected_size = 0;
|
||||
std::string expected_sha256;
|
||||
std::string s3_key; // internal
|
||||
std::string status; // pending|completed|aborted|expired
|
||||
std::optional<std::string> attachment_id;
|
||||
std::string expires_at; // RFC3339 for JSON
|
||||
long long expires_at_epoch = 0; // for INSERT
|
||||
std::string created_at;
|
||||
std::string updated_at;
|
||||
};
|
||||
Reference in New Issue
Block a user