just need to add creating services, deploying them, and showing logs
This commit is contained in:
parent
a3a4af7965
commit
023ad47ae4
6 changed files with 99 additions and 29 deletions
|
|
@ -3,6 +3,19 @@ defmodule EzcontainerRailway.Projects do
|
|||
|
||||
alias EzcontainerRailway.Repo
|
||||
alias EzcontainerRailway.Project
|
||||
alias EzcontainerRailway.Railway
|
||||
|
||||
def get_project_by_token(token) do
|
||||
{:ok, user_id} = Railway.get_user_id(token)
|
||||
|
||||
get_project_by_user_id(user_id)
|
||||
|
||||
Repo.one(
|
||||
from p in Project,
|
||||
where: p.user_id == ^user_id,
|
||||
limit: 1
|
||||
)
|
||||
end
|
||||
|
||||
def get_project_by_user_id(user_id) do
|
||||
Repo.one(
|
||||
|
|
@ -11,4 +24,13 @@ defmodule EzcontainerRailway.Projects do
|
|||
limit: 1
|
||||
)
|
||||
end
|
||||
|
||||
def create_project(token) do
|
||||
{:ok, project_id} = Railway.create_project(token)
|
||||
{:ok, user_id} = Railway.get_user_id(token)
|
||||
|
||||
%Project{}
|
||||
|> Project.changeset(%{user_id: user_id, project_id: project_id})
|
||||
|> Repo.insert!
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue