1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

modelise space object from API in TS

This commit is contained in:
Sylvain 2021-12-21 09:51:40 +01:00
parent 4a8fa65e5f
commit 6dc2e8e41e
4 changed files with 21 additions and 2 deletions

View File

@ -12,7 +12,7 @@ export interface Price {
priceable_type: string,
priceable_id: number,
amount: number,
duration: number // in minutes
duration?: number // in minutes
}
export interface ComputePriceResult {

View File

@ -0,0 +1,15 @@
export interface Space {
id: number,
name: string,
description: string,
slug: string,
default_places: number,
disabled: boolean,
space_image: string,
space_file_attributes?: {
id: number,
attachment: string,
attachement_url: string,
}
}

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
json.array!(@spaces) do |space|
json.extract! space, :id, :name, :description, :slug, :default_places, :disabled
json.space_image space.space_image.attachment.medium.url if space.space_image

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
json.extract! @space, :id, :name, :description, :characteristics, :created_at, :updated_at, :slug, :default_places, :disabled
json.space_image @space.space_image.attachment.large.url if @space.space_image
json.space_files_attributes @space.space_files do |f|
@ -9,4 +11,4 @@ end
# using the space in the space_show screen
# json.space_projects @space.projects do |p|
# json.extract! p, :slug, :name
# end
# end