Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #146 from shahryarjb/master
Browse files Browse the repository at this point in the history
Using MishkaDeveloperTools, fix email warning, sort blog tags, fix config warning
  • Loading branch information
shahryarjb authored Jan 1, 2022
2 parents e9b5acc + 34a3286 commit 114f2ec
Show file tree
Hide file tree
Showing 27 changed files with 175 additions and 529 deletions.
16 changes: 8 additions & 8 deletions apps/mishka_content/lib/blog/author.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule MishkaContent.Blog.Author do
alias MishkaDatabase.Schema.MishkaContent.BlogAuthor

import Ecto.Query
use MishkaDatabase.CRUD,
use MishkaDeveloperTools.DB.CRUD,
module: BlogAuthor,
error_atom: :blog_author,
repo: MishkaDatabase.Repo
Expand All @@ -15,34 +15,34 @@ defmodule MishkaContent.Blog.Author do
@type repo_data() :: Ecto.Schema.t()
@type repo_error() :: Ecto.Changeset.t()

@behaviour MishkaDatabase.CRUD
@behaviour MishkaDeveloperTools.DB.CRUD

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs) do
crud_add(attrs)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs, allowed_fields) do
crud_add(attrs, allowed_fields)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs) do
crud_edit(attrs)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs, allowed_fields) do
crud_edit(attrs, allowed_fields)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_delete, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_delete, 1}
def delete(id) do
crud_delete(id)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_get_record, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_get_record, 1}
def show_by_id(id) do
crud_get_record(id)
end
Expand Down
16 changes: 8 additions & 8 deletions apps/mishka_content/lib/blog/category.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule MishkaContent.Blog.Category do
alias MishkaDatabase.Schema.MishkaContent.Blog.Category

import Ecto.Query
use MishkaDatabase.CRUD,
use MishkaDeveloperTools.DB.CRUD,
module: Category,
error_atom: :category,
repo: MishkaDatabase.Repo
Expand All @@ -14,43 +14,43 @@ defmodule MishkaContent.Blog.Category do
@type repo_data() :: Ecto.Schema.t()
@type repo_error() :: Ecto.Changeset.t()

@behaviour MishkaDatabase.CRUD
@behaviour MishkaDeveloperTools.DB.CRUD

def subscribe do
Phoenix.PubSub.subscribe(MishkaHtml.PubSub, "blog_category")
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs) do
crud_add(attrs)
|> notify_subscribers(:category)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs, allowed_fields) do
crud_add(attrs, allowed_fields)
|> notify_subscribers(:category)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs) do
crud_edit(attrs)
|> notify_subscribers(:category)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs, allowed_fields) do
crud_edit(attrs, allowed_fields)
|> notify_subscribers(:category)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_delete, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_delete, 1}
def delete(id) do
crud_delete(id)
|> notify_subscribers(:category)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_get_record, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_get_record, 1}
def show_by_id(id) do
crud_get_record(id)
end
Expand Down
16 changes: 8 additions & 8 deletions apps/mishka_content/lib/blog/like.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule MishkaContent.Blog.Like do


import Ecto.Query
use MishkaDatabase.CRUD,
use MishkaDeveloperTools.DB.CRUD,
module: BlogLike,
error_atom: :post_like,
repo: MishkaDatabase.Repo
Expand All @@ -15,43 +15,43 @@ defmodule MishkaContent.Blog.Like do
@type repo_data() :: Ecto.Schema.t()
@type repo_error() :: Ecto.Changeset.t()

@behaviour MishkaDatabase.CRUD
@behaviour MishkaDeveloperTools.DB.CRUD

def subscribe do
Phoenix.PubSub.subscribe(MishkaHtml.PubSub, "blog_like")
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs) do
crud_add(attrs)
|> notify_subscribers(:like)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs, allowed_fields) do
crud_add(attrs, allowed_fields)
|> notify_subscribers(:like)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs) do
crud_edit(attrs)
|> notify_subscribers(:like)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs, allowed_fields) do
crud_edit(attrs, allowed_fields)
|> notify_subscribers(:like)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_delete, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_delete, 1}
def delete(id) do
crud_delete(id)
|> notify_subscribers(:like)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_get_record, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_get_record, 1}
def show_by_id(id) do
crud_get_record(id)
end
Expand Down
16 changes: 8 additions & 8 deletions apps/mishka_content/lib/blog/link.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule MishkaContent.Blog.BlogLink do


