Skip to content

Commit

Permalink
Merge pull request #26 from arati-tekdi/main
Browse files Browse the repository at this point in the history
Enabled cors
  • Loading branch information
arati-tekdi authored Oct 4, 2024
2 parents 943a22d + babfd28 commit f2c6042
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 50 deletions.
171 changes: 121 additions & 50 deletions src/common/middleware/apiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export const apiList = {
post: {},
}),
//user-service
'/user/v1/auth': createRouteObject({
get: {},
}),
'/user/v1/create': createRouteObject({
post: {
PRIVILEGE_CHECK: privilegeGroup.users.create,
Expand Down Expand Up @@ -524,23 +527,6 @@ export const apiList = {
{ get: {} },
'/framework/v3/read/:identifier',
),
'/action/composite/v3/search': createRouteObject({ post: {} }, '/v3/search'),
'/action/object/category/definition/v1/read': createRouteObject(
{ post: {} },
'/object/category/definition/v4/read',
),
'/action/asset/v1/create': createRouteObject(
{ post: {} },
'/asset/v4/create',
),
'/action/asset/v1/upload/url/:identifier': createRouteObject(
{ post: {} },
'/asset/v4/upload/url/:identifier',
),
'/action/asset/v1/upload/:identifier': createRouteObject(
{ post: {} },
'/asset/v4/upload/identifier',
),
'/action/question/v2/read/:identifier': createRouteObject(
{ get: {} },
'/question/v5/read/:identifier',
Expand All @@ -549,47 +535,14 @@ export const apiList = {
{ get: {} },
'/asset/v4/read/:identifier',
),
'/action/content/v3/upload/url/:identifier': createRouteObject(
{ post: {} },
'/content/v3/upload/url/:identifier',
),
'/action/content/v3/create': createRouteObject(
{ post: {} },
'/content/v4/create',
),
'/action/content/v3/upload/:identifier': createRouteObject(
{ post: {} },
'/content/v4/upload/:identifier',
),
'/action/content/v3/read/:identifier': createRouteObject(
{ get: {} },
'/content/v4/read/:identifier',
),
'/action/content/v3/update/:identifier': createRouteObject(
{ patch: {} },
'/content/v4/update/:identifier',
),
'/action/content/v3/review/:identifier': createRouteObject({ post: {} }),
'/api/content/v1/read/:identifier': createRouteObject(
{ get: {} },
'/content/v4/read/:identifier',
),
'/content/content/v1/reject/:identifier': createRouteObject(
{ post: {} },
'/content/v4/reject/:identifier',
),
'/content/content/v1/publish/:identifier': createRouteObject(
{ post: {} },
'content/v4/publish/:identifier',
),
'/action/content/v1/reject/:identifier': createRouteObject(
{ post: {} },
'/content/v4/reject/:identifier',
),
'/action/content/v1/publish/:identifier': createRouteObject(
{ post: {} },
'content/v4/publish/:identifier',
),
//secure
'/action/questionset/v2/create': createRouteObject(
{
Expand Down Expand Up @@ -655,6 +608,124 @@ export const apiList = {
},
'/questionset/v5/comment/update/:identifier',
),
////////////////////////////////////////////////////
'/action/composite/v3/search': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.read,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/v3/search',
),
'/action/object/category/definition/v1/read': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.read,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/object/category/definition/v4/read',
),
'/action/asset/v1/create': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.create,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/asset/v4/create',
),
'/action/asset/v1/upload/url/:identifier': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.create,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/asset/v4/upload/url/:identifier',
),
'/action/asset/v1/upload/:identifier': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.create,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/asset/v4/upload/identifier',
),
'/action/content/v3/upload/url/:identifier': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.create,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v3/upload/url/:identifier',
),
'/action/content/v3/create': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.create,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v4/create',
),
'/action/content/v3/upload/:identifier': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.create,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v4/upload/:identifier',
),
'/action/content/v3/update/:identifier': createRouteObject(
{
patch: {
PRIVILEGE_CHECK: privilegeGroup.content.update,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v4/update/:identifier',
),
'/action/content/v3/review/:identifier': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.review,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v4/review/:identifier',
),
'/action/content/v3/reject/:identifier': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.review,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v4/reject/:identifier',
),
'/action/content/v3/publish/:identifier': createRouteObject(
{
post: {
PRIVILEGE_CHECK: privilegeGroup.content.review,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v4/publish/:identifier',
),
'/action/content/v3/retire/:identifier': createRouteObject(
{
delete: {
PRIVILEGE_CHECK: privilegeGroup.content.delete,
ROLE_CHECK: rolesGroup.content_restricted,
},
},
'/content/v4/retire/:identifier',
),

//attendance service
'/api/v1/attendance': createRouteObject({
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as dotenv from 'dotenv';
async function bootstrap() {
dotenv.config(); // Load environment variables from .env file
const app = await NestFactory.create(AppModule);
app.enableCors();
const config = new DocumentBuilder()
.setTitle('Middleware APIs')
.setDescription('The Middlware service')
Expand Down

0 comments on commit f2c6042

Please sign in to comment.