Commit 195bb3c8 authored by Anh Nga's avatar Anh Nga

complete api category

parent 3124c058
Pipeline #3374 failed with stages
in 1 minute and 7 seconds
input {
file {
path => "/home/logstash/logs/process.log"
type=> "process"
start_position => "beginning"
codec => "json"
}
}
filter {
date {
match => [ "timestamp", "yyyy-MM-dd'T'HH:mm:ss.SSSZ"]
}
}
output {
elasticsearch {
hosts => ["elastic:9200"]
}
}
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
FROM vothanhkiet/alpine-s6-node-native:8.7.0
WORKDIR /app
COPY ./app /app
ADD ./root /
RUN cd /app && \
npm install --quiet
RUN npm rebuild bcrypt --build-from-source
RUN npm rebuild grpc --build-from-source
RUN rm -rf /var/cache/apk/* /root/.npm /root/.node-gyp /tmp/* /var/tmp/*
EXPOSE 3000
#!/usr/bin/with-contenv sh
echo "Download setting from ${CONFIG_URL}"
curl ${CONFIG_URL} > /app/configs/configuration.yaml
if [ -n "$FIREBASE_URL" ]; then
curl ${FIREBASE_URL} > /app/configs/firebase.json
else
echo "Firebase key's URL was not found. Skip"
fi
cd /app && node server.js
import * as Bluebird from "bluebird";
import * as Knex from "knex";
import * as UUID from "uuid";
import * as Schema from "../schema";
import { PLATFORM } from "../../../libs/constants";
export const up = (knex: Knex, promise: typeof Bluebird): Bluebird<any> => {
return promise.resolve();
/**
* Create category table and its default data
*
* @param knex
* @param Promise
* @returns {Promise<R>|Created|Promise<TResult>|PromiseLike<TResult>|Promise.<TResult>|Promise<R2|R1>}
*/
const category = (knex, Promise) => {
// create setting table;
let SCHEMA = Schema.CATEGORY_TABLE_SCHEMA;
return Promise.resolve()
.then(() => {
return knex.schema.createTable(SCHEMA.TABLE_NAME, (table) => {
table.string(SCHEMA.FIELDS.ID, 36).notNullable().primary();
table.boolean(SCHEMA.FIELDS.IS_DELETED).notNullable().defaultTo(0);
table.dateTime(SCHEMA.FIELDS.CREATED_DATE).defaultTo(knex.raw("current_timestamp"));
table.dateTime(SCHEMA.FIELDS.UPDATED_DATE).defaultTo(knex.raw("current_timestamp"));
table.string(SCHEMA.FIELDS.NAME, 36);
});
});
};
export const down = (knex: Knex, promise: typeof Bluebird): Bluebird<any> => {
return promise.resolve();
};
\ No newline at end of file
export const up = (knex, Promise) => {
return Promise.resolve()
.then(() => {
return category(knex, Promise);
});
};
export const down = (knex, Promise) => {
return Promise.all([
knex.schema.raw(`DROP TABLE IF EXISTS ${Schema.CATEGORY_TABLE_SCHEMA.TABLE_NAME} CASCADE`),
]);
};
import * as Bluebird from "bluebird";
import * as Knex from "knex";
export const up = (knex: Knex, promise: typeof Bluebird): Bluebird<any> => {
return promise.resolve();
};
export const down = (knex: Knex, promise: typeof Bluebird): Bluebird<any> => {
return promise.resolve();
};
\ No newline at end of file
......@@ -8,8 +8,8 @@ router.route("/")
.post(CategoryHandler.create);
router.route("/:id")
.delete(isAuthenticated, CategoryHandler.delete)
.put(isAuthenticated, CategoryHandler.update);
.delete(CategoryHandler.delete)
.put(CategoryHandler.update);
export default router;
......@@ -23,6 +23,6 @@ router.route("/:id")
router.route("/")
.get(isAuthenticated, hasPrivilege([ROLE.SYSTEM_ADMIN, ROLE.MANAGER]), PackageHandler.list)
.post(isAuthenticated, hasPrivilege([ROLE.SYSTEM_ADMIN, ROLE.MANAGER]), PackageHandler.create);
.post(PackageHandler.create);
export default router;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment