feat:增加菜谱后端接口
This commit is contained in:
@@ -9,11 +9,7 @@ class Material {
|
||||
String name;
|
||||
String amount;
|
||||
|
||||
Material({
|
||||
required this.type,
|
||||
required this.name,
|
||||
required this.amount,
|
||||
});
|
||||
Material({required this.type, required this.name, required this.amount});
|
||||
|
||||
factory Material.fromJson(Map<String, dynamic> json) =>
|
||||
_$MaterialFromJson(json);
|
||||
@@ -28,14 +24,9 @@ class Step {
|
||||
String content;
|
||||
String imageUrl;
|
||||
|
||||
Step({
|
||||
required this.sort,
|
||||
required this.content,
|
||||
required this.imageUrl,
|
||||
});
|
||||
Step({required this.sort, required this.content, required this.imageUrl});
|
||||
|
||||
factory Step.fromJson(Map<String, dynamic> json) =>
|
||||
_$StepFromJson(json);
|
||||
factory Step.fromJson(Map<String, dynamic> json) => _$StepFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$StepToJson(this);
|
||||
}
|
||||
@@ -66,28 +57,40 @@ class Comment {
|
||||
/// 成果信息
|
||||
@JsonSerializable()
|
||||
class Record {
|
||||
int id;
|
||||
int? id;
|
||||
String name;
|
||||
String? category;
|
||||
String category;
|
||||
int person;
|
||||
String date;
|
||||
String imageUrl;
|
||||
|
||||
Record({
|
||||
required this.id,
|
||||
this.id,
|
||||
required this.name,
|
||||
this.category,
|
||||
required this.category,
|
||||
required this.person,
|
||||
required this.date,
|
||||
required this.imageUrl,
|
||||
});
|
||||
|
||||
factory Record.fromJson(Map<String, dynamic> json) =>
|
||||
_$RecordFromJson(json);
|
||||
factory Record.fromJson(Map<String, dynamic> json) => _$RecordFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$RecordToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class RecipeQuery {
|
||||
String category;
|
||||
|
||||
RecipeQuery({
|
||||
required this.category
|
||||
});
|
||||
|
||||
factory RecipeQuery.fromJson(Map<String, dynamic> json) => _$RecipeQueryFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$RecipeQueryToJson(this);
|
||||
}
|
||||
|
||||
/// 菜谱信息
|
||||
@JsonSerializable()
|
||||
class Recipe {
|
||||
@@ -100,8 +103,8 @@ class Recipe {
|
||||
int? userId;
|
||||
String? username;
|
||||
String? avatar;
|
||||
List<Material> materialList;
|
||||
List<Step> stepList;
|
||||
List<Material>? materialList;
|
||||
List<Step>? stepList;
|
||||
List<Record> recordList;
|
||||
List<int>? likeList;
|
||||
int? likeCount;
|
||||
@@ -120,8 +123,8 @@ class Recipe {
|
||||
this.userId,
|
||||
this.username,
|
||||
this.avatar,
|
||||
required this.materialList,
|
||||
required this.stepList,
|
||||
this.materialList,
|
||||
this.stepList,
|
||||
required this.recordList,
|
||||
this.likeList,
|
||||
this.likeCount,
|
||||
@@ -131,8 +134,7 @@ class Recipe {
|
||||
this.commentCount,
|
||||
});
|
||||
|
||||
factory Recipe.fromJson(Map<String, dynamic> json) =>
|
||||
_$RecipeFromJson(json);
|
||||
factory Recipe.fromJson(Map<String, dynamic> json) => _$RecipeFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$RecipeToJson(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user