Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get folowers and folowee #40

Merged
merged 17 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
new model - user response
  • Loading branch information
tiimuur committed Aug 31, 2024
commit fcdb6e2142b31b7bc9386f2939081ac2cbd1713a
16 changes: 16 additions & 0 deletions server/services/posts-uservice/src/models/user.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "user.hpp"

#include <boost/uuid/uuid_io.hpp>
#include <userver/formats/json/value_builder.hpp>

namespace posts_uservice::models {

userver::formats::json::Value Serialize(const UserResponse& data,
userver::formats::serialize::To<userver::formats::json::Value>) {
userver::formats::json::ValueBuilder builder;

builder["id"] = boost::uuids::to_string(data.id);

return builder.ExtractValue();
}
} // namespace posts_uservice::models
19 changes: 19 additions & 0 deletions server/services/posts-uservice/src/models/user.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <boost/uuid/uuid.hpp>
#include <chrono>
#include <optional>

#include <userver/formats/json/value.hpp>
#include <userver/formats/serialize/to.hpp>

namespace posts_uservice::models {

struct UserResponse {
boost::uuids::uuid id;
};

userver::formats::json::Value Serialize(const UserResponse& data,
userver::formats::serialize::To<userver::formats::json::Value>);

} // namespace posts_uservice::models