Skip to content

Commit

Permalink
Application listings (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucieo authored Feb 22, 2024
1 parent 1380afe commit 128963b
Show file tree
Hide file tree
Showing 35 changed files with 1,319 additions and 150 deletions.
2 changes: 1 addition & 1 deletion back/api/application/config/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"routes": [
{
"method": "GET",
"path": "/applications/me",
"path": "/applications/me/:campaignId",
"handler": "application.myApplications",
"config": {
"policies": ["global::is-authenticated"],
Expand Down
3 changes: 2 additions & 1 deletion back/api/application/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
module.exports = {
async myApplications(ctx) {
const { id, type } = ctx.state.user;
const query = type === "place" ? { 'disponibility.espace.users_permissions_user.id':id} : { company: id };
const {query: initialQuery}=ctx.request;
const query = type === "place" ? {...initialQuery, 'disponibility.espace.users_permissions_user.id':id} : {...initialQuery, company: id };
const populate = type==="place"? ['disponibility.espace','company']:['disponibility.espace', 'place','disponibility.espace.users_permissions_user']

return strapi
Expand Down
32 changes: 30 additions & 2 deletions back/api/application/documentation/1.0.0/application.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"paths": {
"/applications/me": {
"/applications/me/{campaignId}": {
"get": {
"deprecated": false,
"description": "Get applications related to current user",
Expand Down Expand Up @@ -54,7 +54,18 @@
"tags": [
"Application"
],
"parameters": []
"parameters": [
{
"name": "campaignId",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
}
]
}
},
"/applications": {
Expand Down Expand Up @@ -853,6 +864,9 @@
"type": "string"
}
},
"preselections_max": {
"type": "integer"
},
"published_at": {
"type": "string"
},
Expand Down Expand Up @@ -1166,6 +1180,13 @@
}
}
},
"status": {
"type": "string",
"enum": [
"preselected",
"confirmed"
]
},
"published_at": {
"type": "string",
"format": "date-time"
Expand Down Expand Up @@ -1216,6 +1237,13 @@
"espace": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"preselected",
"confirmed"
]
},
"published_at": {
"type": "string",
"format": "date-time"
Expand Down
149 changes: 148 additions & 1 deletion back/api/application/documentation/1.0.0/overrides/application.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"paths": {
"/applications/me": {
"/applications/me/{campaignId}": {
"get": {
"deprecated": false,
"description": "Get applications related to current user",
Expand Down Expand Up @@ -55,6 +55,153 @@
"Application"
],
"parameters": [
{
"name": "campaignId",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "_limit",
"in": "query",
"required": false,
"description": "Maximum number of results possible",
"schema": {
"type": "integer"
},
"deprecated": false
},
{
"name": "_sort",
"in": "query",
"required": false,
"description": "Sort according to a specific field.",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_start",
"in": "query",
"required": false,
"description": "Skip a specific number of entries (especially useful for pagination)",
"schema": {
"type": "integer"
},
"deprecated": false
},
{
"name": "=",
"in": "query",
"required": false,
"description": "Get entries that matches exactly your input",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_ne",
"in": "query",
"required": false,
"description": "Get records that are not equals to something",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_lt",
"in": "query",
"required": false,
"description": "Get record that are lower than a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_lte",
"in": "query",
"required": false,
"description": "Get records that are lower than or equal to a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_gt",
"in": "query",
"required": false,
"description": "Get records that are greater than a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_gte",
"in": "query",
"required": false,
"description": "Get records that are greater than or equal a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_contains",
"in": "query",
"required": false,
"description": "Get records that contains a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_containss",
"in": "query",
"required": false,
"description": "Get records that contains (case sensitive) a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_in",
"in": "query",
"required": false,
"description": "Get records that matches any value in the array of values",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": false
},
{
"name": "_nin",
"in": "query",
"required": false,
"description": "Get records that doesn't match any value in the array of values",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": false
}


]
}
Expand Down
11 changes: 9 additions & 2 deletions back/api/application/models/application.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"type": "json"
},
"campaign": {
"model": "campaign",
"via": "applications"
"via": "applications",
"model": "campaign"
},
"company": {
"plugin": "users-permissions",
Expand All @@ -70,6 +70,13 @@
"espace": {
"model": "espace",
"via": "applications"
},
"status": {
"type": "enumeration",
"enum": [
"preselected",
"confirmed"
]
}
}
}
13 changes: 13 additions & 0 deletions back/api/campaign/documentation/1.0.0/campaign.json
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,13 @@
"espace": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"preselected",
"confirmed"
]
},
"published_at": {
"type": "string"
},
Expand All @@ -908,6 +915,9 @@
}
}
},
"preselections_max": {
"type": "integer"
},
"published_at": {
"type": "string",
"format": "date-time"
Expand Down Expand Up @@ -1003,6 +1013,9 @@
"type": "string"
}
},
"preselections_max": {
"type": "integer"
},
"published_at": {
"type": "string",
"format": "date-time"
Expand Down
3 changes: 3 additions & 0 deletions back/api/campaign/models/campaign.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
"applications": {
"via": "campaign",
"collection": "application"
},
"preselections_max": {
"type": "integer"
}
}
}
10 changes: 10 additions & 0 deletions back/api/disponibility/documentation/1.0.0/disponibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,9 @@
"type": "string"
}
},
"preselections_max": {
"type": "integer"
},
"published_at": {
"type": "string"
},
Expand Down Expand Up @@ -1092,6 +1095,13 @@
"espace": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"preselected",
"confirmed"
]
},
"published_at": {
"type": "string"
},
Expand Down
2 changes: 2 additions & 0 deletions back/api/espace/controllers/espace.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ const populate = [

module.exports = {
async myPlaces(ctx) {
const {query}=ctx.request;
const { id } = ctx.state.user;
return strapi.query("espace").find(
{
...query,
users_permissions_user: id,
deleted: false,
_sort: "name:asc",
Expand Down
7 changes: 7 additions & 0 deletions back/api/espace/documentation/1.0.0/espace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,13 @@
"espace": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"preselected",
"confirmed"
]
},
"published_at": {
"type": "string"
},
Expand Down
Loading

0 comments on commit 128963b

Please sign in to comment.