Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b24d049
chore: create api-languages
tataihono Mar 3, 2022
a62b237
feat: fetch data from arclight api
tataihono Mar 3, 2022
32060a5
chore: add videos api
tataihono Mar 7, 2022
7b897a9
chore: match translation object
tataihono Mar 7, 2022
8e2248d
Merge branch '22-02-TN-chore-add-languages-api' into 22-02-TN-chore-a…
tataihono Mar 7, 2022
be0329b
feat: add download links
tataihono Mar 7, 2022
656aa00
feat: add study questions to video
tataihono Mar 7, 2022
158838f
feat: implement language module
GeronimoJohn Mar 7, 2022
a8b0855
chore: change seeder to match new format
tataihono Mar 8, 2022
2de5670
fix: fulltext title search
tataihono Mar 8, 2022
46f5a6c
refactor: language and translation module
GeronimoJohn Mar 8, 2022
796f859
Merge branch '22-02-TN-chore-add-languages-api' into 22-02-TN-chore-a…
GeronimoJohn Mar 8, 2022
cec164d
chore: add language and title filters
tataihono Mar 8, 2022
a3d740a
Merge branch '22-02-TN-chore-add-videos-api' of https://github.com/Je…
GeronimoJohn Mar 8, 2022
0da3b92
feat: add tagIds
tataihono Mar 9, 2022
2160af7
feat: created video object
GeronimoJohn Mar 9, 2022
2157021
fix: language getAll logic
GeronimoJohn Mar 9, 2022
7da020a
Merge branch '22-02-TN-chore-add-languages-api' into 22-02-TN-chore-a…
GeronimoJohn Mar 9, 2022
8a662ae
chore: add arclight api key env
tataihono Mar 10, 2022
463e921
Merge branch '22-02-TN-chore-add-languages-api' of https://github.com…
tataihono Mar 10, 2022
8347572
chore: refactor seed
tataihono Mar 10, 2022
e73dd6b
chore: add translation field decorator
tataihono Mar 10, 2022
190313a
Merge branch '22-02-TN-chore-add-languages-api' into 22-02-TN-chore-a…
tataihono Mar 10, 2022
326e2b5
Merge branch 'main' into 22-02-TN-chore-add-languages-api
tataihono Mar 10, 2022
e172ad7
chore: change lint syntax
tataihono Mar 11, 2022
f531d6f
fix: nest decorator lint
tataihono Mar 11, 2022
f7ef6dc
feat: refactor video object and added filterAll
GeronimoJohn Mar 11, 2022
921e94c
fix: languageId should be id
tataihono Mar 11, 2022
251abd4
Merge branch '22-02-TN-chore-add-languages-api' into 22-02-TN-chore-a…
tataihono Mar 11, 2022
15740b2
fix: pr feedback
tataihono Mar 11, 2022
ee036d6
Merge branch '22-02-TN-chore-add-languages-api' into 22-02-TN-chore-a…
tataihono Mar 11, 2022
91b6c2f
chore: remove .env file
tataihono Mar 11, 2022
d662cd0
fix: remove invalid nulls
tataihono Mar 11, 2022
410258d
Merge branch 'main' into 22-02-TN-chore-add-videos-api
tataihono Mar 11, 2022
e54e925
fix: simplify video type naming
tataihono Mar 13, 2022
a6478ac
chore: generate graphql
tataihono Mar 14, 2022
674cb81
chore: generate graphql api-languages
tataihono Mar 14, 2022
ee89d6e
feat: add translation resolver
tataihono Mar 14, 2022
218135d
revert: remove unecessary change
tataihono Mar 15, 2022
5e034f1
test: video resolver and service tests
tataihono Mar 16, 2022
2fa77d9
Merge branch 'main' into 22-02-TN-chore-add-videos-api
tataihono Mar 16, 2022
1d78a78
fix: spelling mistake on describe
tataihono Mar 16, 2022
435abad
test: add additional resolver specs
tataihono Mar 16, 2022
19ec59f
feat: add getVideo Query
GeronimoJohn Mar 16, 2022
872fd5e
revert: remove single video endpoint
GeronimoJohn Mar 16, 2022
7bb1eae
chore: k8s and github config
mikeallisonJS Mar 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/workflows/api-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,37 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
api-languages:
uses: JesusFilm/core/.github/workflows/api-deploy-worker.yml@main
with:
name: api-languages
repository: jfp-api-languages
branch: ${{ github.ref_name }}
secrets:
ARANGODB_URL: ${{ secrets.ARANGODB_URL }}
ARANGODB_USER: ${{ secrets.ARANGODB_USER }}
ARANGODB_PASS: ${{ secrets.ARANGODB_PASS }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
api-videos:
uses: JesusFilm/core/.github/workflows/api-deploy-worker.yml@main
with:
name: api-videos
repository: jfp-api-videos
branch: ${{ github.ref_name }}
secrets:
ARANGODB_URL: ${{ secrets.ARANGODB_URL }}
ARANGODB_USER: ${{ secrets.ARANGODB_USER }}
ARANGODB_PASS: ${{ secrets.ARANGODB_PASS }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}

api-gateway:
needs: [api-journeys, api-users]
needs: [api-journeys, api-users, api-languages, api-videos]
uses: JesusFilm/core/.github/workflows/api-gateway-worker.yml@main
with:
name: api-gateway
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/api-gateway-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ jobs:
if: ${{ inputs.branch }} == 'main'
run: rover subgraph introspect http://ad67299f5087f4d1b845926ce1832198-64788321.us-east-2.elb.amazonaws.com:4002/graphql > dist/apps/api-gateway/api-users-schema.graphql

- name: Build api-languages-stage schema
if: ${{ inputs.branch }} == 'stage'
run: rover subgraph introspect https://api-languages-stage.core.jesusfilm.org/graphql > dist/apps/api-gateway/api-languages-schema.graphql

- name: Build api-languages-main schema
if: ${{ inputs.branch }} == 'main'
run: rover subgraph introspect https://api-languages.core.jesusfilm.org/graphql > dist/apps/api-gateway/api-languages-schema.graphql

- name: Build api-videos-stage schema
if: ${{ inputs.branch }} == 'stage'
run: rover subgraph introspect https://api-videos-stage.core.jesusfilm.org/graphql > dist/apps/api-gateway/api-videos-schema.graphql

- name: Build api-videos-main schema
if: ${{ inputs.branch }} == 'main'
run: rover subgraph introspect https://api-videos.core.jesusfilm.org/graphql > dist/apps/api-gateway/api-videos-schema.graphql

- name: Build api-gateway schema
run: rover supergraph compose --config apps/api-gateway/supergraph-$ENV_SUFFIX.yml > dist/apps/api-gateway/schema.graphql

Expand Down
6 changes: 6 additions & 0 deletions apps/api-gateway/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
{
"command": "nx serve api-users"
},
{
"command": "nx serve api-languages"
},
{
"command": "nx serve api-videos"
},
{
"command": "nx serve api-gateway"
},
Expand Down
43 changes: 42 additions & 1 deletion apps/api-gateway/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ enum join__Graph {
JOURNEYS @join__graph(name: "journeys" url: "http://127.0.0.1:4001/graphql")
LANGUAGES @join__graph(name: "languages" url: "http://127.0.0.1:4003/graphql")
USERS @join__graph(name: "users" url: "http://127.0.0.1:4002/graphql")
VIDEOS @join__graph(name: "videos" url: "http://127.0.0.1:4004/graphql")
}

type Journey
Expand Down Expand Up @@ -353,11 +354,12 @@ input JourneyUpdateInput {
type Language
@join__owner(graph: LANGUAGES)
@join__type(graph: LANGUAGES, key: "id")
@join__type(graph: VIDEOS, key: "id")
{
bcp47: String @join__field(graph: LANGUAGES)
id: ID! @join__field(graph: LANGUAGES)
iso3: String @join__field(graph: LANGUAGES)
name(languageId: ID, primary: Boolean): [Translation]! @join__field(graph: LANGUAGES)
name(languageId: ID, primary: Boolean): [Translation!]! @join__field(graph: LANGUAGES)
}

type LinkAction implements Action {
Expand Down Expand Up @@ -458,6 +460,7 @@ type Query {
language(id: ID!): Language @join__field(graph: LANGUAGES)
languages(limit: Int, page: Int): [Language!]! @join__field(graph: LANGUAGES)
me: User @join__field(graph: USERS)
videos(limit: Int, page: Int, where: VideosFilter): [Video!]! @join__field(graph: VIDEOS)
}

type RadioOptionBlock implements Block {
Expand Down Expand Up @@ -701,6 +704,20 @@ enum UserJourneyRole {
owner
}

type Video
@join__owner(graph: VIDEOS)
@join__type(graph: VIDEOS, key: "id")
{
description(languageId: ID, primary: Boolean): [Translation!]! @join__field(graph: VIDEOS)
id: ID! @join__field(graph: VIDEOS)
image: String @join__field(graph: VIDEOS)
snippet(languageId: ID, primary: Boolean): [Translation!]! @join__field(graph: VIDEOS)
studyQuestions(languageId: ID, primary: Boolean): [Translation!]! @join__field(graph: VIDEOS)
title(languageId: ID, primary: Boolean): [Translation!]! @join__field(graph: VIDEOS)
variant(languageId: ID): VideoVariant @join__field(graph: VIDEOS)
variantLanguages: [Language!]! @join__field(graph: VIDEOS)
}

type VideoArclight implements VideoContent {
languageId: String!
mediaComponentId: String!
Expand Down Expand Up @@ -820,6 +837,11 @@ enum VideoResponseStateEnum {
PLAYING
}

input VideosFilter {
availableVariantLanguageIds: [ID!]
title: String
}

"""
VideoTriggerBlock is a block that indicates the video to navigate
to the next block at the designated time.
Expand All @@ -837,3 +859,22 @@ type VideoTriggerBlock implements Block {
"""
triggerStart: Int!
}

type VideoVariant {
downloads: [VideoVariantDownload!]!
duration: Int!
hls: String!
language: Language!
subtitle(languageId: ID, primary: Boolean): [Translation!]!
}

type VideoVariantDownload {
quality: VideoVariantDownloadQuality!
size: Float!
url: String!
}

enum VideoVariantDownloadQuality {
high
low
}
8 changes: 8 additions & 0 deletions apps/api-gateway/supergraph-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ subgraphs:
routing_url: http://api-users-main:4002/graphql
schema:
file: ../../dist/apps/api-gateway/api-users-schema.graphql
languages:
routing_url: http://api-languages-main:4003/graphql
schema:
file: ../../dist/apps/api-gateway/api-languages-schema.graphql
videos:
routing_url: http://api-videos-main:4004/graphql
schema:
file: ../../dist/apps/api-gateway/api-videos-schema.graphql
8 changes: 8 additions & 0 deletions apps/api-gateway/supergraph-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ subgraphs:
routing_url: http://api-users-stage:4002/graphql
schema:
file: ../../dist/apps/api-gateway/api-users-schema.graphql
languages:
routing_url: http://api-languages-stage:4003/graphql
schema:
file: ../../dist/apps/api-gateway/api-languages-schema.graphql
videos:
routing_url: http://api-videos-stage:4004/graphql
schema:
file: ../../dist/apps/api-gateway/api-videos-schema.graphql
4 changes: 4 additions & 0 deletions apps/api-gateway/supergraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ subgraphs:
routing_url: http://127.0.0.1:4003/graphql
schema:
file: ../api-languages/schema.graphql
videos:
routing_url: http://127.0.0.1:4004/graphql
schema:
file: ../api-videos/schema.graphql
2 changes: 1 addition & 1 deletion apps/api-languages/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type Language @key(fields: "id") {
id: ID!
bcp47: String
iso3: String
name(languageId: ID, primary: Boolean): [Translation]!
name(languageId: ID, primary: Boolean): [Translation!]!
}

type Translation {
Expand Down
2 changes: 1 addition & 1 deletion apps/api-languages/src/app/__generated__/graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type Language @key(fields: "id") {
id: ID!
bcp47: String
iso3: String
name(languageId: ID, primary: Boolean): [Translation]!
name(languageId: ID, primary: Boolean): [Translation!]!
}

extend type Query {
Expand Down
2 changes: 2 additions & 0 deletions apps/api-languages/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Logger } from '@nestjs/common'
import { NestFactory } from '@nestjs/core'
import { json } from 'body-parser'
import { AppModule } from './app/app.module'

async function bootstrap(): Promise<void> {
const port = process.env.PORT ?? '4003'
const app = await NestFactory.create(AppModule)
await app.use(json({ limit: '50mb' }))
await app.listen(port, () => {
Logger.log('Listening at http://localhost:' + port + '/graphql')
})
Expand Down
2 changes: 2 additions & 0 deletions apps/api-videos/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL="arangodb://arangodb:8529"
ARCLIGHT_API_KEY=
21 changes: 21 additions & 0 deletions apps/api-videos/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"parserOptions": {
"project": ["apps/api-videos/tsconfig.*?.json"]
},
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
8 changes: 8 additions & 0 deletions apps/api-videos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:14-alpine
WORKDIR /app
COPY ./dist/apps/api-videos .
EXPOSE 4004
# dependencies that nestjs needs
RUN npm install --production --silent
RUN npm install tslib apollo-server-express @nestjs/mapped-types
CMD node ./main.js
13 changes: 13 additions & 0 deletions apps/api-videos/db/db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Database } from 'arangojs'

export function ArangoDB(): Database {
let db: Database
if (process.env.DATABASE_DB != null)
db = new Database({
url: process.env.DATABASE_URL,
databaseName: process.env.DATABASE_DB
})
else db = new Database({ url: process.env.DATABASE_URL })
db.useBasicAuth(process.env.DATABASE_USER, process.env.DATABASE_PASS)
return db
}
Loading