mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-18 12:54:27 +01:00
(api) users: first_name, last_name
This commit is contained in:
parent
fdddb545d9
commit
4763014ec8
@ -5,7 +5,7 @@
|
||||
- OpenAPI endpoint to fetch accounting data
|
||||
- Updated OpenAPI documentation
|
||||
- OpenAPI users endpoint offer ability to filter by created_after
|
||||
- OpenAPI users endpoint return gender, organization and address
|
||||
- OpenAPI users endpoint return first name, last name, gender, organization and address
|
||||
- Fix a bug: providing an array of attributes to filter OpenApi data, results in error
|
||||
- Fix a bug: unable to manage stocks on new products
|
||||
- Fix a bug: unsupported param[] syntax in OpenAPI
|
||||
|
@ -28,6 +28,8 @@ class OpenAPI::V1::UsersDoc < OpenAPI::V1::BaseDoc
|
||||
"created_at": "2016-05-04T17:21:48.403+02:00",
|
||||
"external_id": "J5821-4"
|
||||
"full_name": "xxxx xxxx",
|
||||
"first_name": "xxxx",
|
||||
"last_name": "xxxx",
|
||||
"gender": "man",
|
||||
"organization": true,
|
||||
"address": "2 impasse xxxxxx, BRUXELLES",
|
||||
@ -43,6 +45,8 @@ class OpenAPI::V1::UsersDoc < OpenAPI::V1::BaseDoc
|
||||
"created_at": "2016-05-03T15:21:13.125+02:00",
|
||||
"external_id": "J5846-4"
|
||||
"full_name": "xxxxx xxxxx",
|
||||
"first_name": "xxxxx",
|
||||
"last_name": "xxxxx",
|
||||
"gender": "woman",
|
||||
"organization": true,
|
||||
"address": "Grenoble",
|
||||
@ -58,6 +62,8 @@ class OpenAPI::V1::UsersDoc < OpenAPI::V1::BaseDoc
|
||||
"created_at": "2016-05-03T13:51:03.223+02:00",
|
||||
"external_id": "J5900-1"
|
||||
"full_name": "xxxxxxx xxxx",
|
||||
"first_name": "xxxxxxx",
|
||||
"last_name": "xxxx",
|
||||
"gender": "man",
|
||||
"organization": false,
|
||||
"address": "21 rue des xxxxxx",
|
||||
@ -73,6 +79,8 @@ class OpenAPI::V1::UsersDoc < OpenAPI::V1::BaseDoc
|
||||
"created_at": "2016-05-03T12:24:38.724+02:00",
|
||||
"external_id": "P4172-4"
|
||||
"full_name": "xxx xxxxxxx",
|
||||
"first_name": "xxx",
|
||||
"last_name": "xxxxxxx",
|
||||
"gender": "woman",
|
||||
"organization": false,
|
||||
"address": "147 rue xxxxxx, 75000 PARIS, France",
|
||||
@ -94,6 +102,8 @@ class OpenAPI::V1::UsersDoc < OpenAPI::V1::BaseDoc
|
||||
"created_at": "2016-05-04T17:21:48.403+02:00",
|
||||
"external_id": "J5500-4"
|
||||
"full_name": "xxxx xxxxxx",
|
||||
"first_name": "xxxx",
|
||||
"last_name": "xxxxxx",
|
||||
"gender": "man",
|
||||
"organization": true,
|
||||
"address": "38100",
|
||||
@ -109,6 +119,8 @@ class OpenAPI::V1::UsersDoc < OpenAPI::V1::BaseDoc
|
||||
"created_at": "2016-05-03T15:21:13.125+02:00",
|
||||
"external_id": null,
|
||||
"full_name": "xxxxx xxxxxx",
|
||||
"first_name": "xxxx",
|
||||
"last_name": "xxxxxx",
|
||||
"gender": "woman",
|
||||
"organization": true,
|
||||
"address": "",
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
json.extract! user, :id, :email, :created_at, :external_id
|
||||
json.full_name user.profile.full_name if user.association(:profile).loaded?
|
||||
json.extract! user.profile, :full_name, :first_name, :last_name if user.association(:profile).loaded?
|
||||
json.gender user.statistic_profile.gender ? 'man' : 'woman'
|
||||
json.organization !user.invoicing_profile.organization.nil?
|
||||
json.address user.invoicing_profile.invoicing_address
|
||||
|
@ -19,6 +19,9 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
|
||||
assert_not_nil(users[:users].detect { |u| u[:external_id] == 'J5821-4' })
|
||||
assert(users[:users].all? { |u| %w[man woman].include?(u[:gender]) })
|
||||
assert(users[:users].all? { |u| u[:organization] != User.find(u[:id]).invoicing_profile.organization.nil? })
|
||||
assert(users[:users].all? { |u| u[:full_name].present? })
|
||||
assert(users[:users].all? { |u| u[:first_name].present? })
|
||||
assert(users[:users].all? { |u| u[:last_name].present? })
|
||||
assert(users[:users].any? { |u| u[:address].present? })
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user