mindpin / image-service

图床服务。提供多版本图片转换。
http://img.4ye.me/
7 stars 2 forks source link

ImageComment 集成记录 #29

Closed ben7th closed 9 years ago

ben7th commented 9 years ago

模型结构:

belongs_to :user
belongs_to :file_entity

x # 正整数
y # 正整数
text # 文本

需求 API

创建:传 x,y,text,返回 id
删除:传 id
取得所有:传图片id,返回数组,包括每一项的id,x,y,text

API 实现写在 white_board_controller 里

fushang318 commented 9 years ago
get    '/f/:id/image_comments'  => 'white_board#get_image_comments'
response
  [
    {
      :id             => id.to_s,
      :file_entity_id => file_entity.id.to_s,
      :user           => {
                        :id
                        :name
                        :avatar_url
      },
      :x              => x,
      :y              => y,
      :text           => text
    }
  ]
post   '/f/:id/image_comments' => 'white_board#create_image_comment'
params
  x
  y
  text
response
  {
    :id             => id.to_s,
    :file_entity_id => file_entity.id.to_s,
    :user           => {
                      :id
                      :name
                      :avatar_url
    },
    :x              => x,
    :y              => y,
    :text           => text
  }
delete '/f/:id/image_comments/:image_comment_id' => 'white_board#destroy_image_comment'

response
  {:status => 200}
ben7th commented 9 years ago

已经集成到 0.3 版