Skip to content

Commit

Permalink
fix: Definition of all values.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Aug 4, 2023
1 parent b49f148 commit e6f9ef6
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 18 deletions.
44 changes: 35 additions & 9 deletions packages/katana_cli/lib/command/code/collection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ part '$baseName.freezed.dart';
path = paths.sublist(0, paths.length - 1).join("/");
}
return """
/// Alias for ModelRef<${className}Model>.
///
/// When defining parameters for other Models, you can define them as follows
///
/// ```dart
/// @refParam ${className}ModelRef $baseName
/// ```
typedef ${className}ModelRef = ModelRef<${className}Model>?;
/// Value for model.
@freezed
@formValue
Expand Down Expand Up @@ -125,6 +116,41 @@ class ${className}Model with _\$${className}Model {
/// ```
static const form = _\$${className}ModelFormQuery();
}
/// Alias for ModelRef<${className}Model>.
///
/// When defining parameters for other Models, you can define them as follows
///
/// ```dart
/// @RefParam(${className}ModelDocument) ${className}ModelRef $baseName
/// ```
typedef ${className}ModelRef = ModelRef<${className}Model>?;
/// It can be defined as an empty ModelRef<${className}Model>.
///
/// ```dart
/// ${className}ModelRefPath("xxx") // Define as a path.
/// ```
typedef ${className}ModelRefPath = _\$${className}ModelPath;
/// Class for defining initial values to be passed to `initialValue` of [RuntimeModelAdapter].
///
/// ```dart
/// RuntimeModelAdapter(
/// initialValue: [
/// ${className}ModelInitialCollection(
/// "xxx": ${className}Model(...),
/// ),
/// ],
/// );
/// ```
typedef ${className}ModelInitialCollection = _\$${className}ModelInitialCollection;
/// Document class for storing ${className}Model.
typedef ${className}ModelDocument = _\$${className}ModelDocument;
/// Collection class for storing ${className}Model.
typedef ${className}ModelCollection = _\$${className}ModelCollection;
""";
}
}
42 changes: 33 additions & 9 deletions packages/katana_cli/lib/command/code/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ part '$baseName.freezed.dart';
}
}
return """
/// Alias for ModelRef<${className}Model>.
///
/// When defining parameters for other Models, you can define them as follows
///
/// ```dart
/// @refParam ${className}ModelRef $baseName
/// ```
typedef ${className}ModelRef = ModelRef<${className}Model>?;
/// Value for model.
@freezed
@formValue
Expand Down Expand Up @@ -116,6 +107,39 @@ class ${className}Model with _\$${className}Model {
/// ```
static const form = _\$${className}ModelFormQuery();
}
/// Alias for ModelRef<${className}Model>.
///
/// When defining parameters for other Models, you can define them as follows
///
/// ```dart
/// @RefParam(${className}ModelDocument) ${className}ModelRef $baseName
/// ```
typedef ${className}ModelRef = ModelRef<${className}Model>?;
/// It can be defined as an empty ModelRef<NoteModel>.
///
/// ```dart
/// NoteModelRefPath() // Define as a path.
/// ```
typedef ${className}ModelRefPath = _\$${className}ModelPath;
/// Class for defining initial values to be passed to `initialValue` of [RuntimeModelAdapter].
///
/// ```dart
/// RuntimeModelAdapter(
/// initialValue: [
/// ${className}ModelInitialDocument(
/// ${className}Model(...),
/// ),
/// ],
/// );
/// ```
typedef ${className}ModelInitialDocument = _\$${className}ModelInitialDocument;
/// Document class for storing ${className}Model.
typedef ${className}ModelDocument = _\$${className}ModelDocument;
""";
}
}

0 comments on commit e6f9ef6

Please sign in to comment.