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

Improve serverpod and add some features #2202

Open
AdamMusa opened this issue May 2, 2024 · 0 comments
Open

Improve serverpod and add some features #2202

AdamMusa opened this issue May 2, 2024 · 0 comments

Comments

@AdamMusa
Copy link
Contributor

AdamMusa commented May 2, 2024

Hello, i want to contribute more about this amazing project so here is my thought.

API Documentation

We should provide API Documentation using Swagger by default with zero or less configuration as possible

Serverpod migration tool

we should add a possibility to create a model from cli i'm explaining when we create our model from serverpod cli it should automatically create a model into the server project with couple of attributes that you specify from your terminal.

serverpod g model Hero name:String? age:int

it gonna generate a model in the server project like this

class: Hero
table: hero
fields:
  name: String?
  age: int

And with endpoint file hero_endpoint if necessary and apply automatically the migration after generating the model.

Possibility to revoke a migration

We should provide a cli command to revoke a last migration(by default) you did or revoke a specific migration.
for specific migration

serverpod d or destroy migration -v 'id of migration'

or last migration

serverpod d or destroy migration

Possibility to scaffold add crud operation in just single of command

We should keep the programmer happiness and improve our speed of development by adding some goodies to our developpers.
To scaffold a blog post without ui we should give something like this to our developper :

serverpod generate or g(for short) scaffold Blog title:String? content:String?

It going to generate model like this

class: Blog
table: blog
fields:
  title: String?
  content: String?

and into endpoint folder inside the blog_endpoint file we should have something like this :

import 'package:serverpod/serverpod.dart';
import 'package:myapp_server/src/generated/blog.dart';

class BlogEndpoint extends Endpoint {

  Future<bool> add(
    Session session,
    Blog blog,
  ) async {
    await Blog.db.insertRow(session, blog);
    return true;
  }

  Future<List<Blog>> getBlogs(Session session) async {
    return await Blog.db.find(session);
  }
   Future<Blog?> getBlog(Session session, int id) async {
    return await Blog.db.findById(session, id);
  }


  Future<Blog> update(
    Session session,
    Blog blog,
  ) async {
    return await Blog.db.updateRow(session, blog);
  }

  Future<bool> delete(
    Session session,
    Blog blog,
  ) async {
     await Blog.db.delete(session, blog);
    return true;
  }
}

And automatically add into API Documenetation which is swagger.

Possibility to provide an administration interface by default

We should provide a web interface for administration for someone who want to try to execute his model in add panel for example like Django admin panel. The developer should import his model in our admin model and that's he added this specific model into admin panel.

Suggestion
for starting server let use serverpod serve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant