Skip to content

Instantly share code, notes, and snippets.

@chebykinn
Created February 13, 2023 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chebykinn/702f24abe035cd99dbc06c4447ecc755 to your computer and use it in GitHub Desktop.
Save chebykinn/702f24abe035cd99dbc06c4447ecc755 to your computer and use it in GitHub Desktop.
Helper for converting todo application model to openapi model
package handlers
import (
"example.com/namespace/todo-app/go-services/internal/todo-backend/domain"
openapi "example.com/namespace/todo-app/go-services/internal/todo-backend/generated/api"
)
func MakeAPITodoNote(note domain.TodoNote) openapi.TodoNote {
return openapi.TodoNote{
Id: note.ID,
Title: note.Title,
Description: note.Description,
IsCompleted: note.IsCompleted,
CreatedAt: note.CreatedAt.Format("2006-01-02 15:04:05"),
UpdatedAt: note.UpdatedAt.Format("2006-01-02 15:04:05"),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment