MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / CreateApp

Method CreateApp

module/service/iml.go:1218–1246  ·  view source on GitHub ↗
(ctx context.Context, teamID string, input *service_dto.CreateApp)

Source from the content-addressed store, hash-verified

1216}
1217
1218func (i *imlAppModule) CreateApp(ctx context.Context, teamID string, input *service_dto.CreateApp) (*service_dto.App, error) {
1219 if input.Id == "" {
1220 input.Id = uuid.New().String()
1221 }
1222 userId := utils.UserId(ctx)
1223 mo := &service.Create{
1224 Id: input.Id,
1225 Name: input.Name,
1226 Description: input.Description,
1227 Team: teamID,
1228 AsApp: true,
1229 }
1230 // 判断用户是否在团队内
1231 members, err := i.teamMemberService.Members(ctx, []string{teamID}, []string{userId})
1232 if err != nil {
1233 return nil, err
1234 }
1235 if len(members) == 0 {
1236 return nil, fmt.Errorf("master is not in team")
1237 }
1238
1239 err = i.transaction.Transaction(ctx, func(ctx context.Context) error {
1240 return i.serviceService.Create(ctx, mo)
1241 })
1242 if err != nil {
1243 return nil, err
1244 }
1245 return i.GetApp(ctx, input.Id)
1246}
1247
1248func (i *imlAppModule) UpdateApp(ctx context.Context, appId string, input *service_dto.UpdateApp) (*service_dto.App, error) {
1249 // userId := utils.UserId(ctx)

Callers

nothing calls this directly

Calls 4

GetAppMethod · 0.95
MembersMethod · 0.65
CreateMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected