This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Db.Schema.Channel do | |
use Ecto.Schema | |
import Ecto.Changeset | |
alias Db.Type.ChannelHashId | |
@derive {Jason.Encoder, only: [ | |
:basename, | |
:ordinal, | |
:small_thumbnail_path, | |
:med_thumbnail_path, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query = | |
from(task in Task, | |
join: org in Org, | |
join: rubric in Rubric, | |
join: coursecode in CourseCode, | |
join: task_category in TaskCategory, | |
where: org.uuid == ^org_uuid, | |
where: org.id == task.org_id, | |
where: rubric.id == task.rubric_id, | |
where: coursecode.id == task.coursecode_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query = | |
from(task in Task, | |
join: org in Org, | |
join: rubric in Rubric, | |
join: coursecode in CourseCode, | |
join: task_category in TaskCategory, | |
where: org.uuid == ^org_uuid, | |
where: org.id == task.org_id, | |
where: rubric.id == task.rubric_id, | |
where: coursecode.id == task.coursecode_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query = | |
from(task in Task, | |
join: org in Org, | |
join: rubric in Rubric, | |
where: org.uuid == ^org_uuid, | |
where: org.id == task.org_id, | |
where: rubric.id == task.rubric_id, | |
select: %{ | |
title: task.task_title, | |
uuid: task.uuid, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let databasePool: DatabasePool = self.userService.rawDatabasePool() | |
let coursesObservation = ValueObservation.tracking { db -> [MbyCourse] in | |
var courses: [MbyCourse] = [] | |
do { | |
let mbyCourses = try MbyCourse | |
.filter(Column("orgUuid") == self.orgUuid.value) // also tried removing this filter line | |
.filter(Column("archived") == false) // also tried removing this filter line | |
.fetchAll(db) | |
courses = mbyCourses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Attaching to faithfulword-phx_proxy_1, faithfulword-phx_postgres_1, faithfulword-phx_faithful_word_1 | |
proxy_1 | time="2019-10-09T02:19:28Z" level=info msg="Traefik version v1.7.18 built on 2019-09-26_01:56:30PM" | |
proxy_1 | time="2019-10-09T02:19:28Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v1.7/basics/#collected-data\n" | |
proxy_1 | time="2019-10-09T02:19:29Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0009500e0} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s" | |
proxy_1 | time="2019-10-09T02:19:29Z" level=info msg="Preparing server https &{Address::443 TLS:0xc0004b4480 Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0009501a0} with readTimeout=0s writeTimeout=0s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func fetchCourses() -> Single<[MbyCourse]> { | |
return Single.create { [unowned self] single in | |
do { | |
var fetchCourses: [MbyCourse] = [] | |
// let chapters: [Org]! | |
try self.dbPool.read { db in | |
fetchCourses = try MbyCourse.fetchAll(db) | |
} | |
single(.success(fetchCourses)) | |
} catch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import GRDB | |
public struct Playlist: Codable { | |
var uuid: String | |
public var channelUuid: String | |
public var bannerPath: String? | |
public var localizedname: String | |
public var languageId: String | |
public var mediaCategory: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker build -t olivetree:builder --target=builder . | |
FROM elixir:1.8.1-alpine as builder | |
RUN apk add --no-cache \ | |
gcc \ | |
git \ | |
make \ | |
musl-dev | |
RUN mix local.rebar --force && \ | |
mix local.hex --force | |
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(2)> import Ecto.Query | |
Ecto.Query | |
iex(3)> Video |> select([v], v.id) | |
#Ecto.Query<from v0 in DB.Schema.Video, select: v0.id> | |
iex(4)> Video |> select([v], v.id) |> DB.Repo.all() | |
[debug] QUERY OK source="videos" db=1.9ms decode=2.6ms queue=6.5ms | |
SELECT v0."id" FROM "videos" AS v0 [] | |
[1] | |
iex(5)> Video |> select([v], v.id) |> DB.Repo.all() |> Enum.map(&Video.changeset_generate_hash_id/1) | |
[debug] QUERY OK source="videos" db=0.3ms |