Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM registry.access.redhat.com/ubi8/nodejs-16-minimal:1-79
FROM registry.access.redhat.com/ubi9/nodejs-22:9.5-1740412185

USER 1001
USER default

WORKDIR /opt/app-root/src

COPY --chown=1001 . .
RUN npm install && \
COPY --chown=default:root . .
RUN npm ci && \
npm run compile

ENV HOST=0.0.0.0 PORT=3001
Expand Down
9 changes: 7 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3'
services:
ascent-bff:
image: quay.io/cloudnativetoolkit/ascent-bff:v1.1.0
image: ascent-bff-next
# image: quay.io/cloudnativetoolkit/ascent-bff:v1.1.0
# build: .
environment:
- DATABASE_TEST={"connection":{"mongodb":{"composed":["mongodb://mongodb:27017/mongodb"],"authentication":{"username":"mongodb","password":"passw0rd"},"hosts":[{"hostname":"localhost","port":27017}],"database":"mongodb","query_options":{"authSource":"admin","tls":false}}}}
Expand All @@ -21,4 +22,8 @@ services:
- "27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=mongodb
- MONGO_INITDB_ROOT_PASSWORD=passw0rd
- MONGO_INITDB_ROOT_PASSWORD=passw0rd
volumes:
- type: bind
source: ./data/db
target: /data/db
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": "14 || 16 || 17 || 18"
"node": "14 || 16 || 17 || 18 || 20 || 22"
},
"scripts": {
"compile": "npm run clean && lb-tsc",
Expand Down
8 changes: 6 additions & 2 deletions src/controllers/automation-catalog.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import { ArchitecturesController, DiagramType } from './architectures.controller

import { IascableService, Service } from '../services/iascable.service';
import { S3 } from 'ibm-cos-sdk';
import {Catalog} from "@cloudnativetoolkit/iascable";

export type CatalogResult = Omit<Catalog, "modules" | "moduleIdAliases" | "flattenedAliases">

export class AutomationCatalogController {

Expand Down Expand Up @@ -58,11 +60,13 @@ export class AutomationCatalogController {
}

@get('/automation/catalog/boms')
async getBomsCatalog(): Promise<object> {
const catalog = JSON.parse(JSON.stringify(await this.iascableService.getCatalog()));
async getBomsCatalog(): Promise<CatalogResult> {
const catalog: any = Object.assign({}, (await this.iascableService.getCatalog()));

delete catalog.modules;
delete catalog.moduleIdAliases;
delete catalog.flattenedAliases;

return catalog;
}

Expand Down
27 changes: 25 additions & 2 deletions src/controllers/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
repository,
} from '@loopback/repository';
import {
param, get, response, getModelSchemaRef, patch, requestBody
param, get, response, getModelSchemaRef, patch, requestBody, post
} from '@loopback/rest';
import {Architectures, Solution, User} from '../models';
import {Architectures, Bom, Solution, User} from '../models';
import {UserRepository} from '../repositories';

export class UserController {
Expand Down Expand Up @@ -93,4 +93,27 @@ export class UserController {
return this.userRepository.findById(id);
}

@post('/users')
@response(200, {
description: 'User model instance',
content: {
'application/json': {
schema: getModelSchemaRef(User, {includeRelations: true}),
},
},
})
async addUser(
@requestBody({
content: {
'application/json': {
schema: getModelSchemaRef(User, {
title: 'NewUser',
}),
},
},
})
user: User
): Promise<User> {
return this.userRepository.create(user);
}
}
1 change: 1 addition & 0 deletions src/interceptors/user.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
'UserController.prototype.findUserArchitecturesById',
'UserController.prototype.findUserSolutionsById',
'UserController.prototype.updateById',
'UserController.prototype.addUser',
]

/**
Expand Down