Older/WebApplication/model/Tag.h

26 lines
497 B
C
Raw Normal View History

2024-11-02 00:30:14 +08:00
#ifndef __TAG_H__
#define __TAG_H__
#include <Wt/Dbo/Types.h>
class Post;
using Posts= Wt::Dbo::collection<Wt::Dbo::ptr<Post>> ;
class Tag {
public:
Tag() = default;
Tag(const std::string &aName) : name(aName) {
}
template <class Action>
void persist(Action &a) {
Wt::Dbo::field(a, name, "name");
Wt::Dbo::hasMany(a, posts, Wt::Dbo::ManyToMany, "post_tag");
}
std::string name;
Posts posts;
};
DBO_EXTERN_TEMPLATES(Tag)
#endif // __TAG_H__