import Ecto.Query
use MishkaDatabase.CRUD,
use MishkaDeveloperTools.DB.CRUD,
module: BlogLink,
error_atom: :blog_link,
repo: MishkaDatabase.Repo
Expand All @@ -14,43 +14,43 @@ defmodule MishkaContent.Blog.BlogLink do
@type repo_data() :: Ecto.Schema.t()
@type repo_error() :: Ecto.Changeset.t()

@behaviour MishkaDatabase.CRUD
@behaviour MishkaDeveloperTools.DB.CRUD

def subscribe do
Phoenix.PubSub.subscribe(MishkaHtml.PubSub, "blog_link")
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs) do
crud_add(attrs)
|> notify_subscribers(:blog_link)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs, allowed_fields) do
crud_add(attrs, allowed_fields)
|> notify_subscribers(:blog_link)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs) do
crud_edit(attrs)
|> notify_subscribers(:blog_link)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs, allowed_fields) do
crud_edit(attrs, allowed_fields)
|> notify_subscribers(:blog_link)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_delete, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_delete, 1}
def delete(id) do
crud_delete(id)
|> notify_subscribers(:blog_link)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_get_record, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_get_record, 1}
def show_by_id(id) do
crud_get_record(id)
end
Expand Down
16 changes: 8 additions & 8 deletions apps/mishka_content/lib/blog/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule MishkaContent.Blog.Post do
alias MishkaContent.Blog.Like, as: UserLiked

import Ecto.Query
use MishkaDatabase.CRUD,
use MishkaDeveloperTools.DB.CRUD,
module: Post,
error_atom: :post,
repo: MishkaDatabase.Repo
Expand All @@ -16,43 +16,43 @@ defmodule MishkaContent.Blog.Post do
@type repo_data() :: Ecto.Schema.t()
@type repo_error() :: Ecto.Changeset.t()

@behaviour MishkaDatabase.CRUD
@behaviour MishkaDeveloperTools.DB.CRUD

def subscribe do
Phoenix.PubSub.subscribe(MishkaHtml.PubSub, "blog_post")
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs) do
crud_add(attrs)
|> notify_subscribers(:post)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs, allowed_fields) do
crud_add(attrs, allowed_fields)
|> notify_subscribers(:post)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs) do
crud_edit(attrs)
|> notify_subscribers(:post)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs, allowed_fields) do
crud_edit(attrs, allowed_fields)
|> notify_subscribers(:post)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_delete, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_delete, 1}
def delete(id) do
crud_delete(id)
|> notify_subscribers(:post)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_get_record, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_get_record, 1}
def show_by_id(id) do
crud_get_record(id)
end
Expand Down
17 changes: 9 additions & 8 deletions apps/mishka_content/lib/blog/tag.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule MishkaContent.Blog.Tag do
alias MishkaDatabase.Schema.MishkaContent.Blog.Post

import Ecto.Query
use MishkaDatabase.CRUD,
use MishkaDeveloperTools.DB.CRUD,
module: BlogTag,
error_atom: :blog_tag,
repo: MishkaDatabase.Repo
Expand All @@ -14,43 +14,43 @@ defmodule MishkaContent.Blog.Tag do
@type repo_data() :: Ecto.Schema.t()
@type repo_error() :: Ecto.Changeset.t()

@behaviour MishkaDatabase.CRUD
@behaviour MishkaDeveloperTools.DB.CRUD

def subscribe do
Phoenix.PubSub.subscribe(MishkaHtml.PubSub, "blog_tag")
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs) do
crud_add(attrs)
|> notify_subscribers(:tag)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_add, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_add, 1}
def create(attrs, allowed_fields) do
crud_add(attrs, allowed_fields)
|> notify_subscribers(:tag)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs) do
crud_edit(attrs)
|> notify_subscribers(:tag)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_edit, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_edit, 1}
def edit(attrs, allowed_fields) do
crud_edit(attrs, allowed_fields)
|> notify_subscribers(:tag)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_delete, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_delete, 1}
def delete(id) do
crud_delete(id)
|> notify_subscribers(:tag)
end

@doc delegate_to: {MishkaDatabase.CRUD, :crud_get_record, 1}
@doc delegate_to: {MishkaDeveloperTools.DB.CRUD, :crud_get_record, 1}
def show_by_id(id) do
crud_get_record(id)
end
Expand All @@ -59,6 +59,7 @@ defmodule MishkaContent.Blog.Tag do
def tags(conditions: {page, page_size}, filters: filters) do
query = from(tag in BlogTag) |> convert_filters_to_where_tag(filters)
from([tag] in query,
order_by: [desc: tag.inserted_at, desc: tag.id],
select: %{
id: tag.id,
title: tag.title,
Expand Down
Loading

0 comments on commit 114f2ec

Please sign in to comment.